使用 ifort 编译 OpenMPI 时出错

使用 ifort 编译 OpenMPI 时出错

我正在尝试编译OpenMPI 1.10.2使用Intel Fortran 编译器(ifort)以图形界面安装。配置时

sudo ./configure FC="ifort" 

(按照 README 的要求设置不同的编译器)我收到以下错误

    *** Fortran compiler
checking whether we are using the GNU Fortran compiler... no
checking whether ifort accepts -g... no
checking whether ln -s works... yes
checking if Fortran compiler works... no
**********************************************************************
* It appears that your Fortran compiler is unable to produce working
* executables.  A simple test application failed to properly
* execute.  Note that this is likely not a problem with Open MPI,
* but a problem with the local compiler installation.  More
* information (including exactly what command was given to the
* compiler and what error resulted when the command was executed) is
* available in the config.log file in the Open MPI build directory.
**********************************************************************
configure: error: Could not run a simple Fortran program.  Aborting.

看着配置日志文件我读过这个:

 configure:32556: checking if Fortran compiler works
configure:32585: ifort -o conftest /opt/intel/bin/   conftest.f  >&5
./configure: line 4835: ifort: command not found
configure:32585: $? = 127
configure: program exited with status 127
configure: failed program was:
|       program main
| 
|       end
configure:32601: result: no
configure:32615: error: Could not run a simple Fortran program.  Aborting.

所以我尝试单独运行 ifort,它成功了。此外,我找不到conftest.f文件。

与 icc(Intel c++ 编译器)有同样的问题。

我认为有一些路径可以放入,但不知道如何放入。

答案1

是的,你ifort应该在PATH

export PATH=<path_to_your_ifort_binary>:$PATH
sudo ./configure FC="ifort"

更改<path_to_your_ifort_binary>为真实目录。

另一种方式是,英特尔编译器有一个脚本文件,ifortvars.sh它可以为您处理所有变量。考虑到这是安装英特尔编译器的目录,请将以下内容添加到您的~/.bashrc

source <install-dir>/bin/ifortvars.sh intel64

第三种尝试的方法是使用compilervars.shIntel Composer。请看这里。

相关内容