如何使用PGI pgfortran链接和编译模块?编辑:这是关于假设的等级特征

问题描述 投票:0回答:1

我正在使用npy_for_fortran将2D数组保存为python numpy .npy格式。我将一个npy.f90文件复制到当前目录,在开头添加use m_npy行,并在call save_npy(filename_str,array)中添加以array格式保存fortran .npy

我在Ubuntu OS bash终端中使用以下命令进行编译,如here所述:>

gfortran -ffree-form -c npy.f90 my_code.f
gfortran npy.o my_code.o -o a.out

我运行a.out

现在,如何用PGI's pgfortran做同样的事情?如果仅将gfortran替换为pgfortran,并将-ffree-form标记替换为-Mfree,则我不会获得任何.o文件,也不会获得任何a.out文件。

有人可以帮我用pgfortran做同样的事情吗?预先感谢。

编辑:

输出消息
happy@pop-os:~/Desktop/tmp$ pgfortran -v -Mfree -c npy.f90 mycode.f
Export PGI_CURR_CUDA_HOME=/home/happy/my_bin/linux86-64-llvm/2019/cuda/
Export PGI=/home/happy/my_bin
npy.f90:

/home/happy/my_bin/linux86-64-llvm/19.10/bin/pgf901-llvm npy.f90 -opt 1 -nostatic -x 19 0x400000 -quad -x 59 4 -x 15 2 -x 49 0x400004 -x 51 0x20 -x 57 0x4c -x 58 0x10000 -x 124 0x1000 -tp haswell -x 57 0xfb0000 -x 58 0x78031040 -x 47 0x08 -x 48 4608 -x 49 0x100 -stdinc /home/happy/my_bin/linux86-64-llvm/19.10/include-gcc70:/home/happy/my_bin/linux86-64-llvm/19.10/include:/usr/lib/gcc/x86_64-linux-gnu/9/include:/usr/local/include:/usr/include/x86_64-linux-gnu:/usr/include -cmdline '+pgfortran npy.f90 -v -Mfree -c' -def unix -def __unix -def __unix__ -def linux -def __linux -def __linux__ -def __NO_MATH_INLINES -def __LP64__ -def __x86_64 -def __x86_64__ -def __LONG_MAX__=9223372036854775807L -def '__SIZE_TYPE__=unsigned long int' -def '__PTRDIFF_TYPE__=long int' -def __amd64 -def __amd64__ -def __k8 -def __k8__ -def __MMX__ -def __SSE__ -def __SSE2__ -def __SSE3__ -def __SSSE3__ -def __PGLLVM__ -def __extension__= -freeform -vect 48 -x 54 1 -x 70 0x40000000 -x 195 0x8000 -x 70 0x40000000 -x 68 0x1 -y 163 0xc0000000 -x 189 0x10 -freeform -stbfile /tmp/pgfortranB7GGrMytczLF.stb -modexport /tmp/pgfortranZ7GGzy9hSI0F.cmod -modindex /tmp/pgfortranl7GGHBiTp5v_.cmdx -output /tmp/pgfortrand7GGj9WNwCEi.ilm
  0 inform,   0 warnings,   0 severes, 0 fatal for m_npy
PGF90-S-0155-IGNORE_TKR may not be specified for str (npy.f90)
  0 inform,   0 warnings,   1 severes, 0 fatal for dict_str
PGF90-S-0155-IGNORE_TKR may not be specified for str (npy.f90)
PGF90-S-0155-IGNORE_TKR may not be specified for fin_str (npy.f90)
  0 inform,   0 warnings,   2 severes, 0 fatal for shape_str
PGF90/x86-64 Linux 19.10-0: compilation completed with severe errors
pgfortran-Fatal-f901 completed with exit code 1

mycode.f:

/home/happy/my_bin/linux86-64-llvm/19.10/bin/pgf901-llvm mycode.f -opt 1 -nostatic -x 19 0x400000 -quad -x 59 4 -x 15 2 -x 49 0x400004 -x 51 0x20 -x 57 0x4c -x 58 0x10000 -x 124 0x1000 -tp haswell -x 57 0xfb0000 -x 58 0x78031040 -x 47 0x08 -x 48 4608 -x 49 0x100 -stdinc /home/happy/my_bin/linux86-64-llvm/19.10/include-gcc70:/home/happy/my_bin/linux86-64-llvm/19.10/include:/usr/lib/gcc/x86_64-linux-gnu/9/include:/usr/local/include:/usr/include/x86_64-linux-gnu:/usr/include -cmdline '+pgfortran mycode.f -v -Mfree -c' -def unix -def __unix -def __unix__ -def linux -def __linux -def __linux__ -def __NO_MATH_INLINES -def __LP64__ -def __x86_64 -def __x86_64__ -def __LONG_MAX__=9223372036854775807L -def '__SIZE_TYPE__=unsigned long int' -def '__PTRDIFF_TYPE__=long int' -def __amd64 -def __amd64__ -def __k8 -def __k8__ -def __MMX__ -def __SSE__ -def __SSE2__ -def __SSE3__ -def __SSSE3__ -def __PGLLVM__ -def __extension__= -nofreeform -vect 48 -x 54 1 -x 70 0x40000000 -x 195 0x8000 -x 70 0x40000000 -x 68 0x1 -y 163 0xc0000000 -x 189 0x10 -freeform -stbfile /tmp/pgfortran77GGX0Qc9YSv.stb -modexport /tmp/pgfortrant7GG5AHHUZit.cmod -modindex /tmp/pgfortranR7GGbYmdj1kO.cmdx -output /tmp/pgfortranJ7GGP3RNrkVW.ilm
PGF90-S-0155-IGNORE_TKR may not be specified for str (mycode.f)
PGF90-S-0155-IGNORE_TKR may not be specified for fin_str (mycode.f)
  0 inform,   0 warnings,   2 severes, 0 fatal for julia_set_complex_polinomial
PGF90/x86-64 Linux 19.10-0: compilation completed with severe errors
pgfortran-Fatal-f901 completed with exit code 1

Unlinking /tmp/pgfortrand7GGj9WNwCEi.ilm
Unlinking /tmp/pgfortranB7GGrMytczLF.stb
Unlinking /tmp/pgfortranZ7GGzy9hSI0F.cmod
Unlinking /tmp/pgfortranl7GGHBiTp5v_.cmdx
Unlinking /tmp/pgfortranJ7GGP3RNrkVW.ilm
Unlinking /tmp/pgfortran77GGX0Qc9YSv.stb
Unlinking /tmp/pgfortrant7GG5AHHUZit.cmod
Unlinking /tmp/pgfortranR7GGbYmdj1kO.cmdx
            

我正在使用npy_for_fortran将2D数组保存为python numpy .npy格式。我将一个npy.f90文件复制到当前目录,在开头添加一行,使用m_npy并调用save_npy(filename_str,...

fortran gfortran pgi
1个回答
0
投票

标题具有误导性,因为用于编译和链接的方法很好。实际错误是因为正在编译的代码正在使用PGI尚不支持的Fortran新功能(假定等级)。您或者只需要为此项目使用gfortran,或者将源代码更新为不使用假设等级。

© www.soinside.com 2019 - 2024. All rights reserved.