从 gfortran 移植到 ifort 时出现编译错误

发布于 2024-07-25 16:32:10 字数 1222 浏览 3 评论 0原文

我正在尝试将程序从 gfortran 移植到 ifort(英特尔 Fortran 编译器 11)。 我遇到了两个仅使用 gfortran 进行编译的文件:

gfortran -x f77 -c daedrid.ff
gfortran -x f77-cpp-input -c daedris.ff

当我尝试使用这些文件运行 intel fortran 编译器时,我得到:

ifort -fpp -c daedrid.ff
ifort: warning #10147: no action performed for specified file(s)
ifort -fpp -c daedris.ff
ifort: warning #10147: no action performed for specified file(s)

并且没有创建任何对象文件。

现在,我该如何解决这个问题o_O?

编辑:将文件扩展名从 ff 重命名为 fpp

cp daedrid.ff daedrid.fpp
cp daedrid.ff daedrid.fpp

有助于:

ifort -fpp -c daedrid.fpp
daedrid.fpp(1483): (col. 9) remark: LOOP WAS VECTORIZED.
daedrid.fpp(1490): (col. 11) remark: LOOP WAS VECTORIZED.
daedrid.fpp(1499): (col. 13) remark: LOOP WAS VECTORIZED.
ifort -fpp -c daedris.fpp
daedris.fpp(1626): (col. 9) remark: LOOP WAS VECTORIZED.

http://www.rcac.purdue.edu/userinfo/resources/black/userguide.cfm#compile_fortran_cpp

更新:有没有办法让intel fortran编译器无需重命名文件即可工作?

I'm trying to port a program from gfortran to ifort (Intel Fortran Compiler 11). I'm stuck with two files that only compile with gfortran:

gfortran -x f77 -c daedrid.ff
gfortran -x f77-cpp-input -c daedris.ff

when I try to run intel fortran compiler with these files, I get:

ifort -fpp -c daedrid.ff
ifort: warning #10147: no action performed for specified file(s)
ifort -fpp -c daedris.ff
ifort: warning #10147: no action performed for specified file(s)

and no object files are created.

Now, how can I solve this problem o_O?

EDIT: Renaming the file extensions from ff to fpp

cp daedrid.ff daedrid.fpp
cp daedrid.ff daedrid.fpp

helps:

ifort -fpp -c daedrid.fpp
daedrid.fpp(1483): (col. 9) remark: LOOP WAS VECTORIZED.
daedrid.fpp(1490): (col. 11) remark: LOOP WAS VECTORIZED.
daedrid.fpp(1499): (col. 13) remark: LOOP WAS VECTORIZED.
ifort -fpp -c daedris.fpp
daedris.fpp(1626): (col. 9) remark: LOOP WAS VECTORIZED.

http://www.rcac.purdue.edu/userinfo/resources/black/userguide.cfm#compile_fortran_cpp

UPDATE: Is there a way to make the intel fortran compiler work without having to rename the files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稚气少女 2024-08-01 16:32:10

您要查找的选项是 -Tf-fpp(以及可选的 -fixed-free。从 ifort -help 中,相关行是:

-Tf<file>     compile file as Fortran source

-fpp[n]    run Fortran preprocessor on source files prior to compilation
     n=0   disable running the preprocessor, equivalent to no fpp
     n=1,2,3  run preprocessor

-[no]fixed,-FI specifies source files are in fixed format
-[no]free, -FR specifies source files are in free format

因此,总而言之,如果您有需要预处理的固定格式源,则可以使用:

ifort -fpp -fixed -Tfa.ff

编译文件 a.ff

The options you're looking for are -Tf and -fpp (and optionally -fixed or -free. From ifort -help, the relevant lines are:

-Tf<file>     compile file as Fortran source

-fpp[n]    run Fortran preprocessor on source files prior to compilation
     n=0   disable running the preprocessor, equivalent to no fpp
     n=1,2,3  run preprocessor

-[no]fixed,-FI specifies source files are in fixed format
-[no]free, -FR specifies source files are in free format

So, all in all, if you have fixed-form source which needs preprocessing, you would use:

ifort -fpp -fixed -Tfa.ff

to compile file a.ff.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文