<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>Dear Chan,</FONT></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>I use a PC with following specification:</FONT></SPAN><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>Windows 7 OS, 64 Bit, 4 GB of RAM, Intel® Core(TM)2Duo CPU 3.34 GHz</FONT></SPAN><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US> <o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>In my small project, I want to send and receive an array of data type. In the following, I have explained my small project. Source code also is attached. </FONT></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri></FONT></SPAN> </DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>I defined <B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal">Particle</I></B> data type that contains 4 INTEGER4, 11 INTEGER2, 2 LOGICAL and 2 INTEGER4 array with size 6. To define an MPI data type for the <B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal">particle </I></B>data type, first I defined <B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal">columntype</I></B> type for INTEGER4 array with size 6. Then I structured <B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal">particletype</I></B> and committed it. I defined two array
(<B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal">p</I></B></FONT></SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US>,</SPAN><FONT face=Calibri><B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal"><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US>particles</SPAN></I></B><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US>) of type <B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style:
normal">particletype</I></B></SPAN></FONT><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US> and allocated them: </SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><B><SPAN style="COLOR: blue">ALLOCATE</SPAN></B>(particles(0:NELEM));<B><SPAN style="COLOR: blue">ALLOCATE</SPAN></B>(p(0:1010)). <o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US>I initialized </SPAN><B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal"><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>particles</FONT></SPAN></I></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US> array. For sending specific segments of </SPAN><B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal"><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri;
mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>particles </FONT></SPAN></I></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US>array from server process (rank=0) to array </SPAN><B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal"><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>P</FONT></SPAN></I></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US> on Client
processes, I defined </SPAN><B style="mso-bidi-font-weight: normal"><I style="mso-bidi-font-style: normal"><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>indextype</FONT></SPAN></I></B><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US> MPI data type. I want to get the array on client processes without gap and continuancely.</SPAN><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><o:p></o:p></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>On the Client process last cell have not received truly. Even in sending one cell result are as following:<o:p></o:p></FONT></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>D:\Console1\Debug>mpiexec -n 2 Console1.exe<o:p></o:p></FONT></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri><SPAN style="mso-spacerun: yes"> </SPAN>rank=<SPAN style="mso-spacerun: yes"> </SPAN>1<SPAN style="mso-spacerun: yes"> </SPAN>p=<SPAN style="mso-spacerun: yes"> </SPAN>1<SPAN style="mso-spacerun: yes"> </SPAN>7<SPAN style="mso-spacerun: yes"> </SPAN>8<SPAN style="mso-spacerun: yes"> </SPAN>18 F T<SPAN style="mso-spacerun: yes"> </SPAN>-842150451</FONT></SPAN><SPAN style="FONT-SIZE: 12pt;
mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri><SPAN style="mso-spacerun: yes"> </SPAN>-842150451<SPAN style="mso-spacerun: yes"> </SPAN>-842150451<SPAN style="mso-spacerun: yes"> </SPAN>-842150451<SPAN style="mso-spacerun: yes"> </SPAN>-842150451<SPAN style="mso-spacerun: yes"> </SPAN>-842150451<o:p></o:p></FONT></SPAN></DIV>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: DE" lang=EN-US><FONT face=Calibri>Previously a similar question has been mention about sending structured data of structures. This discussion also is attached.<o:p></o:p></FONT></SPAN></DIV><BR>--- On <B>Thu, 4/7/11, Anthony Chan <I><chan@mcs.anl.gov></I></B> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From: Anthony Chan <chan@mcs.anl.gov><BR>Subject: Re: [mpich-discuss] Is MPI developed for Fortran as well as C?<BR>To: mpich-discuss@mcs.anl.gov<BR>Date: Thursday, April 7, 2011, 8:36 PM<BR><BR>
<DIV class=plainMail><BR><BR>----- Original Message -----<BR>> Dear all,<BR>> Is MPI developed for Fortran as well as C?<BR>> <BR><BR>MPI standard defines a Fortran binding which is provided by MPICH2.<BR>Do you have trouble in compiling/running the sample code or you have<BR>trouble install MPICH2.<BR><BR>A.Chan<BR><BR>> <BR>> <BR>> I work on a Fortran project and I want to do massage passing works<BR>> between nodes with MPI routines. I was able to send and receive simple<BR>> arrays but for sending and receiving an array of data type, it did not<BR>> work. In the attached files I have sent my previous Email that I had<BR>> sent to MPICH Discuss mailing list. In the Email I have reported<BR>> examination result of an example that I have gotten from Prof.<BR>> zkovacs. In that Email someone else, also have discussed. Prof.<BR>> zkovacs had wanted to send and receive an array of data type in C<BR>> programming
language. I want to do similar work in Fortran.<BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> Please give your opinion or in case that development of MPICH for<BR>> Fortran is not completed, introduce other implementation of MPI for<BR>> Fortran.<BR>> Another question. I want to write equivalent code of following C code<BR>> in Fortran. C code works truly but Fortran code does not. What is the<BR>> problem?<BR>> Attached files contain *.pdf file of previous Email and following<BR>> example. Also source code files are attached.<BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> #include "mpi.h"<BR>> #include <stdio.h><BR>> #include <stdlib.h><BR>> <BR>> int main (int argc, char *argv[])<BR>> {<BR>> int position, i, j, a[2], myrank, num_proc;<BR>> char buff[1000];<BR>> MPI_Status stat;<BR>> MPI_Init(&argc,
&argv);<BR>> MPI_Comm_size(MPI_COMM_WORLD, &num_proc );<BR>> MPI_Comm_rank(MPI_COMM_WORLD, &myrank);<BR>> if (myrank == 0)<BR>> {<BR>> /* SENDER CODE */<BR>> i = 1; j = 2; a[0] = 3;<BR>> printf( "Proc %d: sending %u %u %u.th portion to proc 0.\n", myrank,<BR>> i, j, a );<BR>> position = 0;<BR>> MPI_Pack(&i, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD);<BR>> MPI_Pack(&j, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD);<BR>> MPI_Send( buff, position, MPI_PACKED, 1, 0, MPI_COMM_WORLD);<BR>> }<BR>> else /* RECEIVER CODE */<BR>> {<BR>> MPI_Recv( a, 2, MPI_INT, 0, 0, MPI_COMM_WORLD,&stat);<BR>> printf( "Proc %d: reciving %u %u %u.th portion to proc 0.\n", myrank,<BR>> i, j, a[0] );<BR>> }<BR>> MPI_Finalize();<BR>> return 0;<BR>> }<BR>> <BR>> <BR>> <BR>> program main<BR>> implicit none<BR>> include 'mpif.h'<BR>> integer a(0:1)<BR>>
integer position, i, j, a(0:1), rank, numtasks;<BR>> character buff(0:1000);<BR>> integer stat(MPI_STATUS_SIZE)<BR>> call MPI_INIT(ierr)<BR>> call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)<BR>> call MPI_COMM_SIZE(MPI_COMM_WORLD, numtasks, ierr)<BR>> if (rank == 0) then<BR>> !/* SENDER CODE */<BR>> position = 0;<BR>> i=1;j=2;<BR>> CALL MPI_Pack(i, 1, MPI_INTEGER, buff, 1000, position, MPI_COMM_WORLD,<BR>> ierr);<BR>> CALL MPI_Pack(j, 1, MPI_INTEGER, buff, 1000, position, MPI_COMM_WORLD,<BR>> ierr);<BR>> CALL MPI_Send( buff, position, MPI_PACKED, 1, 0, MPI_COMM_WORLD,<BR>> ierr);<BR>> else !/* RECEIVER CODE */<BR>> CALL MPI_Recv( a, 2, MPI_INTEGER, 0, 0, MPI_COMM_WORLD, ierr);<BR>> position = 0;<BR>> CALL MPI_Unpack(a, 2, position, i, 1, MPI_INTEGER, MPI_COMM_WORLD,<BR>> ierr);<BR>> CALL MPI_Unpack(a, 2, position, j, 1, MPI_INTEGER, MPI_COMM_WORLD,<BR>> ierr);<BR>> Write(*,*) 'i , j = '
, i,j<BR>> END IF<BR>> call MPI_FINALIZE(ierr)<BR>> end program main<BR>> <BR>> <BR>> <BR>> Best Regards,<BR>> --<BR>> Hossein Beyrami<BR>> <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>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>