Purpose
Returns the rank of the local task in the group associated with a communicator.
C synopsis
#include <mpi.h> int MPI_Comm_rank(MPI_Comm comm,int *rank);
C++ synopsis
#include mpi.h int MPI::Comm::Get_rank() const;
FORTRAN synopsis
include 'mpif.h' or use mpi MPI_COMM_RANK(INTEGER COMM,INTEGER RANK,INTEGER IERROR)
Parameters
Description
This subroutine returns the rank of the local task in the group associated with a communicator.
You can use this subroutine with MPI_COMM_SIZE to determine the amount of concurrency available for a specific job. MPI_COMM_RANK indicates the rank of the task that calls it in the range from 0...size - 1, where size is the return value of MPI_COMM_SIZE.
This subroutine is a shortcut to accessing the communicator's group with MPI_COMM_GROUP, computing the rank using MPI_GROUP_RANK and freeing the temporary group by using MPI_GROUP_FREE.
If comm is an intercommunicator, rank is the rank of the local task in the local group.
Errors
Related information