Purpose
Returns the size of the group associated with a communicator.
C synopsis
#include <mpi.h> int MPI_Comm_size(MPI_Comm comm,int *size);
C++ synopsis
#include mpi.h int MPI::Comm::Get_size() const;
FORTRAN synopsis
include 'mpif.h' or use mpi MPI_COMM_SIZE(INTEGER COMM,INTEGER SIZE,INTEGER IERROR)
Parameters
Description
This subroutine returns the size of the group associated with a communicator. MPI_COMM_SIZE is a shortcut to:
If comm is an intercommunicator, size will be the size of the local group. To determine the size of the remote group of an intercommunicator, use MPI_COMM_REMOTE_SIZE.
You can use this subroutine with MPI_COMM_RANK to determine the amount of concurrency available for a specific library or program. 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. The rank and size information can then be used to partition work across the available tasks.
Notes
This function indicates the number of tasks in a communicator. For MPI_COMM_WORLD, it indicates the total number of tasks available.
Errors
Related information