[mpich-discuss] MPI_Type_struct error
Sunshine Sunshine
sunshine1414 at hotmail.fr
Mon Mar 12 08:30:36 CDT 2012
It works now, but as you said it would be more suitable if I transform the linked list into an array to do the send-recv.
Thanks a lot
> From: thakur at mcs.anl.gov
> Date: Mon, 12 Mar 2012 07:58:12 -0500
> To: mpich-discuss at mcs.anl.gov
> Subject: Re: [mpich-discuss] MPI_Type_struct error
>
> You need to use MPI_AINT as the 3rd type in type[3] instead of MPI_Liste, although I am not sure you want to communicate the address to the other side if you are doing send-recv.
>
> On Mar 12, 2012, at 2:40 AM, Ichrak Mehrez wrote:
>
> > Hi,
> >
> > I have a problem with creating a new MPI datatype,
> > my old_type is a linked list:
> >
> > struct ListeElt
> > {
> > long indice;
> > long val;
> > struct ListeElt *suiv;
> > };
> > typedef struct ListeElt LISTE_Elt:
> >
> > I try to create a new datatype MPI_Liste:
> >
> > MPI_Datatype MPI_Liste;
> > MPI_Datatype type[3] = {MPI_LONG,MPI_LONG,MPI_Liste};
> >
> > int longueur_bloc[3]={1,1,1};
> > MPI_Aint disp[3];
> >
> > LISTE_Elt L;
> > MPI_Address(&L.indice, disp);
> > MPI_Address(&L.val, disp+1);
> > MPI_Address(&L.suiv, disp+2);
> >
> > int base = disp[0];
> > for (j=0; j <3; j++) disp[j] -= base;
> > MPI_Type_struct(3, longueur_bloc,disp, type,&MPI_Liste);
> > MPI_Type_commit(&MPI_Liste);
> >
> > but i got the following error:
> >
> > Fatal error in PMPI_Type_struct: Invalid datatype, error stack:
> > PMPI_Type_struct(210): MPI_Type_struct(count=3, blocklens=0x7fff830c6db0, indices=0x7fff830c6d40, old_types=0x7fff830c6da0, new_type_p=0x7fff830c6e40) failed
> > PMPI_Type_struct(177): Invalid datatype
> >
> > Thank you for any help.
> >
> >
> >
> > _______________________________________________
> > mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> > To manage subscription options or unsubscribe:
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
> _______________________________________________
> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20120312/5eef25f3/attachment.htm>
More information about the mpich-discuss
mailing list