IBM Books

MPI Subroutine Reference

MPI_EXSCAN, MPI_Exscan

Purpose

Performs a prefix reduction on data distributed across the group.

C synopsis

#include <mpi.h>
int MPI_Exscan(void *sendbuf, void *recvbuf, int count,
	       MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);

C++ synopsis

#include mpi.h
void MPI::Intracomm::Exscan(const void* sendbuf, void* recvbuf, int count, 
                            const MPI::Datatype& datatype, const MPI::Op& op) const;

FORTRAN synopsis

include 'mpif.h' or use mpi
MPI_EXSCAN(CHOICE SENDBUF, CHOICE RECVBUF, INTEGER COUNT,
	   INTEGER DATATYPE, INTEGER OP, INTEGER COMM, INTEGER IERROR)

Parameters

sendbuf
is the starting address of the send buffer (choice) (IN)

recvbuf
is the starting address of the receive buffer (choice) (OUT)

count
is the number of elements in the input buffer (integer) (IN)

datatype
is the datatype of elements in the input buffer (handle) (IN)

op
is the reduction operation (handle) (IN)

comm
is the intracommunicator (handle) (IN)

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

Description

Use this subroutine to perform a prefix reduction operation on data distributed across a group. The value in recvbuf on the task with rank 0 is undefined, and recvbuf is not signficant on task 0. The value in recvbuf on the task with rank 1 is defined as the value in sendbuf on the task with rank 0. For tasks with rank i > 1, the operation returns, in the receive buffer of the task with rank i, the reduction of the values in the send buffers of tasks with ranks 0,...,i -1 (inclusive). The type of operations supported, their semantics, and the constraints on send and receive buffers, are as for MPI_REDUCE.

MPI_EXSCAN is not supported for intercommunicators and does not accept MPI_IN_PLACE.

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

As for MPI_SCAN, MPI does not specify which tasks can call the reduction operation, only that the result be correctly computed. In particular, note that the task with rank 1 need not call the MPI_Op, because all it needs to do is to receive the value from the task with rank 0. However, all tasks, even the tasks with ranks 0 and 1, must provide the same op.

Errors

Fatal errors:

Invalid count
count < 0

Invalid datatype

Type not committed

Invalid op

Invalid communicator

Unequal message lengths

Invalid use of MPI_IN_PLACE

MPI not initialized

MPI already finalized

Develop mode error if:

Inconsistent op

Inconsistent datatype

Inconsistent message length

Related information

MPI_REDUCE
MPI_SCAN


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