<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT size=3><FONT face=Calibri>Dear all,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT size=3><FONT face=Calibri>I use a PC with following specification:<o:p></o:p></FONT></FONT></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT size=3><FONT face=Calibri>Windows 7 OS, 64 Bit, 4 GB of RAM, Intel® Core(TM)2Duo CPU 3.34 GHz<o:p></o:p></FONT></FONT></SPAN></DIV>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT size=3><FONT face=Calibri>I also tried to compiling and running the program of Prof. Zoltán Kovács on my PC. It worked without any problem with MPICH 1.3 and Intel MPI.<o:p></o:p></FONT></FONT></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT size=3 face=Calibri>In my small project, I defined Particle data type that contains 4 INTEGER4, 11 INTEGER11, 2 LOGICAL and 2 INTEGER4 array with size 6. To define an MPI data type for the particle data type, first I defined columntype type for INTEGER4 array with size 6. Then I structured particletype and committed it. I defined two array (</FONT></SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>p,particles</SPAN><SPAN style="mso-ansi-language: EN-US" lang=EN-US><FONT size=3 face=Calibri>) of type </FONT></SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>particletype and allocated them (<B><SPAN style="COLOR: blue">ALLOCATE</SPAN></B>(particles(0:NELEM));<B><SPAN style="COLOR:
 blue">ALLOCATE</SPAN></B>(p(0:1010))). I initialized particles array. For sending specific segments of particles array from server process (rank=0) to P array on Client processes, I defined indextype MPI data type. I want to get the array on client processes without gap and continuancely. In sending with</SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>&nbsp;<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><B><SPAN style="COLOR: blue">call</SPAN></B> MPI_SEND(particles, 1008, particletype, i, tag, MPI_COMM_WORLD, ierr)</SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US><o:p></o:p></SPAN>&nbsp;</DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>Client processes get first 521 elements truly and for the rest, get garbage. <o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>In following sending case:</SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US><o:p></o:p></SPAN>&nbsp;</DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><B><SPAN style="COLOR: blue">call</SPAN></B> MPI_SEND(particles, 1, indextype, i, tag, MPI_COMM_WORLD, ierr)<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US></SPAN>&nbsp;</DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>Client processes get first 412 elements truly and for the rest they get wrong numbers. <o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>I got above results for both Win32 and x64 projects. I also tried Intel MPI. But the results are the same. </DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: DE" lang=EN-US>Is&nbsp;problem from definition of MPI data type or its origin is huge array size?<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: DE" lang=EN-US>I examined buffer sending. <o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><B><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US><o:p>&nbsp;</o:p></SPAN></B></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><B><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>CALL</SPAN></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US> MPI_PACK_SIZE(1, particletype, MPI_COMM_WORLD, SS1, IERR)<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>bufsize = MPI_BSEND_OVERHEAD + (ss1)*1008<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><B><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>ALLOCATE</SPAN></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>(particles_buf(bufsize))<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><B><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>CALL</SPAN></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US> MPI_Buffer_attach( particles_buf, bufsize, IERR)<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><B><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>CALL</SPAN></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US> MPI_BSEND(particles,1008,particletype,i,TAG,MPI_COMM_WORLD,IERR)<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><B><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US>CALL</SPAN></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US> MPI_BUFFER_DETACH(particles_buf, bufsize, IERR)<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US" lang=EN-US><o:p>&nbsp;</o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: DE" lang=EN-US>But the result is the same.<o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: DE" lang=EN-US><o:p>&nbsp;</o:p></SPAN></DIV><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: DE" lang=EN-US><o:p><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>
<DIV>program</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> ping</DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>
<DIV>implicit none</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>include</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#800000 size=2 face=Consolas><FONT color=#800000 size=2 face=Consolas><FONT color=#800000 size=2 face=Consolas>'mpif.h'</DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: numtasks, rank, dest, source, tag, ierr</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: i</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: NELEM</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: stat(MPI_STATUS_SIZE)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>type</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> Particle</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IW1 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IP1 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IW2 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IP2 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IPWF </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IP </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IL10 </DIV>
<DIV></DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IMP4 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IMP5 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: LIB1 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: LIB2 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: LIB3 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IVOL </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: ITARG </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: ISEG </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: NFAU </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: NMAX </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(2)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: NTOT </DIV>
<DIV></DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>LOGICAL</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: nomix </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>LOGICAL</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: TRcorr </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: JZ(6)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>INTEGER(4)</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: IJ(6)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>end</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>type</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> Particle</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>type</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (Particle),</FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>DIMENSION</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>(:),</FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>POINTER</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> :: p, particles, particles_buf</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> particletype, oldtypes(0:3), blockcounts(0:3), offsets(0:3), extent</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> columntype,SIZE,id</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> NUMSEG,indextype,SS1,SS2,SS3,ss4,bufsize</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>integer</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>,</FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>allocatable</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>,</FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>dimension</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>(:) :: blocklengths,displacements</DIV>
<DIV>tag = 1</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_INIT(ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_COMM_SIZE(MPI_COMM_WORLD, numtasks, ierr)</DIV>
<DIV>NELEM=10000</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>ALLOCATE</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>(particles(0:NELEM))</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>ALLOCATE</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>(p(0:1010))</DIV></FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>
<DIV>! Setup description of the 4 MPI_REAL fields x, y, z, velocity </DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV>offsets(0) = 0</DIV>
<DIV>oldtypes(0) = MPI_INTEGER4</DIV>
<DIV>blockcounts(0) = 7</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_EXTENT(MPI_INTEGER4, extent, ierr)</DIV>
<DIV>offsets(1) = 7 * extent</DIV>
<DIV>oldtypes(1) = MPI_INTEGER2</DIV>
<DIV>blockcounts(1) = 11</DIV></FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>
<DIV>! Setup description of the 2 MPI_INTEGER fields n, type </DIV>
<DIV>! Need to first figure offset by getting size of MPI_REAL</DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_EXTENT(MPI_INTEGER2, extent, ierr)</DIV>
<DIV>offsets(2) = 11 * extent</DIV>
<DIV>oldtypes(2) = MPI_LOGICAL</DIV>
<DIV>blockcounts(2) = 2</DIV>
<DIV>SIZE=6</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_CONTIGUOUS(SIZE, MPI_INTEGER4, columntype, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_COMMIT(columntype, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_EXTENT(MPI_LOGICAL, extent, ierr)</DIV>
<DIV>offsets(3) = 2 * extent</DIV>
<DIV>oldtypes(3) = columntype</DIV>
<DIV>blockcounts(3) = 2</DIV></FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>
<DIV>! Now define structured type and commit it </DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_STRUCT(4, blockcounts, offsets, oldtypes, particletype, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_COMMIT(particletype, ierr)</DIV>
<DIV></DIV></FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>
<DIV>! Initialize the particle array and then send it to each task</DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV>tag = 1</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>if</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (rank .eq. 0) </FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>then</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>do</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> 10 i=0, NELEM-1</DIV>
<DIV>particles(i)%IW1=i+1</DIV>
<DIV>particles(i)%IP1=i+2</DIV>
<DIV>particles(i)%IW2=i+3</DIV>
<DIV>particles(i)%IP2=i+4</DIV>
<DIV>particles(i)%IPWF=i+5</DIV>
<DIV>particles(i)%IP=i+6</DIV>
<DIV>particles(i)%IL10=i+7</DIV>
<DIV>particles(i)%IMP4=i+8</DIV>
<DIV>particles(i)%IMP5=i+9</DIV>
<DIV>particles(i)%LIB1=i+10</DIV>
<DIV>particles(i)%LIB2=i+11</DIV>
<DIV>particles(i)%LIB3=i+12</DIV>
<DIV>particles(i)%IVOL=i+13</DIV>
<DIV>particles(i)%ITARG=i+14</DIV>
<DIV>particles(i)%ISEG=i+15</DIV>
<DIV>particles(i)%NFAU=i+16</DIV>
<DIV>particles(i)%NMAX=i+17</DIV>
<DIV>particles(i)%NTOT=i+18</DIV>
<DIV>particles(i)%nomix=.FALSE.</DIV>
<DIV>particles(i)%TRcorr=.FALSE.</DIV>
<DIV>particles(i)%JZ=i</DIV>
<DIV>particles(i)%IJ=i+1</DIV>
<DIV></FONT></FONT><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas>10</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>continue</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV>NUMSEG = 4 </DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>ALLOCATE</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>(blocklengths(NUMSEG), displacements(NUMSEG)) </DIV>
<DIV>blocklengths(1)=798; displacements(1)=0</DIV>
<DIV>blocklengths(2)=84; displacements(2)=7798</DIV>
<DIV>blocklengths(3)=114; displacements(3)=4800</DIV>
<DIV>blocklengths(4)=12; displacements(4)=8952</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>CALL</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_INDEXED(NUMSEG, blocklengths, displacements, particletype,indextype, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_COMMIT(indextype, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>do</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> 20 i=1, numtasks-1</DIV></FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>
<DIV>! call MPI_SEND(particles, 1, indextype, i, tag, MPI_COMM_WORLD, ierr)</DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_SEND(particles, 1008, particletype, i, tag, MPI_COMM_WORLD, ierr)</DIV></FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>
<DIV>!!CALL MPI_PACK_SIZE(7, MPI_INTEGER4, MPI_COMM_WORLD, SS1, IERR)</DIV>
<DIV>!!CALL MPI_PACK_SIZE(11, MPI_INTEGER2, MPI_COMM_WORLD, SS2, IERR)</DIV>
<DIV>!!CALL MPI_PACK_SIZE(2, MPI_LOGICAL, MPI_COMM_WORLD, SS3, IERR)</DIV>
<DIV>!!CALL MPI_PACK_SIZE(2, columntype, MPI_COMM_WORLD, SS4, IERR)</DIV>
<DIV>!!bufsize = MPI_BSEND_OVERHEAD + (ss1 + ss2 + ss3 + ss4)*1008</DIV>
<DIV>!</DIV>
<DIV>!CALL MPI_PACK_SIZE(1, particletype, MPI_COMM_WORLD, SS1, IERR)</DIV>
<DIV>!bufsize = MPI_BSEND_OVERHEAD + (ss1)*1008</DIV>
<DIV>!</DIV>
<DIV>!ALLOCATE(particles_buf(bufsize))</DIV>
<DIV>!CALL MPI_Buffer_attach( particles_buf, bufsize, IERR)</DIV>
<DIV>!CALL MPI_BSEND(particles,1008,particletype,i,TAG,MPI_COMM_WORLD,IERR)</DIV>
<DIV>!CALL MPI_BUFFER_DETACH(particles_buf, bufsize, IERR)</DIV></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas>20</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>continue</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>endif</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV>id=522</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>if</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (rank&gt;0) </FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>then</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV>source = 0</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_RECV(p, 1008, particletype, source, tag, MPI_COMM_WORLD, stat, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>print</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> *, </FONT></FONT><FONT color=#800000 size=2 face=Consolas><FONT color=#800000 size=2 face=Consolas><FONT color=#800000 size=2 face=Consolas>'rank= '</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>,rank,</FONT></FONT><FONT color=#800000 size=2 face=Consolas><FONT color=#800000 size=2 face=Consolas><FONT color=#800000 size=2 face=Consolas>' p='</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>,p(id)%nomix,p(id)%TRcorr,p(id)%IJ</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>end if</DIV></B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_TYPE_FREE(particletype, ierr)</DIV>
<DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>call</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> MPI_FINALIZE(ierr)</DIV></FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>
<DIV>end</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><B><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>program</B></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> ping</DIV></FONT></FONT></o:p></SPAN>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: DE" lang=EN-US><o:p></o:p></SPAN>&nbsp;</DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal></SPAN>--- On <B>Mon, 11/15/10, Jayesh Krishna <I>&lt;jayesh@mcs.anl.gov&gt;</I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From: Jayesh Krishna &lt;jayesh@mcs.anl.gov&gt;<BR>Subject: Re: [mpich-discuss] Sending structures made of MPI Datatypes<BR>To: mpich-discuss@mcs.anl.gov<BR>Date: Monday, November 15, 2010, 7:59 PM<BR><BR>
<DIV class=plainMail>Also you might want to add the sender proc id in your dbg stmt,<BR><BR>printf( "Proc %d: recieving %u.th portion from proc %d ....\n", rank, i );<BR><BR>TO<BR><BR>printf( "Proc %d: recieving %u.th portion from proc %d ....\n", rank, i, proc);<BR><BR>Regards,<BR>Jayesh<BR>----- Original Message -----<BR>From: Jayesh Krishna &lt;<A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=jayesh@mcs.anl.gov" ymailto="mailto:jayesh@mcs.anl.gov">jayesh@mcs.anl.gov</A>&gt;<BR>To: <A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov" ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR>Sent: Mon, 15 Nov 2010 10:10:07 -0600 (CST)<BR>Subject: Re: [mpich-discuss] Sending structures made of MPI Datatypes<BR><BR>Hi,<BR>And you can try using MPI_Gather() for getting the chunks from the different processes to rank=0 . Similarly you can use MPI_AllGather() if you want all the processes to receive the
 chunks (instead of just rank 0).<BR><BR>Regards,<BR>Jayesh<BR>----- Original Message -----<BR>From: Jayesh Krishna &lt;<A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=jayesh@mcs.anl.gov" ymailto="mailto:jayesh@mcs.anl.gov">jayesh@mcs.anl.gov</A>&gt;<BR>To: <A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov" ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR>Sent: Mon, 15 Nov 2010 10:03:35 -0600 (CST)<BR>Subject: Re: [mpich-discuss] Sending structures made of MPI Datatypes<BR><BR>Hi,<BR>What is the version of MPICH2 that you are using (From the error message it looks like you are using MPICH instead of MPICH2. Are you running your job on a heterogeneous cluster ?)? We recommend that you use the latest stable release of MPICH2 (<A href="http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads"
 target=_blank>http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads</A>). <BR>I tried compiling/running your job on a single node and it worked without any errors with MPICH2 1.3 .<BR><BR>Regards,<BR>Jayesh<BR>----- Original Message -----<BR>From: zkovacs &lt;<A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=zkovacs@hku.hk" ymailto="mailto:zkovacs@hku.hk">zkovacs@hku.hk</A>&gt;<BR>To: <A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov" ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR>Sent: Sun, 14 Nov 2010 21:51:45 -0600 (CST)<BR>Subject: [mpich-discuss] Sending structures made of MPI Datatypes<BR><BR>Dear all,<BR><BR>I defined a structure with the name "st1", created an MPI datatype for it and commited it in the function crt_dt(). I also defined another structure with the name "st2" containing 4 structures of the first type (st1). Its MPI data type is also defined
 and commited it in the function crt_dt(). After allocating an 1D data array of structures st2 with the size N x M, I initialized each structure member of all the structures in the array by calling loc_init(). Then I tried to send chunks of the array with the size of M from the process with ranks higher than 0 to the process 0. The offsets of the chunks for a process with the rank r were set to (r + i x n) x M &lt; N*(M-1) with i =1,2,... , where n is the total number of the processes. That would cover the whole array for different porcesses. However, when the processes send the very first chunks the error message 'p4_error: interrupt SIGSEGV: 11; is generated.<BR>I wonder if there is some bug in the code since the size of the chunks cannot so big. For M = 1500 it is about M*sizeof(st2) = 1500 x 140 bytes. I also tested it with N=10, and M=15 but it does not work.<BR>Has anybody worked with huge nested structure arrays before? Is there any efficient
 algorithm to redistribute the results stored in the families of chunks to all the processes? <BR><BR>Thanks a lot,<BR>Zoltán<BR><BR>The code is simple:<BR><BR>#include "mpi.h"<BR>#include &lt;stdio.h&gt;<BR>#include &lt;stdlib.h&gt;<BR>#define&nbsp; N 10<BR>#define&nbsp; M 15<BR><BR><BR>typedef struct st1 {<BR>&nbsp; double m0, m1, m2, m3;<BR>} st1;<BR><BR>typedef struct st2 {<BR>&nbsp; int m0;<BR>&nbsp; double m1;<BR>&nbsp; st1 m2, m3, m4, m5;<BR>} st2;<BR><BR>st2 * data; <BR><BR>MPI_Datatype st1_type, st2_type;<BR><BR>int crt_dt()<BR>{<BR>&nbsp; int i, base;<BR><BR>&nbsp; &nbsp; MPI_Datatype type1[4] = {MPI_DOUBLE,MPI_DOUBLE,MPI_DOUBLE,MPI_DOUBLE};<BR>&nbsp; &nbsp; MPI_Datatype type2[6]={MPI_INT,MPI_DOUBLE};<BR>&nbsp; &nbsp; int blk_len[6] = {1,1,1,1,1,1};<BR>&nbsp; &nbsp; MPI_Aint disp[6];<BR>&nbsp; &nbsp; st1 s1;<BR>&nbsp; &nbsp; st2 s2;<BR><BR>&nbsp; &nbsp; MPI_Address( &amp;s1.m0, disp );<BR>&nbsp; &nbsp; MPI_Address( &amp;s1.m1, disp+1
 );<BR>&nbsp; &nbsp; MPI_Address( &amp;s1.m2, disp+2 );<BR>&nbsp; &nbsp; MPI_Address( &amp;s1.m3, disp+3 );<BR>&nbsp; &nbsp; base = disp[0];<BR>&nbsp; &nbsp; for( i = 0; i &lt; 4; i++ )<BR>&nbsp; &nbsp; &nbsp; &nbsp; disp[i] -= base;<BR><BR>&nbsp; &nbsp; MPI_Type_struct( 4, blk_len, disp, type1, &amp;st1_type );<BR>&nbsp; &nbsp; MPI_Type_commit(&amp;st1_type);<BR><BR>&nbsp; &nbsp; type2[2] = st1_type;<BR>&nbsp; &nbsp; type2[3] = st1_type;<BR>&nbsp; &nbsp; type2[4] = st1_type;<BR>&nbsp; &nbsp; type2[5] = st1_type;<BR><BR>&nbsp; &nbsp; MPI_Address( &amp;s2.m0, disp );<BR>&nbsp; &nbsp; MPI_Address( &amp;s2.m1, disp+1 );<BR>&nbsp; &nbsp; MPI_Address( &amp;s2.m2, disp+2 );<BR>&nbsp; &nbsp; MPI_Address( &amp;s2.m3, disp+3 );<BR>&nbsp; &nbsp; MPI_Address( &amp;s2.m4, disp+4 );<BR>&nbsp; &nbsp; MPI_Address( &amp;s2.m5, disp+5 );<BR>&nbsp; &nbsp; base = disp[0];<BR>&nbsp; &nbsp; for( i = 0; i &lt; 6; i++ )<BR>&nbsp; &nbsp; &nbsp; &nbsp; disp[i] -=
 base;<BR><BR>&nbsp; &nbsp; MPI_Type_struct( 6, blk_len, disp, type2, &amp;st2_type );<BR>&nbsp; &nbsp; MPI_Type_commit(&amp;st2_type);<BR><BR>&nbsp; &nbsp; return 0;<BR>}<BR><BR><BR>int loc_init( int rank )<BR>{<BR>&nbsp; unsigned int i, j;<BR><BR>&nbsp;&nbsp;&nbsp;for( i = 0; i &lt; N; i ++ )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; for( j = 0; j &lt; M; j++ )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m0 = rank + i*M + j;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m1&nbsp;&nbsp;&nbsp;= (double)(rank + i*M + j); <BR><BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m2.m0 = (double)(rank + i*M + j);<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m2.m1 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m2.m2 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m2.m3 = 0;<BR><BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m3.m0 = (double)(rank + i*M + j);<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m3.m1 =
 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m3.m2 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m3.m3 = 0;<BR><BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m4.m0 = (double)(rank + i*M + j);<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m4.m1 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m4.m2 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m4.m3 = 0;<BR><BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m5.m0 = (double)(rank + i*M + j);<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m5.m1 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m5.m2 = 0;<BR>&nbsp;&nbsp;&nbsp; &nbsp; (data+i*M+j)-&gt;m5.m3 = 0;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; &nbsp; }<BR><BR>&nbsp; return 0;<BR>}<BR><BR><BR>int main (int argc, char *argv[])<BR>{<BR>&nbsp; int num_proc, rank, proc;<BR>&nbsp; unsigned int i, j;<BR>&nbsp; MPI_Status stat;<BR><BR>&nbsp; /*** Initializations ***/<BR>&nbsp; MPI_Init(&amp;argc, &amp;argv);<BR>&nbsp; MPI_Comm_size(MPI_COMM_WORLD,
 &amp;num_proc );<BR>&nbsp; MPI_Comm_rank(MPI_COMM_WORLD,&amp;rank);<BR>&nbsp; printf ("MPI proc %d has started...\n", rank);<BR><BR>&nbsp; /* local memory allocations for the data array */<BR>&nbsp; if( ( data = (st2 *)malloc(N*M*sizeof(st2)) ) == NULL )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; fprintf( stderr, "Proc %d: Not enough memory. Exit.\n", rank );<BR>&nbsp; &nbsp; &nbsp; exit(1);<BR>&nbsp; &nbsp; }<BR><BR>&nbsp; /* local initializiation of the data array&nbsp; */<BR>&nbsp; loc_init(rank);<BR><BR>&nbsp; /* create user defined data type&nbsp; */<BR>&nbsp; crt_dt();<BR><BR>&nbsp; MPI_Barrier(MPI_COMM_WORLD);<BR><BR><BR>&nbsp; /* data transfer */<BR>&nbsp; if( rank &gt; 0&nbsp; )&nbsp; /* Proc 0 does not send data */<BR>&nbsp; &nbsp; {<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* send each row in the portion */<BR>&nbsp; &nbsp; &nbsp; for( i = rank; i &lt; N; i += num_proc )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; &nbsp; printf( "Proc %d:
 sending %u.th portion to proc 0.\n", rank, i );<BR>&nbsp;&nbsp;&nbsp; &nbsp; /* tagged by the i&nbsp; */<BR>&nbsp;&nbsp;&nbsp; &nbsp; MPI_Send( &amp;data[i*M], M, st2_type, 0, i, MPI_COMM_WORLD );&nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp; &nbsp; }<BR>&nbsp; &nbsp; else&nbsp;&nbsp;&nbsp; /* Proc 0 recieves each portion */<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; for( proc = 1; proc &lt; num_proc; proc++ )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; &nbsp; for( i = proc; i &lt; N; i += num_proc )<BR>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; {<BR>&nbsp;&nbsp;&nbsp; &nbsp; printf( "Proc %d: recieving %u.th portion from proc %d ....\n",<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; rank, i );<BR><BR>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; /* tagged by the i */<BR>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; MPI_Recv( &amp;data[i*M], M, st2_type, proc, i, MPI_COMM_WORLD,<BR>&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;stat );&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <BR>&nbsp; &nbsp; }<BR><BR>/* MPI_Barrier(MPI_COMM_WORLD);*/<BR>MPI_Finalize();<BR>free(data);<BR><BR>}&nbsp; <BR><BR><BR><BR>_______________________________________________<BR>mpich-discuss mailing list<BR><A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov" ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR><A href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target=_blank>https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</A><BR><BR>_______________________________________________<BR>mpich-discuss mailing list<BR><A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov"
 ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR><A href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target=_blank>https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</A><BR><BR>_______________________________________________<BR>mpich-discuss mailing list<BR><A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov" ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR><A href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target=_blank>https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</A><BR><BR>_______________________________________________<BR>mpich-discuss mailing list<BR><A href="http://us.mc1617.mail.yahoo.com/mc/compose?to=mpich-discuss@mcs.anl.gov" ymailto="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</A><BR><A href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss"
 target=_blank>https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</A><BR></DIV></BLOCKQUOTE></td></tr></table><br>