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
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:
Develop mode error if:
Related information