MPI_Comm_rank function

Retrieves the rank of the calling process in the group of the specified communicator.

Syntax


int MPIAPI MPI_Comm_rank(
        MPI_Comm comm,
  _Out_ int      *rank
);

Parameters

comm

The communicator.

rank [out]

On return, a pointer to the identifier of the calling process within the group of the communicator.

Return value

Returns MPI_SUCCESS on success. Otherwise, the return value is an error code.

In Fortran, the return value is stored in the IERROR parameter.

Fortran


MPI_COMM_RANK(COMM,RANK,IERROR)
    INTEGER COMM, RANK, IERROR

Remarks

This function enables the user to retrieve the process rank with a single function call. Otherwise, it would be necessary to create a temporary group by using the MPI_Comm_group function, get the rank in the group by using the MPI_Group_rank function, and then free the temporary group by using the MPI_Group_free function.

Requirements

Product

HPC Pack 2012 MS-MPI Redistributable Package, HPC Pack 2008 R2 MS-MPI Redistributable Package, HPC Pack 2008 MS-MPI Redistributable Package or HPC Pack 2008 Client Utilities

Header

Mpi.h;
Mpif.h

Library

Msmpi.lib

DLL

Msmpi.dll

See also

MPI Communicator Functions
MPI_Comm_size

 

 

Show: