Skip to content

Commit

Permalink
Fix compilation for PETSc (AMReX-Codes#3005)
Browse files Browse the repository at this point in the history
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>>`.
  • Loading branch information
WeiqunZhang committed Nov 1, 2022
1 parent 735c351 commit 5ec270b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Src/Extern/PETSc/AMReX_PETSc.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

#include <petscksp.h>
#include <AMReX_PETSc.H>

#ifdef AMREX_USE_EB
#include <AMReX_MultiCutFab.H>
#include <AMReX_EBFabFactory.H>
#endif

#include <AMReX_Habec_K.H>

#include <petscksp.h>
#include <AMReX_PETSc.H>

#include <cmath>
#include <numeric>
#include <limits>
Expand Down

0 comments on commit 5ec270b

Please sign in to comment.