- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I was wondering if there is a possiblity to redirect and split stdout of each mpi rank to a seperate file, so that I can investigate the output of each mpi rank seperately.
best regards,
Timo
- Tags:
- Parallel Computing
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is your program written in C/C++ or Fortran. Both can replace stdout with a file (i.e file with rank number embedded).
https://stackoverflow.com/questions/18086193/redirect-stdout-stderr-to-file-under-unix-c-again
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Jim,
it is written in Fortran
best regards
Timo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran has interoperablee function calls. You can call C from Fortran, and link in an object file generated by C/C++. This is relatively easy to do to get what you want.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know if it is possible to do this directly with a command of the form: "mpirun mpi_binary.exe", but it should be easy enough to do if you add a "wrapper" script in the middle.
Most of my MPI jobs are launched with commands of the form: "mpirun wrapper.sh mpi_binary.exe".
In this case, mpirun launches one instance of "wrapper.sh" for each MPI rank. In the wrapper.sh script, I set up output file names based on the hostname and MPI rank number, then execute the "mpi_binary.exe" with rank-specific IO redirection.
A simple example might be (untested):
#!/bin/bash MYHOST=`hostname -s` MYRANK=$PMI_RANK # this variable may depend on your execution environment PERFOUT=perf.$MYHOST.$MYRANK STD_OUT=stdout.$MYHOST.$MYRANK STD_ERR=stderr.$MYHOST.$MYRANK # assume that the arguments to this script are the name of the executable # followed by any of its required options perf stat -o $PERFOUT $* 2> $STD_ERR 1> $STD_OUT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear John,
this might help me. I will investigate the example and try to adapt it to my case. Thanks!
best,
Timo
![](/skins/images/872293744008A34B36F8ABF94A46CC66/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page