区分 ifort 和其他 fortran 编译器的宏是什么?
我正在使用 Fortran 代码,该代码必须与各种 Fortran 编译器一起使用(并且与 C++ 和 Java 代码交互)。目前,我们让它与 gfortran 和 g95 一起工作,但我正在研究如何让它与 ifort 一起工作,我遇到的第一个问题是弄清楚如何在源代码中确定它是使用 ifort 还是不是。
例如,我目前有这段代码:
#if defined(__GFORTRAN__)
// Macro to add name-mangling bits to fortran symbols. Currently for gfortran only
#define MODFUNCNAME(mod,fname) __ ## mod ## _MOD_ ## fname
#else
// Macro to add name-mangling bits to fortran symbols. Currently for g95 only
#define MODFUNCNAME(mod,fname) mod ## _MP_ ## fname
#endif // if __GFORTRAN__
ifort 的宏是什么?我尝试了IFORT,但这是不对的,进一步的猜测似乎没有成效。我还尝试使用 ifort -help
和 Google 阅读手册页。
I'm working with Fortran code that has to work with various Fortran compilers (and is interacting with both C++ and Java code). Currently, we have it working with gfortran and g95, but I'm researching what it would take to get it working with ifort, and the first problem I'm having is figuring out how to determine in the source code whether it's using ifort or not.
For example, I currently have this piece of code:
#if defined(__GFORTRAN__)
// Macro to add name-mangling bits to fortran symbols. Currently for gfortran only
#define MODFUNCNAME(mod,fname) __ ## mod ## _MOD_ ## fname
#else
// Macro to add name-mangling bits to fortran symbols. Currently for g95 only
#define MODFUNCNAME(mod,fname) mod ## _MP_ ## fname
#endif // if __GFORTRAN__
What's the macro for ifort? I tried IFORT, but that wasn't right, and further guessing doesn't seem productive. I also tried reading the man page, using ifort -help
, and Google.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在使用
__INTEL_COMPILER
,如 http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/win/compiler_f/bldaps_for/common/bldaps_use_presym .htmYou're after
__INTEL_COMPILER
, as defined in http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/win/compiler_f/bldaps_for/common/bldaps_use_presym.htm根据他们的文档,他们定义了 __INTEL_COMPILER=910 。 910 可能是一个版本号,但您可能只需在其上添加 #ifdef 即可。
我应该注意到 ifort 不允许宏,除非您使用 /fpp 标志明确打开它。
According to their docs, they define __INTEL_COMPILER=910 . The 910 may be a version number, but you can probably just #ifdef on it.
I should note that ifort doesn't allow macros unless you explicity turn it on with the /fpp flag.