MPI是否提供预处理器宏? [英] Does MPI provide preprocessor macros?
问题描述
MPI标准是否提供预处理器宏,因此如果我的C/C ++代码是由启用MPI的编译器编译的,则可以分支吗?像_OPENMP
用于OpenMP的宏.
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.
推荐答案
根据 MPI标准(第335页),您可以检查MPI_VERSION
宏:
According to the MPI standard (page 335), you can check for the MPI_VERSION
macro:
为了应对MPI标准的更改,有编译时和运行时两种方法来确定在所使用的环境中正在使用哪个版本的标准.
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:
在C中,
#define MPI_VERSION 3
#define MPI_SUBVERSION 0
这篇关于MPI是否提供预处理器宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!