MPI-/ provides an inclusive scan operation. The exclusive scan is described here.
MPI_EXSCAN(sendbuf, recvbuf, count, datatype, op, comm)
int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
MPI_EXSCAN(SENDBUF, RECVBUF, COUNT, DATATYPE, OP, COMM, IERROR) <type> SENDBUF(*), RECVBUF(*)
INTEGER COUNT, DATATYPE, OP, COMM, IERROR
int MPI::Intracomm::Exscan(const void* sendbuf, void* recvbuf, int count, const MPI::Datatype& datatype, const MPI::Op& op) const
void
MPI_EXSCAN is used to perform a prefix reduction on data distributed
across the group.
The value in recvbuf on the process with rank 0 is undefined, and recvbuf is not signficant on process 0.
The value in recvbuf on the process with rank 1 is defined as
the value in sendbuf on the process with rank 0.
For processes with rank , the operation returns, in the
receive buffer of the
process with rank
, the reduction of the values in the send buffers
of processes with ranks
(inclusive).
The type of operations
supported, their semantics, and the constraints on send and receive
buffers, are as for MPI_REDUCE.
No ``in place'' option is supported.
The reason that MPI-/ chose the inclusive scan is that the definition of behavior on processes zero and one was thought to offer too many complexities in definition, particularly for user-defined operations.(End of rationale.)
MPI-Standard for MARMOT