IBM Books

MPI Subroutine Reference

MPI_COMM_SIZE, MPI_Comm_size

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

comm
is the communicator (handle) (IN)

size
is an integer specifying the number of tasks in the group of comm (OUT)

IERROR
is the FORTRAN return code. It is always the last argument.

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

Invalid communicator

MPI not initialized

MPI already finalized

Related information

MPI_COMM_GROUP
MPI_COMM_RANK
MPI_COMM_REMOTE_SIZE
MPI_GROUP_FREE
MPI_GROUP_SIZE


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]