IBM Books

MPI Subroutine Reference

MPI_BARRIER, MPI_Barrier

Purpose

Blocks each task until all tasks have called it.

in comm

C synopsis

#include <mpi.h>
int MPI_Barrier(MPI_Comm comm);

C++ synopsis

#include mpi.h
void MPI::Comm::Barrier() const;

FORTRAN synopsis

include 'mpif.h' or use mpi
MPI_BARRIER(INTEGER COMM,INTEGER IERROR)

Parameters

comm
is a communicator (handle) (IN)

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

Description

This subroutine blocks until all tasks have called it. Tasks cannot exit the operation until all group members have entered.

When you use this subroutine in a threads application, make sure all collective operations on a particular communicator occur in the same order at each task. See IBM Parallel Environment for AIX: MPI Programming Guide for more information on programming with MPI in a threads environment.

Notes

comm can be an intercommunicator or an intracommunicator. If comm is an intercommunicator, the barrier is performed across all tasks in the intercommunicator. In this case, all tasks in the local group of the intercommunicator can exit the barrier when all of the tasks in the remote group have entered the barrier.

Errors

Fatal errors:

Invalid communicator

MPI not initialized

MPI already finalized

Related information

MPE_IBARRIER


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