[petsc-users] Redefining MPI functions as macros can break C++ code

Erik Schnetter eschnetter at perimeterinstitute.ca
Wed Nov 2 18:28:55 CDT 2022


PETSc redefines MPI functions as macros when logging is enabled. This
breaks some C++ code; see e.g. <
https://github.com/AMReX-Codes/amrex/pull/3005> for an example. The reason
is that macros get confused about commas in template arguments.

It would be convenient if PETSc used a different way to log MPI function
calls, but I can't think of a good way. Alternatively, logging could be
disabled by default, or MPI logging could be disabled by default, or there
could be a simple way to opt out (e.g. use `#define PETSC_LOG_MPI` after
`#include <petsc.h>` to enable it for a source file).

-erik

-- 
Erik Schnetter <eschnetter at perimeterinstitute.ca>
http://www.perimeterinstitute.ca/personal/eschnetter/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221102/e17e8cc8/attachment.html>


More information about the petsc-users mailing list