Skip to content

Commit 5ec270b

Browse files
authored
Fix compilation for PETSc (AMReX-Codes#3005)
We cannot include PETSc headers too early because it might redefine MPI routines as macros (https://github.com/petsc/petsc/blob/main/include/petsclog.h#L441). They break MPI calls like below, MPI_Allreduce(&tmp, &vi, 1, ParallelDescriptor::Mpi_typemap<T>::type(), ParallelDescriptor::Mpi_op<T,amrex::Greater<T>>(), comm); because of the `,` in `<T,amrex::Greater<T>>`.
1 parent 735c351 commit 5ec270b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Src/Extern/PETSc/AMReX_PETSc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

2-
#include <petscksp.h>
3-
#include <AMReX_PETSc.H>
4-
52
#ifdef AMREX_USE_EB
63
#include <AMReX_MultiCutFab.H>
74
#include <AMReX_EBFabFactory.H>
85
#endif
96

107
#include <AMReX_Habec_K.H>
118

9+
#include <petscksp.h>
10+
#include <AMReX_PETSc.H>
11+
1212
#include <cmath>
1313
#include <numeric>
1414
#include <limits>

0 commit comments

Comments
 (0)