[MPICH] getchar - implementation dependent

Jayesh Krishna jayesh at mcs.anl.gov
Tue Nov 14 15:41:42 CST 2006


Hi,
 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.
 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)
 For fewer processes you could use Visual Studio to debug your program as
mentioned in the MPICH2 Windows developer's guide (available at
http://www-unix.mcs.anl.gov/mpi/mpich/).
 
Regards,
Jayesh

----------------------------------
 Jayesh Krishna
 Argonne National Laboratory
 Mathematics and Computer Science
 Email: jayesh at mcs.anl.gov
---------------------------------- 

 

  _____  

From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of devteam
Sent: Tuesday, November 14, 2006 10:52 AM
To: mpich-discuss at mcs.anl.gov
Subject: [MPICH] getchar


Hi all,
 
When using mpich1 with mpirun I used to put some getchar() in my code for
debug purpose.
Then during computation I had to hit "enter" Nproc times.
 
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.
To obtain the same behaviour I write now: 
If (mytid ==0) getchar();MPI_Barrier(MPI_COMM_WORLD);
 
Thanks,
 
Regards,
Etienne Perchat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20061114/a3c77646/attachment.htm>


More information about the mpich-discuss mailing list