7.11.3. Example using MPI_SCAN

PreviousUpNext
Up: Scan Next: Nonblocking Collective Operations Previous: Exclusive Scan

The example in this section uses an intra-communicator.


Example This example uses a user-defined operation to produce a segmented scan. A segmented scan takes, as input, a set of values and a set of logicals, and the logicals delineate the various segments of the scan. For example:

Image file

The operator that produces this effect is

Image file

where

Image file

Note that this is a noncommutative operator. C code that implements it is given below.

Image file

Note that the inout argument to the user-defined function corresponds to the right-hand operand of the operator. When using this operator, we must be careful to specify that it is noncommutative, as in the following.

Image file


PreviousUpNext
Up: Scan Next: Nonblocking Collective Operations Previous: Exclusive Scan


Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023