docker ps -s -a # 显示已安装的容器
docker start intel-env # 启动容器
docker exec -it <容器名或容器ID> /bin/bash # 进入
docker stop intel-env # 终止已安装的容器
docker rm intel-env # 删除容器
- 在 PowerShell 或 Terminal 用:虚拟unbutu20.04环境
并挂载"F:\1-WPS同步\env:/opt/env"文件夹
docker run -it --name fvcom-intel-clean -v "F:\1-WPS同步\env:/opt/env" ubuntu:20.04 bash
注意:挂载目录只能在一开始创建容器时挂载,后面不能更改了
ls /opt/env
apt update && apt install -y \
wget curl vim nano \
build-essential gfortran m4 cmake \
zlib1g-dev libcurl4-openssl-dev \
git unzip
- 安装intel编译器
./l_HPCKit_p_2021.3.0.3230_offline.sh -a -s --eula accept
source /opt/intel/oneapi/setvars.sh
which icc
- 安装nc-4
zlib
cd opt
wget https://zlib.net/fossils/zlib-1.2.13.tar.gz
tar -xzf zlib-1.2.13.tar.gz
cd zlib-1.2.13
CC=icc CXX=icpc FC=ifort F77=ifort ./configure --prefix=/opt/netcdf-intel
make -j4
make install
hdf5
cd opt
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz
tar -xzf hdf5-1.12.2.tar.gz
cd hdf5-1.12.2
CC=icc CXX=icpc FC=ifort F77=ifort ./configure \
--prefix=/opt/netcdf-intel \
--with-zlib=/opt/netcdf-intel \
--enable-fortran \
--disable-shared
make -j4
make install
添加环境变量
export LD_LIBRARY_PATH=/opt/netcdf-intel/lib:$LD_LIBRARY_PATH
export CPPFLAGS="-I/opt/netcdf-intel/include"
export LDFLAGS="-L/opt/netcdf-intel/lib"
nc-c
cd /opt
wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz
tar -xzf netcdf-c-4.9.2.tar.gz
cd netcdf-c-4.9.2
CPPFLAGS="-I/opt/netcdf-intel/include"
LDFLAGS="-L/opt/netcdf-intel/lib"
CC=icc ./configure \
--prefix=/opt/netcdf-intel \
--disable-dap \
--disable-shared \
--disable-libxml2
make -j4
make install
nc-f
vim ~/.bashrc
export LD_LIBRARY_PATH=/opt/netcdf-intel/lib:$LD_LIBRARY_PATH
export CPPFLAGS="-I/opt/netcdf-intel/include"
export LDFLAGS="-L/opt/netcdf-intel/lib"
export LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz"
export CPPFLAGS="$(/opt/netcdf-intel/bin/nc-config --cflags)"
export LDFLAGS="$(/opt/netcdf-intel/bin/nc-config --libs)"
export LD_LIBRARY_PATH=/opt/netcdf-intel/lib:$LD_LIBRARY_PATH
source ~/.bashrc
cd /opt
wget https://downloads.unidata.ucar.edu/netcdf-fortran/4.6.0/netcdf-fortran-4.6.0.tar.gz
tar -xzf netcdf-fortran-4.6.0.tar.gz
cd netcdf-fortran-4.6.0
CC=icc FC=ifort ./configure \
--prefix=/opt/netcdf-intel \
--disable-shared
make -j4
make install
最后,可以export一下nc的相关环境变量
source /opt/intel/oneapi/setvars.sh
export LD_LIBRARY_PATH=/opt/netcdf-intel/lib:$LD_LIBRARY_PATH
export NETCDF=/opt/netcdf-intel
export PATH=$NETCDF/bin:$PATH