-
Notifications
You must be signed in to change notification settings - Fork 438
Cannot build AMReX 20.11 with PETSc (?) #3009
Copy link
Copy link
Closed
Description
I see this build error:
COMPILING CarpetX/PDESolvers/src/solve.cxx
In file included from /Users/eschnett/Cactus/view/include/AMReX_FabArrayBase.H:8,
from /Users/eschnett/Cactus/view/include/AMReX_MFIter.H:5,
from /Users/eschnett/Cactus/view/include/AMReX_Reduce.H:8,
from /Users/eschnett/Cactus/view/include/AMReX_BaseFab.H:20,
from /Users/eschnett/Cactus/view/include/AMReX_FArrayBox.H:7,
from /Users/eschnett/Cactus/arrangements/CarpetX/Loop/src/loop.hxx:4,
from /Users/eschnett/Cactus/configs/sim-debug/bindings/include/loop.hxx:4,
from /Users/eschnett/Cactus/arrangements/CarpetX/PDESolvers/src/../../CarpetX/src/driver.hxx:4,
from /Users/eschnett/Cactus/arrangements/CarpetX/PDESolvers/src/solve.cxx:4:
/Users/eschnett/Cactus/view/include/AMReX_ParallelReduce.H:131:78: error: macro "MPI_Allreduce" passed 7 arguments, but takes just 6
131 | ParallelDescriptor::Mpi_op<T,amrex::Greater<T>>(), comm);
| ^The complete statement in this line is
MPI_Allreduce(&tmp, &vi, 1,
ParallelDescriptor::Mpi_typemap<T>::type(),
ParallelDescriptor::Mpi_op<T,amrex::Greater<T>>(), comm);Clearly, this function call has 6 arguments, as it should.
I think the problem is the following. The caller uses PETSc, and includes various PETSc include files as well. PETSc contains this line
#define MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm) (petsc_allreduce_ct += PetscMPIParallelComm((comm)), MPI_Allreduce((sendbuf), (recvbuf), (count), (datatype), (op), (comm)))in its header file petsclog.h. This turns MPI_Allreduce into a macro (sneaky!), and the C++ preprocessor is then getting confused by the comma in the template argument to Mpi_op.
Obviously, PETSc should not be doing this. In the spirit of defensive programming, do you nonetheless want to add parentheses around this argument, as in (ParallelDescriptor::Mpi_op<T,amrex::Greater<T>>())?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels