gfortran: error: unrecognized command-line option ‘-f90=ifort’

文章描述了一个用户在尝试使用makefile编译过程中遇到的问题,mpif90命令行选项-f90/ifort未被gfortran识别。用户检查了mpif90的路径并发现它指向gfortran。解决方案包括检查模块系统、修改环境变量、更换MPI实现或直接修改makefile。文章强调了在不同编译环境中需灵活应对。
摘要由CSDN通过智能技术生成

调用gfortran而不是mpif90

我正在尝试使用makefile编译一个大型解算器!!!

1、键入make时,将执行以下命令:

mpif90 -O2 -fpp -I/somePath/ -c precision.F90

2、我得到以下错误:

gfortran: error: unrecognized command line option ‘-pf90=ifort’

3、我键入了which mpif90来查看它指向的位置:

/usr/local/openmpi/bin/mpif90

我试图手动输入该命令,以确保它与makefile没有任何关系,但我得到了同样的错误。我尝试寻找原因并解决。

解决方法:

查看版本信息:

/usr/local/openmpi/bin/mpif90 -v

显示

Using built-in specs.
COLLECT_GCC=/usr/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) 

①在超级计算机和集群上,通常可以使用模块系统在编译器和MPI库之间进行更改。尝试键入module avail;

②尝试键入gedit ~/.bashrc,添加

export I_MPI_F90=ifort

③你可以使用替代方案,更换MPI(openMPI,oneMPI,etc)

/usr/local/intel14/impi/4.1.3.048/intel64/bin/mpiifort

④修改makefile,删除unrecognized command-line option ‘-f90=ifort’中,‘ ’内的部分-f90=ifort,如下:

删除前:

FC   = mpif90 -f90=ifort -c $(FFLAGS) $(INCLUDE)
LINK = mpif90 -f90=ifort    $(FFLAGS) $(INCLUDE)

删除后:

FC   = mpif90  $(FFLAGS) $(INCLUDE)
LINK = mpif90  $(FFLAGS) $(INCLUDE)

⑤一个更永久的修复方法是在makefile或make.inc中用mpiifort替换mpif90。环境变量起到了作用,但很容易出错,因为在重新登录时可能会忘记设置它。

总而言之,不同的方法多试试,不同编译环境和计算机差别可能有些有用有些没用!!!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值