MPIU_Allreduce#

a PETSc replacement for MPI_Allreduce() that tries to determine if the call from all the MPI ranks occur from the same place in the PETSc code. This helps to detect bugs where different MPI ranks follow different code paths resulting in inconsistent and incorrect calls to MPI_Allreduce().

Synopsis#

#include <petscsys.h>
PetscErrorCode MPIU_Allreduce(void *indata,void *outdata,PetscMPIInt count,MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);

Collective

Input Parameters#

  • a - pointer to the input data to be reduced

  • c - the number of MPI data items in a and b

  • d - the MPI datatype, for example MPI_INT

  • e - the MPI operation, for example MPI_SUM

  • fcomm - the MPI communicator on which the operation occurs

Output Parameter#

  • b - the reduced values

Notes#

In optimized mode this directly calls MPI_Allreduce()

This is defined as a macro that can return error codes internally so it cannot be used in a subroutine that returns void.

The error code this returns should be checked with PetscCall() even though it looks like an MPI function because it always returns PETSc error codes

See Also#

MPI_Allreduce()

Level#

developer

Location#

include/petscsys.h

Examples#

src/ts/tutorials/ex18.c
src/ts/tutorials/ex9.c
src/ts/tutorials/ex14.c
src/tao/unconstrained/tutorials/minsurf2.c
src/dm/impls/plex/tutorials/ex10.c
src/tao/constrained/tutorials/ex1.c
src/ts/tutorials/ex11.c
src/ts/tutorials/ex44.c
src/tao/bound/tutorials/plate2.c
src/snes/tutorials/ex48.c


Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages