[mpich-discuss] MPI_Type_struct error

Rajeev Thakur thakur at mcs.anl.gov
Mon Mar 12 07:58:12 CDT 2012


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



More information about the mpich-discuss mailing list