问题
Does MPI standard provide a preprocessor macro, so my C/C++ code could branch if it is compiled by MPI-enabled compiler? Something like _OPENMP
macro for OpenMP.
回答1:
According to the MPI standard (page 335), you can check for the MPI_VERSION
macro:
In order to cope with changes to the MPI Standard, there are both compile-time and runtime ways to determine which version of the standard is in use in the environment one is using.
The "version" will be represented by two separate integers, for the version and subversion:
In C,
#define MPI_VERSION 3 #define MPI_SUBVERSION 0
来源:https://stackoverflow.com/questions/28353969/does-mpi-provide-preprocessor-macros