clang compiler errors for MPI_AllReduce (-Wtype-safety)
Summary
Clang compiler errors with MPI_AllReduce (-Wtype-safety)
Steps to reproduce
-- The C compiler identification is Clang 9.0.1
-- The CXX compiler identification is Clang 9.0.1
-- Check for working C compiler: /opt/local/bin/mpicc-mpich-clang90
Relevant logs and/or screenshots
src/Algorithms/ParallelSliceTracker.cpp:291:41: error: argument type
'bool *' doesn't match specified 'MPI' type tag that requires 'int *' [-Werror,-Wtype-safety]
MPI_Allreduce(MPI_IN_PLACE, &globalEOL_m, 1, MPI_INT, MPI_LAND, Ippl::getComm());
^~~~~~~~~~~~ ~~~~~~~
src/Algorithms/bet/EnvelopeBunch.cpp:1458:33: error: argument type
'size_t *' (aka 'unsigned long *') doesn't match specified 'MPI' type tag that requires 'long *'
[-Werror,-Wtype-safety]
MPI_Allreduce(MPI_IN_PLACE, &count, 1, MPI_LONG, MPI_SUM, Ippl::getComm());
^~~~~~ ~~~~~~~~
- some more similar to 2.
Possible fixes
MPI_Allreduce(MPI_IN_PLACE, &globalEOL_m, 1, MPI_INT, MPI_LAND, Ippl::getComm());
globalEOL_m
is a boolean and this doesn't combine properly with MPI_INT
.
Instead, the commented out line above:
reduce(&globalEOL_m, &globalEOL_m + 1, &globalEOL_m, OpBitwiseAndAssign());
compiles fine.
@kraus: there is a similar line in ParallelTTracker.cpp
. Is that line correct in this case as well?
MPI_Allreduce(MPI_IN_PLACE, &count, 1, MPI_LONG, MPI_SUM, Ippl::getComm());
should rather be:
MPI_Allreduce(MPI_IN_PLACE, &count, 1, MPI_UNSIGNED_LONG, MPI_SUM, Ippl::getComm());
Edited by snuverink_j