Christopher Cameron, Steve Lantz, Brandon Barker, CAC Staff (original)
Cornell Center for Advanced Computing

Revisions: 5/2022, 1/2014, 2001 (original)

This topic describes MPI's global computation routines: reduce and scan.

In MPI, there are two types of global computation routines: reduce and scan. These routines output the full and incremental results, respectively, of applying an operation to a distributed data array. The global operation to be performed is passed to the routine as an argument identifying a function, which can be either a predefined MPI function or a user-supplied function.

MPI provides four global computation routines in total. In this topic, we start by discussing the three varieties of reduction computation. We then discuss scan computation.

Objectives

After you complete this segment, you should be able to:

  • Explain the reduce and scan global computation routines
  • List the four global computation routines
  • Show the syntax of the MPI scan routine in C and Fortran
  • Demonstrate using MPI_Allreduce in C and Fortran
Prerequisites
 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement