Diego,

Please find below the corrected example. There were several issues but the
most important one, which is certainly the cause of the segfault, is that
"real(dp)" (with dp = selected_real_kind(p=16)) is NOT equal to
MPI_DOUBLE_RECISION. For double precision you should use 15 (and not 16).

  George.


On Thu, Jan 8, 2015 at 6:08 AM, Jeff Squyres (jsquyres) <jsquy...@cisco.com>
wrote:

>  There were still some minor errors left over in the attached program.
>
> I strongly encourage you to use "use mpi" instead of "include 'mpif.h'"
> because you will get compile time errors when you pass incorrect / forget
> to pass parameters to MPI subroutines.  When I switched your program to
> "use mpi", here's what the compiler showed me:
>
> 1. the name "MPI" is reserved
> 2. need to pass displacements(1:nstruct+1) to mpi_type_create_struct
> 3. need to pass request(1) to mpi_isend
> 4. need to pass request(1) to mpi_wait
> 5. need to pass ierr argument to mpi_wait
>
> 1-4 are technically not correct, but the program would likely (usually)
> compile/run "correctly" anyway.  5 is probably what caused your segv.
>
> Attached is my copy of your program with fixes for the above-mentioned
> issues.
>
> BTW, I missed the beginning of this thread -- I assume that this is an
> artificial use of mpi_type_create_resized for the purposes of a small
> example.  The specific use of it in this program appears to be superfluous.
>
>
>
>
>
> On Jan 8, 2015, at 4:26 AM, Gilles Gouaillardet <
> gilles.gouaillar...@iferc.org> wrote:
>
> > Diego,
> >
> > yes, it works for me (at least with the v1.8 head and gnu compilers)
> >
> > Cheers,
> >
> > Gilles
> >
> > On 2015/01/08 17:51, Diego Avesani wrote:
> >> Dear Gilles,
> >> thanks again, however it does not work.
> >>
> >> the program says:  "SIGSEGV, segmentation fault occurred"
> >>
> >> Does the program run in your case?
> >>
> >> Thanks again
> >>
> >>
> >>
> >> Diego
> >>
> >>
> >> On 8 January 2015 at 03:02, Gilles Gouaillardet <
> >>
> >> gilles.gouaillar...@iferc.org
> >> > wrote:
> >>
> >>
> >>>  Diego,
> >>>
> >>> my bad, i should have passed displacements(1) to MPI_Type_create_struct
> >>>
> >>> here is an updated version
> >>>
> >>> (note you have to use a REQUEST integer for MPI_Isend and MPI_Irecv,
> >>> and you also have to call MPI_Wait to ensure the requests complete)
> >>>
> >>> Cheers,
> >>>
> >>> Gilles
> >>>
> >>>
> >>> On 2015/01/08 8:23, Diego Avesani wrote:
> >>>
> >>> Dear Gilles, Dear all,
> >>>
> >>> I'm sorry to bother you again, but I have some problem with send and
> >>> receive the struct_data.
> >>>
> >>> I tried to send a MPI_Type_Create_Struct but I get a segmentation fault
> >>> occurred and I do not know why. The program is very simple, it is the
> old
> >>> one with the isend and irecv subroutines
> >>>
> >>> (you can find it in the attachment)
> >>>
> >>> Thanks again
> >>>
> >>>
> >>> Diego
> >>>
> >>>
> >>> On 5 January 2015 at 15:54, Diego Avesani
> >>> <diego.aves...@gmail.com> <diego.aves...@gmail.com>
> >>>  wrote:
> >>>
> >>>
> >>>  Dear Gilles,
> >>>
> >>> Thanks, Thanks a lot.
> >>> Now is more clear.
> >>>
> >>> Again, thanks a lot
> >>>
> >>> Diego
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> users mailing
> >>> listus...@open-mpi.org
> >>>
> >>> Subscription:
> >>> http://www.open-mpi.org/mailman/listinfo.cgi/users
> >>>
> >>> Link to this post:
> >>> http://www.open-mpi.org/community/lists/users/2015/01/26116.php
> >>>
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> users mailing list
> >>>
> >>> us...@open-mpi.org
> >>>
> >>> Subscription:
> >>> http://www.open-mpi.org/mailman/listinfo.cgi/users
> >>>
> >>> Link to this post:
> >>>
> >>> http://www.open-mpi.org/community/lists/users/2015/01/26118.php
> >>>
> >>>
> >>>
> >>
> >>
> >> _______________________________________________
> >> users mailing list
> >>
> >> us...@open-mpi.org
> >>
> >> Subscription:
> >> http://www.open-mpi.org/mailman/listinfo.cgi/users
> >>
> >> Link to this post:
> >> http://www.open-mpi.org/community/lists/users/2015/01/26124.php
> >
> > _______________________________________________
> > users mailing list
> > us...@open-mpi.org
> > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
> > Link to this post:
> http://www.open-mpi.org/community/lists/users/2015/01/26126.php
>
>
> --
> Jeff Squyres
> jsquy...@cisco.com
> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
>
>
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
> Link to this post:
> http://www.open-mpi.org/community/lists/users/2015/01/26127.php
>

Attachment: test_struct_test_isend.f90
Description: Binary data

Reply via email to