<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Sufeng,</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">The correct way is to use the MPI_Init_thread function with MPI_THREAD_MULTIPLE. This will tell the MPI implementation to be thread safe. It supports OpenMP and Posix Threads (OpenMP primitives in most systems are likely to be implemented on top of PThreads).</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Antonio</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Sunday, June 23, 2013 11:13:31 AM Sufeng Niu wrote:<br /></p>
<p style=" margin-top:12px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Hi, <span style=" font-family:'arial,sans-serif'; font-size:13px;">Antonio</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">Thanks a lot for your reply, I just figure out that is the firewall issue. after I set the firewall. it works now. Thanks again.</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">But I still got a few questions on MPI and multithreads mixed programming. Currently, I try to run each process on each server, and each process using thread pool to run multiple threads (pthread lib). I am not sure whether it is the correct way or not. I wrote it as:</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">MPI_Init()</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">....</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">...</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">/* create thread pool and initial */</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">......</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">/* fetch job into thread pool */</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;">......</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">MPI_Finalize();</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">When I check the book and notes, I found people use</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">MPI_Init_thread() with <span style=" font-family:'Times New Roman'; font-size:medium; color:#000000;">MPI_THREAD_MULTIPLE</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">but the some docs said it supported OpenMP, is that possible to use it with pthread library?</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I am new guy to this hybrid programming. I am not sure which is the proper way to do it. Any suggestions are appreciate. Thank you!</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Sufeng</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'arial,sans-serif'; font-size:13px;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Sat, Jun 22, 2013 at 12:12 PM, <<a href="mailto:discuss-request@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss-request@mpich.org</span></a>> wrote:<br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:46px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Send discuss mailing list submissions to<br />        <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br /><br />To subscribe or unsubscribe via the World Wide Web, visit<br />        <a href="https://lists.mpich.org/mailman/listinfo/discuss"><span style=" text-decoration: underline; color:#0057ae;">https://lists.mpich.org/mailman/listinfo/discuss</span></a><br />or, via email, send a message with subject or body 'help' to<br />        <a href="mailto:discuss-request@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss-request@mpich.org</span></a><br /><br />You can reach the person managing the list at<br />        <a href="mailto:discuss-owner@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss-owner@mpich.org</span></a><br /><br />When replying, please edit your Subject line so it is more specific<br />than "Re: Contents of discuss digest..."<br /><br /><br />Today's Topics:<br /><br />   1.  run hello world on multiple server (Sufeng Niu)<br />   2. Re:  run hello world on multiple server (Antonio J. Pe?a)<br />   3.  Problem reproducing an example from the MPI standard (Jiri Simsa)<br />   4. Re:  Problem reproducing an example from the MPI  standard<br />      (Pavan Balaji)<br />   5. Re:  Problem reproducing an example from the MPI  standard<br />      (Jiri Simsa)<br /><br /><br />----------------------------------------------------------------------<br /><br />Message: 1<br />Date: Fri, 21 Jun 2013 10:51:50 -0500<br />From: Sufeng Niu <<a href="mailto:sniu@hawk.iit.edu"><span style=" text-decoration: underline; color:#0057ae;">sniu@hawk.iit.edu</span></a>><br />To: <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br />Subject: [mpich-discuss] run hello world on multiple server<br />Message-ID:<br />        <<a href="mailto:CAFNNHkwpqdGfZXctL0Uz3hpeL25mZZMtB93qGXjc_%2BtjnV4csA@mail.gmail.com"><span style=" text-decoration: underline; color:#0057ae;">CAFNNHkwpqdGfZXctL0Uz3hpeL25mZZMtB93qGXjc_+tjnV4csA@mail.gmail.com</span></a>><br />Content-Type: text/plain; charset="iso-8859-1"<br /><br />Hi,<br /><br />Sorry to bother you guys on this stupid question. last time I re-install OS<br />for all blades to keep them the same version. after I mount, set keyless<br />ssh, the terimnal gives the error below:<br /><br />[<a href="mailto:proxy%3A0%3A1@iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">proxy:0:1@iocfccd3.aps.anl.gov</span></a>] HYDU_sock_connect<br />(./utils/sock/sock.c:174): unable to connect from "<a href="http://iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd3.aps.anl.gov</span></a>" to<br />"<a href="http://iocfccd1.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd1.aps.anl.gov</span></a>" (No route to host)<br />[<a href="mailto:proxy%3A0%3A1@iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">proxy:0:1@iocfccd3.aps.anl.gov</span></a>] main (./pm/pmiserv/pmip.c:189): unable to<br />connect to server <a href="http://iocfccd1.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd1.aps.anl.gov</span></a> at port 38242 (check for firewalls!)<br /><br />I can ssh from iocfccd1 to iocfccd3 without password. Should I shut down<br />all firewalls on each server? I cannot find out where is the problem. Thank<br />you<br /><br />--<br />Best Regards,<br />Sufeng Niu<br />ECASP lab, ECE department, Illinois Institute of Technology<br />Tel: <a href="tel:312-731-7219"><span style=" text-decoration: underline; color:#0057ae;">312-731-7219</span></a><br />-------------- next part --------------<br />An HTML attachment was scrubbed...<br />URL: <<a href="http://lists.mpich.org/pipermail/discuss/attachments/20130621/5503b1bc/attachment-0001.html"><span style=" text-decoration: underline; color:#0057ae;">http://lists.mpich.org/pipermail/discuss/attachments/20130621/5503b1bc/attachment-0001.html</span></a>><br /><br />------------------------------<br /><br />Message: 2<br />Date: Fri, 21 Jun 2013 10:58:26 -0500<br />From: Antonio J. Pe?a <<a href="mailto:apenya@mcs.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">apenya@mcs.anl.gov</span></a>><br />To: <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br />Subject: Re: [mpich-discuss] run hello world on multiple server<br />Message-ID: <1764654.VsHJIGvujv@localhost.localdomain><br />Content-Type: text/plain; charset="iso-8859-1"<br /><br /><br />Hi Sufeng,<br /><br />Can you ping/ssh exactly this name "<a href="http://iocfccd1.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd1.aps.anl.gov</span></a>" from iocfccd3?<br />[1]<br /><br />Antonio<br /><br /><br />On Friday, June 21, 2013 10:51:50 AM Sufeng Niu wrote:<br /><br /><br />Hi,<br /><br /><br />Sorry to bother you guys on this stupid question. last time I re-install OS for<br />all blades to keep them the same version. after I mount, set keyless ssh,<br />the terimnal gives the error below:<br /><br /><a href="mailto:proxy%3A0%3A1@iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">proxy:0:1@iocfccd3.aps.anl.gov</span></a>[2]] HYDU_sock_connect<br />(./utils/sock/sock.c:174): unable to connect from "<a href="http://iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd3.aps.anl.gov</span></a>[3]"<br />to "<a href="http://iocfccd1.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd1.aps.anl.gov</span></a>[1]" (No route to host)<br />[<a href="mailto:proxy%3A0%3A1@iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">proxy:0:1@iocfccd3.aps.anl.gov</span></a>[2]] main (./pm/pmiserv/pmip.c:189):<br />unable to connect to server <a href="http://iocfccd1.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">iocfccd1.aps.anl.gov</span></a>[1] at port 38242 (check<br />for firewalls!)<br /><br /><br /><br />I can ssh from iocfccd1 to iocfccd3 without password. Should I shut down<br />all firewalls on each server? I cannot find out where is the problem. Thank<br />you<br /><br /><br /><br /><br />-- Best Regards,<br />Sufeng Niu<br />ECASP lab, ECE department, Illinois Institute of Technology<br />Tel: 312-731-7219[4]<br /><br /><br />--------<br />[1] <a href="http://iocfccd1.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">http://iocfccd1.aps.anl.gov</span></a><br />[2] mailto:<a href="mailto:proxy%253A0%253A1@iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">proxy%3A0%3A1@iocfccd3.aps.anl.gov</span></a><br />[3] <a href="http://iocfccd3.aps.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">http://iocfccd3.aps.anl.gov</span></a><br />[4] tel:<a href="tel:312-731-7219"><span style=" text-decoration: underline; color:#0057ae;">312-731-7219</span></a><br />-------------- next part --------------<br />An HTML attachment was scrubbed...<br />URL: <<a href="http://lists.mpich.org/pipermail/discuss/attachments/20130621/01b37902/attachment-0001.html"><span style=" text-decoration: underline; color:#0057ae;">http://lists.mpich.org/pipermail/discuss/attachments/20130621/01b37902/attachment-0001.html</span></a>><br /><br />------------------------------<br /><br />Message: 3<br />Date: Sat, 22 Jun 2013 12:49:10 -0400<br />From: Jiri Simsa <<a href="mailto:jsimsa@cs.cmu.edu"><span style=" text-decoration: underline; color:#0057ae;">jsimsa@cs.cmu.edu</span></a>><br />To: <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br />Subject: [mpich-discuss] Problem reproducing an example from the MPI<br />        standard<br />Message-ID:<br />        <<a href="mailto:CAHs9ut-_6W6SOHTJ_rD%2BshQ76bo4cTCuFVAy1f9x-J0gioakHg@mail.gmail.com"><span style=" text-decoration: underline; color:#0057ae;">CAHs9ut-_6W6SOHTJ_rD+shQ76bo4cTCuFVAy1f9x-J0gioakHg@mail.gmail.com</span></a>><br />Content-Type: text/plain; charset="iso-8859-1"<br /><br />Hi,<br /><br />I tried implementing the Example 3.17 from the MPI 3.0 specification<br />document using as follows:<br /><br />#include <assert.h><br />#include <mpi.h><br />#include <stdio.h><br /><br />int main(int argc, char *argv[]) {<br />  int myrank, size;<br />  MPI_Status status;<br />  MPI_Init(&argc, &argv );<br />  MPI_Comm_rank(MPI_COMM_WORLD, &myrank);<br />  MPI_Comm_size(MPI_COMM_WORLD, &size);<br />  assert(size == 3);<br />  if (myrank == 0) {<br />    /* code for process zero */<br />    int i = 1;<br />    MPI_Send(&i, 1, MPI_INTEGER, 2, 99, MPI_COMM_WORLD);<br />  }<br />  if (myrank == 1) {<br />    /* code for process one */<br />    double d = 3.14;<br />    MPI_Send(&d, 1, MPI_REAL, 2, 99, MPI_COMM_WORLD);<br />  }<br />  if (myrank == 2) {<br />    /* code for process two */<br />    for (int i = 0; i < 2; i++) {<br />      MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);<br />      printf("Probe matched %lld bytes from source %d.\n",<br />             status.count, status.MPI_SOURCE);<br />      if (status.MPI_SOURCE == 0) {<br />int i;<br />MPI_Recv(&i, 1, MPI_INTEGER, 0, 99, MPI_COMM_WORLD, &status);<br />printf("Received integer '%d' from %d.\n", i, status.MPI_SOURCE);<br />      } else {<br />double d;<br />MPI_Recv(&d, 1, MPI_REAL, 1, 99, MPI_COMM_WORLD, &status);<br />printf("Received real '%f' from %d.\n", d, status.MPI_SOURCE);<br />      }<br />    }<br />  }<br />  MPI_Finalize();<br />  return 0;<br />}<br /><br />This example compiles without any warning with the MPICH-3.0.4 library.<br />However, running:<br /><br />$ mpiexec -n 3 ./example<br /><br />leads to the following output:<br /><br />Probe matched 4 bytes from source 1.<br />Received real '0.000000' from 1.<br />Probe matched 4 bytes from source 0.<br />Received integer '1' from 0.<br /><br />Could someone please let me know what is the problem with my program? I<br />failed to see a problem there. Thank you.<br /><br />Best,<br /><br />--Jiri Simsa<br />-------------- next part --------------<br />An HTML attachment was scrubbed...<br />URL: <<a href="http://lists.mpich.org/pipermail/discuss/attachments/20130622/70ca8d04/attachment-0001.html"><span style=" text-decoration: underline; color:#0057ae;">http://lists.mpich.org/pipermail/discuss/attachments/20130622/70ca8d04/attachment-0001.html</span></a>><br /><br />------------------------------<br /><br />Message: 4<br />Date: Sat, 22 Jun 2013 12:02:19 -0500<br />From: Pavan Balaji <<a href="mailto:balaji@mcs.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">balaji@mcs.anl.gov</span></a>><br />To: <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br />Subject: Re: [mpich-discuss] Problem reproducing an example from the<br />        MPI     standard<br />Message-ID: <<a href="mailto:51C5D89B.7010108@mcs.anl.gov"><span style=" text-decoration: underline; color:#0057ae;">51C5D89B.7010108@mcs.anl.gov</span></a>><br />Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br /><br /><br />The example is correct, since it's in Fortran.  Your conversion to C is<br />incorrect.  You probably want to use MPI_DOUBLE instead of MPI_REAL, and<br />MPI_INT instead of MPI_INTEGER.<br /><br />  -- Pavan<br /><br />On 06/22/2013 11:49 AM, Jiri Simsa wrote:<br />> Hi,<br />><br />> I tried implementing the Example 3.17 from the MPI 3.0 specification<br />> document using as follows:<br />><br />> #include <assert.h><br />> #include <mpi.h><br />> #include <stdio.h><br />><br />> int main(int argc, char *argv[]) {<br />>    int myrank, size;<br />>    MPI_Status status;<br />>    MPI_Init(&argc, &argv );<br />>    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);<br />>    MPI_Comm_size(MPI_COMM_WORLD, &size);<br />>    assert(size == 3);<br />>    if (myrank == 0) {<br />>      /* code for process zero */<br />>      int i = 1;<br />>      MPI_Send(&i, 1, MPI_INTEGER, 2, 99, MPI_COMM_WORLD);<br />>    }<br />>    if (myrank == 1) {<br />>      /* code for process one */<br />>      double d = 3.14;<br />>      MPI_Send(&d, 1, MPI_REAL, 2, 99, MPI_COMM_WORLD);<br />>    }<br />>    if (myrank == 2) {<br />>      /* code for process two */<br />>      for (int i = 0; i < 2; i++) {<br />>        MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);<br />>        printf("Probe matched %lld bytes from source %d.\n",<br />>               status.count, status.MPI_SOURCE);<br />>        if (status.MPI_SOURCE == 0) {<br />> int i;<br />> MPI_Recv(&i, 1, MPI_INTEGER, 0, 99, MPI_COMM_WORLD, &status);<br />> printf("Received integer '%d' from %d.\n", i, status.MPI_SOURCE);<br />>        } else {<br />> double d;<br />> MPI_Recv(&d, 1, MPI_REAL, 1, 99, MPI_COMM_WORLD, &status);<br />> printf("Received real '%f' from %d.\n", d, status.MPI_SOURCE);<br />>        }<br />>      }<br />>    }<br />>    MPI_Finalize();<br />>    return 0;<br />> }<br />><br />> This example compiles without any warning with the MPICH-3.0.4 library.<br />> However, running:<br />><br />> $ mpiexec -n 3 ./example<br />><br />> leads to the following output:<br />><br />> Probe matched 4 bytes from source 1.<br />> Received real '0.000000' from 1.<br />> Probe matched 4 bytes from source 0.<br />> Received integer '1' from 0.<br />><br />> Could someone please let me know what is the problem with my program? I<br />> failed to see a problem there. Thank you.<br />><br />> Best,<br />><br />> --Jiri Simsa<br />><br />><br />> _______________________________________________<br />> discuss mailing list     <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br />> To manage subscription options or unsubscribe:<br />> <a href="https://lists.mpich.org/mailman/listinfo/discuss"><span style=" text-decoration: underline; color:#0057ae;">https://lists.mpich.org/mailman/listinfo/discuss</span></a><br />><br /><br />--<br />Pavan Balaji<br /><a href="http://www.mcs.anl.gov/~balaji"><span style=" text-decoration: underline; color:#0057ae;">http://www.mcs.anl.gov/~balaji</span></a><br /><br /><br />------------------------------<br /><br />Message: 5<br />Date: Sat, 22 Jun 2013 13:12:06 -0400<br />From: Jiri Simsa <<a href="mailto:jsimsa@cs.cmu.edu"><span style=" text-decoration: underline; color:#0057ae;">jsimsa@cs.cmu.edu</span></a>><br />To: <a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br />Subject: Re: [mpich-discuss] Problem reproducing an example from the<br />        MPI     standard<br />Message-ID:<br />        <<a href="mailto:CAHs9ut_0_masn6v2%2B8FKZ8Y1Z_cdoteCespHNpSORc9iqFOcoA@mail.gmail.com"><span style=" text-decoration: underline; color:#0057ae;">CAHs9ut_0_masn6v2+8FKZ8Y1Z_cdoteCespHNpSORc9iqFOcoA@mail.gmail.com</span></a>><br />Content-Type: text/plain; charset="iso-8859-1"<br /><br />Nevermind.<br /><br />I was incorrectly using the MPI_REAL data type. After replacing it with the<br />MPI_DOUBLE data type the program was as expected.<br /><br /><br />On Sat, Jun 22, 2013 at 12:49 PM, Jiri Simsa <<a href="mailto:jsimsa@cs.cmu.edu"><span style=" text-decoration: underline; color:#0057ae;">jsimsa@cs.cmu.edu</span></a>> wrote:<br /><br />> Hi,<br />><br />> I tried implementing the Example 3.17 from the MPI 3.0 specification<br />> document using as follows:<br />><br />> #include <assert.h><br />> #include <mpi.h><br />> #include <stdio.h><br />><br />> int main(int argc, char *argv[]) {<br />>   int myrank, size;<br />>   MPI_Status status;<br />>   MPI_Init(&argc, &argv );<br />>   MPI_Comm_rank(MPI_COMM_WORLD, &myrank);<br />>   MPI_Comm_size(MPI_COMM_WORLD, &size);<br />>   assert(size == 3);<br />>   if (myrank == 0) {<br />>     /* code for process zero */<br />>     int i = 1;<br />>     MPI_Send(&i, 1, MPI_INTEGER, 2, 99, MPI_COMM_WORLD);<br />>   }<br />>   if (myrank == 1) {<br />>     /* code for process one */<br />>     double d = 3.14;<br />>     MPI_Send(&d, 1, MPI_REAL, 2, 99, MPI_COMM_WORLD);<br />>   }<br />>   if (myrank == 2) {<br />>     /* code for process two */<br />>     for (int i = 0; i < 2; i++) {<br />>       MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);<br />>       printf("Probe matched %lld bytes from source %d.\n",<br />>              status.count, status.MPI_SOURCE);<br />>       if (status.MPI_SOURCE == 0) {<br />> int i;<br />>  MPI_Recv(&i, 1, MPI_INTEGER, 0, 99, MPI_COMM_WORLD, &status);<br />> printf("Received integer '%d' from %d.\n", i, status.MPI_SOURCE);<br />>       } else {<br />> double d;<br />> MPI_Recv(&d, 1, MPI_REAL, 1, 99, MPI_COMM_WORLD, &status);<br />>  printf("Received real '%f' from %d.\n", d, status.MPI_SOURCE);<br />>       }<br />>     }<br />>   }<br />>   MPI_Finalize();<br />>   return 0;<br />> }<br />><br />> This example compiles without any warning with the MPICH-3.0.4 library.<br />> However, running:<br />><br />> $ mpiexec -n 3 ./example<br />><br />> leads to the following output:<br />><br />> Probe matched 4 bytes from source 1.<br />> Received real '0.000000' from 1.<br />> Probe matched 4 bytes from source 0.<br />> Received integer '1' from 0.<br />><br />> Could someone please let me know what is the problem with my program? I<br />> failed to see a problem there. Thank you.<br />><br />> Best,<br />><br />> --Jiri Simsa<br />><br />-------------- next part --------------<br />An HTML attachment was scrubbed...<br />URL: <<a href="http://lists.mpich.org/pipermail/discuss/attachments/20130622/4b69c2f8/attachment.html"><span style=" text-decoration: underline; color:#0057ae;">http://lists.mpich.org/pipermail/discuss/attachments/20130622/4b69c2f8/attachment.html</span></a>><br /><br />------------------------------<br /><br />_______________________________________________<br />discuss mailing list<br /><a href="mailto:discuss@mpich.org"><span style=" text-decoration: underline; color:#0057ae;">discuss@mpich.org</span></a><br /><a href="https://lists.mpich.org/mailman/listinfo/discuss"><span style=" text-decoration: underline; color:#0057ae;">https://lists.mpich.org/mailman/listinfo/discuss</span></a><br /><br />End of discuss Digest, Vol 8, Issue 37<br />**************************************<br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-- <br />Best Regards,</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Sufeng Niu</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">ECASP lab, ECE department, Illinois Institute of Technology</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Tel: 312-731-7219</p></body></html>