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/dm/impls/plex/tutorials/ex10.c
src/ksp/ksp/tutorials/ex10.c
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex70.c
src/ksp/ksp/tutorials/ex72.c
src/ksp/ksp/tutorials/ex73.c
src/ksp/ksp/tutorials/ex82.c
src/snes/tutorials/ex48.c
src/snes/tutorials/ex5.c
src/snes/tutorials/ex55.c


Edit on GitLab

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