MPI_Comm_size function
Retrieves the number of processes involved in a communicator, or the total number of processes available.
Syntax
int MPIAPI MPI_Comm_size(
MPI_Comm comm,
_Out_ int *size
);
Parameters
comm
The communicator to evaluate. Specify the MPI_COMM_WORLD constant to retrieve the total number of processes available.size [out]
On return, indicates the number of processes in the group for 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_SIZE(COMM,SIZE,IERROR)
INTEGER COMM, SIZE, IERROR
Remarks
This function enables the user to retrieve the group size with a single function call. Otherwise, it would be necessary to create a temporary group by using the MPI_Comm_group function, get the size of the group by using the MPI_Group_size function, and then free the temporary group by using the MPI_Group_free function.
This function is often used with the MPI_Comm_rank function to determine the amount of concurrency that is available for a specific library or program. The MPI_Comm_rank function indicates the rank of the process that calls it in the range from 0 to size-1, where size is retrieved by using the MPI_Comm_size function.
Note
There is no standard way to change the number of processes after initialization has taken place.
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 |