【问题标题】:gfortran equivalent of the -native flag-native 标志的 gfortran 等效项
【发布时间】:2018-08-29 15:36:28
【问题描述】:

我正在尝试在 Fortran 77 中运行我没有编写的程序的 makefile。

它指定了以下标志:

FLT_FLAGS = -native -libmil

然后用它们编译一个 Fortran 77 程序:

f77 -O -native -libmil -c a2.f

但失败了:

f77: error: unrecognized command line option ‘-native’
makefile:107: recipe for target 'vg.a(a2.o)' failed
make: *** [vg.a(a2.o)] Error 1

关于这个问题,我唯一能找到的是 -native 已过时,这可能就是 gfortran (f77) 无法识别它的原因:https://docs.oracle.com/cd/E37069_01/html/E37076/aevft.html#scrolltoc

【问题讨论】:

  • 等等,你用的是哪个编译器,Oracle 还是 gfortran? f77 -v 打印什么?你怎么称呼gfortran?没有什么能比得上 Fortran 原生标志,每个编译器都有自己的标志。
  • 查看 GCC 的 -mtune 和 -march 标志(包括 gfortran)stackoverflow.com/questions/10559275/…
  • @VladimirF f77 -v 打印 COLLECT_GCC=f77 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: [...] Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 。我没有看到我正在使用的代码的任何许可证,因为教授给了我。代码来自:aip.scitation.org/doi/abs/10.1063/1.168405,不知道要不要在这里发布,让社区帮助我。

标签: fortran gfortran fortran77


【解决方案1】:

您使用的是 gfortran 5.4 版。如果我是你,我不会直接打电话给f77,而是直接打电话给gfortran

在其他一些编译器中类似于-native 的正确gfortran 选项是-march=native-mtune=native。见manualGCC: how is march different from mtune?

不要忘记使用其他优化标志,例如 -O2-O3。单独的 native 选项并不太有用。

【讨论】:

  • 不幸的是,这不是本网站的运作方式。读取How to Askminimal reproducible example 的食物。您必须描述您的错误并给出重现错误的步骤在问题本身中。如果它们是新错误,您应该提出一个新问题
猜你喜欢
  • 1970-01-01
  • 2019-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多