I am trying to use gprof with my mpi code. I googled and saw this msg:

Open-MPI and gprof:

Yes you can profile MPI applications by compiling with -pg. However, by

default each process will produce an output file called "gmon.out",
which is a problem if all processes are writing to the same global file
system (i.e. all processes will try to write to the same file).

There is an undocumented feature of gprof that allows you to specify the
filename for profiling output via the environment variable
GMON_OUT_PREFIX. For example, one can set this variable in the .bashrc
file for every node to insure unique profile filenames, i.e.:

export GMON_OUT_PREFIX='gmon.out-'`/bin/uname -n`

The filename will appear as GMON_OUT_PREFIX.pid, where pid is the
process id on a given node (so this will work when multiple nodes are
contained in a single host).

However, this msg was written in 2009. I wonder if it is still the same method. Also, in that case, if i run on 10 cpus, I will have 10 such outputs. Is it possible to get an average result instead of individual results?

I run the mpi code but without using the above instructions and got just 1 file - gmon.out. Does it mean that this result is for the current node?

Thank you!
Yours sincerely,

TAY wee-beng