Send stdout to a file RRS feed

  • Question

  • Is there an option on the mpiexec command line to have all processes send stdout to a file?
    Friday, September 15, 2017 11:07 PM

All replies

  • Currently all processes will send stdout to mpiexec, you can redirect mpiexec's stdout to a file which will essentially mean all output from all processes will go to that file. However, if you want each process' stdout to go a different file you will need to write a wrapper script (e.g., myWrapperApp.bat)

    @echo off

    myApp.exe > %PMI_RANK%.txt

    You would then replace the command mpiexec -n X myApp.exe with mpiexec -n X myWrapperApp.bat

    Note that %PMI_RANK% is an environment variable set by mpiexec to the processes that would indicate the MPI_COMM_WORLD rank of the process. i.e., process with MPI_COMM_WORLD rank of 0 will have the environment PMI_RANK set as 0.

    After your application terminates you will have a bunch of 0.txt, 1.txt, etc... that will have each process' individual output

    Monday, September 18, 2017 12:25 AM