Definition
MPI_Scan is an inclusive scan: it performs a prefix reduction across all MPI processes in the given communicator. In other words, each MPI process receives the result of the reduction operation on the values passed by that MPI process and all MPI processes with a lower rank. MPI_Scan is a collective operation; it must be called by all MPI processes in the communicator concerned. The variant of MPI_Scan is the exclusive version MPI_Exscan.
int MPI_Scan(void* send_buffer,
void* receive_buffer,
int count,
MPI_Datatype datatype,
MPI_Op operation,
MPI_Comm communicator);