<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5730.11" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=661262621-14112006><FONT face=Arial
color=#0000ff size=2>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661262621-14112006><FONT face=Arial
color=#0000ff size=2> In MPICH2, stdin (standard input) is redirected to
the root process (only). So if getchar() is executed by processes with
rank > 0, they never receive the input character entered by the user and
indefinitely wait for input.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661262621-14112006><FONT face=Arial
color=#0000ff size=2> Your present solution (with a check for rank and a
MPI_Barrier) is a more portable solution (since MPI standard does not define how
stdin has to be handled by an implementation)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661262621-14112006><FONT face=Arial
color=#0000ff size=2> For fewer processes you could use Visual Studio to
debug your program as mentioned in the MPICH2 Windows developer's guide
(available at <A
href="http://www-unix.mcs.anl.gov/mpi/mpich/">http://www-unix.mcs.anl.gov/mpi/mpich/</A>).</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=661262621-14112006><FONT face=Arial color=#0000ff
size=2>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=661262621-14112006><FONT face=Arial color=#0000ff
size=2>Jayesh</FONT></SPAN></DIV><!-- Converted from text/plain format -->
<P><FONT size=2>----------------------------------<BR> Jayesh
Krishna<BR> Argonne National Laboratory<BR> Mathematics and Computer
Science<BR> Email:
jayesh@mcs.anl.gov<BR>----------------------------------</FONT> </P>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> owner-mpich-discuss@mcs.anl.gov
[mailto:owner-mpich-discuss@mcs.anl.gov] <B>On Behalf Of
</B>devteam<BR><B>Sent:</B> Tuesday, November 14, 2006 10:52 AM<BR><B>To:</B>
mpich-discuss@mcs.anl.gov<BR><B>Subject:</B> [MPICH]
getchar<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Hi all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>When using mpich1 with mpirun I used to put some
getchar() in my code for debug purpose.</FONT></DIV>
<DIV><FONT face=Arial size=2>Then during computation I had to hit "enter" Nproc
times.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I wonder why when using mpiexec (I use mpich2
1.0.4), if I do the same my code freeze and I can't go on.</FONT></DIV>
<DIV><FONT face=Arial size=2>To obtain the same behaviour I write now:
</FONT></DIV>
<DIV><FONT face=Arial size=2>If (mytid ==0)
getchar();MPI_Barrier(MPI_COMM_WORLD);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Etienne Perchat</FONT></DIV></BODY></HTML>