Discussion:
[OMPI users] Mpirun: How to print STDOUT of just one process?
Frank
2012-02-01 15:59:05 UTC
Permalink
When running

mpirun -n 2 <prg>

the STDOUT streams of both processes are combined and are displayed by
the shell. In such an interleaved format its hard to tell what line
comes from which node.

Is there a way to have mpirun just merger STDOUT of one process to its
STDOUT stream?

Best,
Frank

Cross-reference:
http://stackoverflow.com/questions/9098781/mpirun-how-to-print-stdout-of-just-one-process
Lloyd Brown
2012-02-01 16:04:01 UTC
Permalink
I don't know about using mpirun to do it, but you can actually call
mpirun on a script, and have that script individually call a single
instance of your program. Then that script could use shell redirection
to redirect the output of the program's instance to a separate file.

I've used this technique to play with ulimit sort of things in the
script before. I'm not entirely sure what variables are exposed to you
in the script, such that you could come up with a unique filename to
output to, though.

Lloyd Brown
Systems Administrator
Fulton Supercomputing Lab
Brigham Young University
http://marylou.byu.edu
Post by Frank
When running
mpirun -n 2 <prg>
the STDOUT streams of both processes are combined and are displayed by
the shell. In such an interleaved format its hard to tell what line
comes from which node.
Is there a way to have mpirun just merger STDOUT of one process to its
STDOUT stream?
Best,
Frank
http://stackoverflow.com/questions/9098781/mpirun-how-to-print-stdout-of-just-one-process
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
Noam Bernstein
2012-02-01 16:06:58 UTC
Permalink
man mpirun
.
.
.
-output-filename, --output-filename <filename>
Redirect the stdout, stderr, and stddiag of all ranks to a rank-unique version of the specified filename. Any directories in the filename will automatically be created. Each output
file will consist of filename.rank, where the rank will be left-filled with zero's for correct ordering in listings.
.
.
.
Gustavo Correa
2012-02-01 17:48:24 UTC
Permalink
Hi Frank, Lloyd

If all you want is to sort out from which process the output is coming from,
you can use the "-tag-output" switch to the [OpenMPI] mpirun.
Check it out with 'man mpirun'.

I hope this helps,
Gus Correa
Post by Lloyd Brown
I don't know about using mpirun to do it, but you can actually call
mpirun on a script, and have that script individually call a single
instance of your program. Then that script could use shell redirection
to redirect the output of the program's instance to a separate file.
I've used this technique to play with ulimit sort of things in the
script before. I'm not entirely sure what variables are exposed to you
in the script, such that you could come up with a unique filename to
output to, though.
Lloyd Brown
Systems Administrator
Fulton Supercomputing Lab
Brigham Young University
http://marylou.byu.edu
Post by Frank
When running
mpirun -n 2 <prg>
the STDOUT streams of both processes are combined and are displayed by
the shell. In such an interleaved format its hard to tell what line
comes from which node.
Is there a way to have mpirun just merger STDOUT of one process to its
STDOUT stream?
Best,
Frank
http://stackoverflow.com/questions/9098781/mpirun-how-to-print-stdout-of-just-one-process
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
Eugene Loh
2012-02-01 16:07:52 UTC
Permalink
Post by Frank
When running
mpirun -n 2<prg>
the STDOUT streams of both processes are combined and are displayed by
the shell. In such an interleaved format its hard to tell what line
comes from which node.
As far as this part goes, there is also "mpirun --tag-output". Check
the mpirun man page.
Post by Frank
Is there a way to have mpirun just merger STDOUT of one process to its
STDOUT stream?
Paul Kapinos
2012-02-01 16:17:50 UTC
Permalink
Try out the attached wrapper:
$ mpiexec -np 2 masterstdout <prg>
Post by Frank
mpirun -n 2 <prg>
Is there a way to have mpirun just merger STDOUT of one process to its
STDOUT stream?
--
Dipl.-Inform. Paul Kapinos - High Performance Computing,
RWTH Aachen University, Center for Computing and Communication
Seffenter Weg 23, D 52074 Aachen (Germany)
Tel: +49 241/80-24915
Frank
2012-02-01 16:56:05 UTC
Permalink
Great, that works!! Many Thanks!
Post by Paul Kapinos
$ mpiexec -np 2 masterstdout <prg>
Post by Frank
mpirun -n 2 <prg>
Is there a way to have mpirun just merger STDOUT of one process to its
STDOUT stream?
--
Dipl.-Inform. Paul Kapinos   -   High Performance Computing,
RWTH Aachen University, Center for Computing and Communication
Seffenter Weg 23,  D 52074  Aachen (Germany)
Tel: +49 241/80-24915
#!/bin/sh
if [[ $OMPI_COMM_WORLD_RANK == 0 ]]
then
 $ARGS
else
 $ARGS 1>/dev/null 2>/dev/null
fi
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
Loading...