Does MPI provide preprocessor macros?

杀马特。学长 韩版系。学妹 提交于 2020-02-20 07:49:12

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!