其他

ifort安装配置:在Linux系统(wsl)中安装oneAPI

2021-06-04 19:02:29 gx 124

ifort安装配置:在Linux系统(wsl)中安装oneAPI

 开发技术  开发技术  3周前 (05-04)  8次浏览

两款fortran编译器,轻量级开源的gfortran,intel出产的全能型ifort

在占用内存很高的大型程序时,除了需要足够物理内存的计算机,还需要全能型的编译器。intel出产的ifort编译器安装过程如下

 

官方网址及其介绍 https://software.intel.com/content/www/us/en/develop/tools/oneapi/all-toolkits.html#gs.0im67z

ifort安装配置:在Linux系统(wsl)中安装oneAPI

 

安装的是基础组件(base toolkit)和高性能组件(high-performance toolkit)。

基础组件安装过程:

命令行输入下载  wget https://registrationcenter-download.intel.com/akdlm/irc_nas/17769/l_BaseKit_p_2021.2.0.2883.sh

输入命令运行安装脚本  sudo bash l_BaseKit_p_2021.2.0.2883.sh

勾选:intel oneAPI Math kernel library 和 intel distribution for gdb

默认安装路径为 /opt/intel/oneapi/

跳过IDE设置  eclipse IDE configuration

 

高性能组件安装过程:

命令行输入下载  wget https://registrationcenter-download.intel.com/akdlm/irc_nas/17764/l_HPCKit_p_2021.2.0.2997.sh

输入命令运行安装脚本  sudo bash l_HPCKit_p_2021.2.0.2997.sh

勾选:intel MPI Library和 intel Fortran compiler

默认安装路径为 /opt/intel/oneapi/

跳过IDE设置  eclipse IDE configuration

 

环境变量配置:

echo -e “nn## oneAPI configuration nsource /opt/intel/oneapi/setvars.shn” >> ~/.bashrc

source ~/.bashrc

ifort -v; mpiifort -v

 

备注:

如果wsl中安装了anaconda的话,最好用vim把oneapi的环境配置放在anaconda环境配置之前,否则每次在激活conda的虚拟环境之间,需要重新source一遍才行。

可以将文件  /opt/intel/oneapi/setvars.sh  中的echo行进行注释,避免每次打开终端的时候都会显示一些内容。

编译fortran程序的语句:ifort -g -mcmodel=medium program.f -o a.out;  ./a.out  其中选项  -g  用于程序调试,报错时可以返回内存地址。 选项  -mcmodel=medium  用于扩大程序所需的内存,避免因数组过大而导致的报错。


解决方案