Does MPI provide preprocessor macros?

2020-07-10 03:05发布

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.

标签: c++ c mpi
1条回答
我只想做你的唯一
2楼-- · 2020-07-10 03:36

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
查看更多
登录 后发表回答