Discussion:
[OMPI users] How to determine MPI rank/process number local to a socket/node
Frank
2012-01-26 17:51:01 UTC
Permalink
Say, I run a parallel program using MPI. Execution command

mpirun -n 8 -npernode 2 <prg>

launches 8 processes in total. That is 2 processes per node and 4
nodes in total. (OpenMPI 1.5). Where a node comprises 1 CPU (dual
core) and network interconnect between nodes is InfiniBand.

Now, the rank number (or process number) can be determined with

int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);

This returns a number between 0 and 7.

But, How can I determine the node number (in this case a number
between 0 and 3) and the process number within a node (number between
0 and 1)?

You can find this question on stackoverflow (if you prefer to answer
through their interface):

http://stackoverflow.com/questions/9022496/how-to-determine-mpi-rank-process-number-local-to-a-socket-node

Best,
Ralph Castain
2012-01-26 18:03:53 UTC
Permalink
We don't provide a mechanism for determining the node number - never came up before as you can use gethostname to find out what node you are on.

We do provide an envar that tells you the process rank within the node: OMPI_COMM_WORLD_LOCAL_RANK is what you are probably looking for.
Post by Frank
Say, I run a parallel program using MPI. Execution command
mpirun -n 8 -npernode 2 <prg>
launches 8 processes in total. That is 2 processes per node and 4
nodes in total. (OpenMPI 1.5). Where a node comprises 1 CPU (dual
core) and network interconnect between nodes is InfiniBand.
Now, the rank number (or process number) can be determined with
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
This returns a number between 0 and 7.
But, How can I determine the node number (in this case a number
between 0 and 3) and the process number within a node (number between
0 and 1)?
You can find this question on stackoverflow (if you prefer to answer
http://stackoverflow.com/questions/9022496/how-to-determine-mpi-rank-process-number-local-to-a-socket-node
Best,
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
Loading...