IBM Books

MPI Subroutine Reference

MPI_SCAN, MPI_Scan

Purpose

Performs a parallel prefix reduction operation on data distributed across a group.

C synopsis

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

C++ synopsis

#include mpi.h
void MPI::Intracomm::Scan(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_SCAN(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 sendbuf (integer) (IN)

datatype
is the datatype of elements in sendbuf (handle) (IN)

op
is the reduction operation (handle) (IN)

comm
is the communicator (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 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 (inclusive). The type of operations supported, their semantics, and the restrictions on send and receive buffers are the same as for MPI_REDUCE.

The "in place" option for intracommunicators is specified by passing MPI_IN_PLACE in the sendbuf argument. In this case, the input data is taken from the receive buffer, and replaced by the output data.

MPI_SCAN is not supported for intercommunicators.

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.

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

MPE_ISCAN
MPI_OP_CREATE
MPI_REDUCE


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