<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
It works now, <span id="ecxresult_box" class="ecx" lang="en"> <span class="ecxhps">but as</span> <span class="ecxhps">you said</span> <span class="ecxhps">it</span> <span class="ecxhps">would be more suitable</span> if I <span class="ecxhps">transform</span> <span class="ecxhps">the linked list</span> <span class="ecxhps">into an array to do the send-recv.<br>Thanks a lot<br></span></span><br><br><div><div id="ecxSkyDrivePlaceholder"></div>> From: thakur@mcs.anl.gov<br>> Date: Mon, 12 Mar 2012 07:58:12 -0500<br>> To: mpich-discuss@mcs.anl.gov<br>> Subject: Re: [mpich-discuss] MPI_Type_struct error<br>> <br>> 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.<br>> <br>> On Mar 12, 2012, at 2:40 AM, Ichrak Mehrez wrote:<br>> <br>> > Hi,<br>> > <br>> > I have a problem with creating a new MPI datatype,<br>> > my old_type is a linked list:<br>> > <br>> > struct ListeElt<br>> > {<br>> > long indice;<br>> > long val;<br>> > struct ListeElt *suiv;<br>> > };<br>> > typedef struct ListeElt LISTE_Elt:<br>> > <br>> > I try to create a new datatype MPI_Liste:<br>> > <br>> > MPI_Datatype MPI_Liste;<br>> > MPI_Datatype type[3] = {MPI_LONG,MPI_LONG,MPI_Liste};<br>> > <br>> > int longueur_bloc[3]={1,1,1};<br>> > MPI_Aint disp[3];<br>> > <br>> > LISTE_Elt L;<br>> > MPI_Address(&L.indice, disp); <br>> > MPI_Address(&L.val, disp+1); <br>> > MPI_Address(&L.suiv, disp+2); <br>> > <br>> > int base = disp[0]; <br>> > for (j=0; j <3; j++) disp[j] -= base;<br>> > MPI_Type_struct(3, longueur_bloc,disp, type,&MPI_Liste);<br>> > MPI_Type_commit(&MPI_Liste);<br>> > <br>> > but i got the following error:<br>> > <br>> > Fatal error in PMPI_Type_struct: Invalid datatype, error stack:<br>> > PMPI_Type_struct(210): MPI_Type_struct(count=3, blocklens=0x7fff830c6db0, indices=0x7fff830c6d40, old_types=0x7fff830c6da0, new_type_p=0x7fff830c6e40) failed<br>> > PMPI_Type_struct(177): Invalid datatype<br>> > <br>> > Thank you for any help.<br>> > <br>> > <br>> > <br>> > _______________________________________________<br>> > mpich-discuss mailing list mpich-discuss@mcs.anl.gov<br>> > To manage subscription options or unsubscribe:<br>> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss<br>> <br>> _______________________________________________<br>> mpich-discuss mailing list mpich-discuss@mcs.anl.gov<br>> To manage subscription options or unsubscribe:<br>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss<br></div>                                            </div></body>
</html>