Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] hpw to log output of spawned processes
From: jody (jody.xha_at_[hidden])
Date: 2010-07-12 04:17:44


Hi

I have a master process which spawns a number of workers of which i'd
like to save the output in separate files.

Usually i use the '-output-filename' option in such a situation.
However, if i do
  mpirun -np 1 -output-filename work_out master arg1 arg2
all the files work_out.1, work_out.2, ... are ok,
but work_out.0 contains both outputs of the master process(process 0
in COMM_WORLD) and
of the first worker (process 0 in the communicator of the spawned processes).

I also tried the '-tag-output' option, but this involves several
additional steps,
because i have to separate the combined outputs
  mpirun -np 1 -tag-output master arg1 arg2 > total.out
  grep "\[1,0\]" total.out | sed 's/\[1,0\]<stdout>://' > master.out
  grep "\[2,0\]" outA | sed 's/\[2,0\]<stdout>://' > worker_0.out
  grep "\[2,1\]" outA | sed 's/\[2,1\]<stdout>://' > worker_1.out
  ...
Of course, this could be wrapped in a script, but it is a bit cumbersome
(and i am not sure if the job-ids are always "1" and "2") ...

Is there some simpler way to separate the output of the two streams?

If not, would it be possible to extend the -output-filename option i
such a way that it
would also combine job-id and rank withe the output file:
  work_out.1.0
for the master's output, and
  work_out.2.0
  work_out.2.1
  work_out.2.2
  ...
for the worker's output?

Thank You
  Jody