赞
踩
这次是在学院超算上配置cesm的运行环境,由于有上一次的记录:CESM移植记录 可以参考,同时由于多次安装相比以前对cesm需求的环境又有了更深的认识,因此更新一下之前的记录,补充之前比较模糊的一些细节。
这次用到的编译器的并行运算是超算上自带的,因此直接导入就行,不需要自己安装。
编译器:intel编译器
并行运算:mpi
module load compiler/2021.3.0
module load mpi/2021.3.0
安装包存放路径是 /share/home/dq060/install_software/install_cesm/
安装目录是 /share/home/dq060/software/libcesm/
源代码存放目录是 /share/home/dq060/model/cesm
其中,/share/home/dq060
是我账号的home目录,请自行进行替换。
注意:在安装之前可能需要退出anaconda的虚拟环境,我在安装时遇到过由于(似乎)存在python3的问题导致perl的一些模块和cmake的安装失败
另注:以前安装时以为git和svn是必须的,因此花了很多时间安装svn,但后来发现git和svn只是用来下载cesm的源码的,如果已经有完整源码了,就无需安装这两个软件了,在最后把我下载好的4个版本的cesm源码打包分享出来,只要直接解压就可以用了。
perl5 这次的安装与之前有较多的补充,为了区分,把 perl5 的版本升级成了 5.36.1,安装包可以自行在GitHub下载,或者用回之前的版本也行,改改脚本里的版本号就可以了。
01_perl5.sh
export CC=icc export CXX=icpc export CPP='icc -E' export CXXCPP='icpc -E' export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPPFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=ifort export FC=ifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export FCLAGS='-O3 -xHost -ip -no-prec-div -static-intel' DIR=/share/home/dq060/software/libcesm/perl5 tar -xvf perl-5.36.1.tar.gz cd perl-5.36.1 ./Configure -des -Dusethreads -Dprefix=${DIR} make make test make install
安装好了之后在 ~/.bashrc
中直接配置包括perl5在内的环境变量,这样之后安装完其他软件之后就无需重复 source ~/.bashrc
了,环境变量可参考最后的 env_cesm.sh
。不提前配置是因为安装perl5时如果存在 CPATH
变量会导致循环include带来的异常
# perl5
export PATH=/share/home/dq060/software/libcesm/perl5/bin:$PATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/perl5/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/perl5/lib:$LD_LIBRARY_PATH
用 perl --version
验证
This is perl 5, version 36, subversion 1 (v5.36.1) built for x86_64-linux-thread-multi
Copyright 1987-2023, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.
相比上次的补充
cesm 运行必须的perl模块有 Alien::LibXML、 Alien::Libxml2、 XML::LibXML,需要提前装好,否则之后开始编译 cesm 的 case 时,会报perl找不到某些模块的错。
以下过程需要网络连接,不需要网络的安装过程我自己试了一半就放弃了,太麻烦了
# 以下命令查看安装了哪些模块,可用来前后对照 # find `perl -e 'print "@INC"'` -name '*.pm' -print # find `perl -e 'print "@INC"'` -name '*.pm' -print | grep XML ##############能联网情况 # 利用cpan直接安装Alien::LibXML,会自动下载安装所有依赖模块 cpan install Alien::LibXML cpan install Alien::Libxml2 # XML::LibXML依赖于 XML::SAX cpan install XML::SAX # 手动安装XML::LibXML,因为我这里35huge_mode的test不通过,通过修改35huge_mode.t使其跳过该项测试,最终编译结果不影响使用,或者在make之后直接make install tar -xvf XML-LibXML-2.0208.tar.gz cd XML-LibXML-2.0208 perl Makefile.PL make # 修改35huge_mode.t # 把其中 # if (XML::LibXML::LIBXML_VERSION() < 20700) { # plan skip_all => "XML_PARSE_HUGE option not supported for libxml2 < 2.7.0"; # } # else { # plan tests => 5; # } # 改为 # plan skip_all => "skip this test"; # 继续进行test和install make test make install
如果不联网,需要自己在cpan官网下对应模块的安装包,再一个个手动编译安装,折腾了一下午,发现才只装了一半,而且发现中途某个包的 make test
似乎仍然需要联网,所以直接放弃了,不过大致需要的前置模块如下所示,可以参考一下:
##############不能联网情况 # 依次安装 # inc::latest cd .. tar -xvf inc-latest-0.500.tar.gz cd inc-latest-0.500 perl Makefile.PL make make test make install # MRO::Compat cd .. tar -xvf MRO-Compat-0.15.tar.gz cd MRO-Compat-0.15 perl Makefile.PL make make test make install # Params::Util cd .. tar -xvf Params-Util-1.102.tar.gz cd Params-Util-1.102 perl Makefile.PL make make test make install # Sub::Install cd .. tar -xvf Sub-Install-0.929.tar.gz cd Sub-Install-0.929 perl Makefile.PL make make test make install # Data::OptList cd .. tar -xvf Data-OptList-0.114.tar.gz cd Data-OptList-0.114 perl Makefile.PL make make test make install # Sub::Exporter cd .. tar -xvf Sub-Exporter-0.989.tar.gz cd Sub-Exporter-0.989 perl Makefile.PL make make test make install # Capture::Tiny cd .. tar -xvf Capture-Tiny-0.48.tar.gz cd Capture-Tiny-0.48 perl Makefile.PL make make test make install # Test::FailWarnings cd .. tar -xvf Test-FailWarnings-0.008.tar.gz cd Test-FailWarnings-0.008 perl Makefile.PL make make test make install # Data::Section cd .. tar -xvf Data-Section-0.200008.tar.gz cd Data-Section-0.200008 perl Makefile.PL make make test make install # Test::More::UTF8 cd .. tar -xvf Test-More-UTF8-0.05.tar.gz cd Test-More-UTF8-0.05 perl Makefile.PL make make test make install # Test::Warnings cd .. tar -xvf Test-Warnings-0.031.tar.gz cd Test-Warnings-0.031 perl Makefile.PL make make test make install # Text::Template cd .. tar -xvf Text-Template-1.61.tar.gz cd Text-Template-1.61 perl Makefile.PL make make test make install # Try::Tiny cd .. tar -xvf Try-Tiny-0.31.tar.gz cd Try-Tiny-0.31 perl Makefile.PL make make test make install # Software::License cd .. tar -xvf Software-License-0.104004.tar.gz cd Software-License-0.104004 perl Makefile.PL make make test make install # Module::Build cd .. perl Makefile.PL make make test make install # Importer cd .. tar -xvf Importer-0.026.tar.gz cd Importer-0.026 perl Makefile.PL make make test make install # Term::Table cd .. tar -xvf Term-Table-0.016.tar.gz cd Term-Table-0.016 perl Makefile.PL make make test make install # Test2::V0 cd .. tar -xvf Test2-Suite-0.000155.tar.gz cd Test2-Suite-0.000155 perl Makefile.PL make make test make install # Test::Fatal cd .. tar -xvf Test-Fatal-0.017.tar.gz cd Test-Fatal-0.017 perl Makefile.PL make make test make install # Test::Needs cd .. tar -xvf Test-Needs-0.002010.tar.gz cd Test-Needs-0.002010 perl Makefile.PL make make test make install # URI::file cd .. tar -xvf URI-5.19.tar.gz cd URI-5.19 perl Makefile.PL make make test make install # File::chdir cd .. tar -xvf File-chdir-0.1011.tar.gz cd File-chdir-0.1011 perl Makefile.PL make make test make install # Sort::Versions tar -xvf Sort-Versions-1.62.tar.gz cd Sort-Versions-1.62 perl Makefile.PL make make test make install # Path::Tiny cd .. tar -xvf Path-Tiny-0.144.tar.gz cd Path-Tiny-0.144 perl Makefile.PL make make test make install # Archive::Extract cd .. tar -xvf Archive-Extract-0.88.tar.gz cd Archive-Extract-0.88 perl Makefile.PL make make test make install # File::Which cd .. tar -xvf File-Which-1.27.tar.gz cd File-Which-1.27 perl Makefile.PL make make test make install # FFI::CheckLib cd .. tar -xvf FFI-CheckLib-0.31.tar.gz cd FFI-CheckLib-0.31 perl Makefile.PL make make test make install # Alien::Base cd .. tar -xvf Alien-Build-2.80.tar.gz cd Alien-Build-2.80 perl Makefile.PL make make test make install # Shell::Guess cd .. tar -xvf Shell-Guess-0.09.tar.gz cd Shell-Guess-0.09 perl Makefile.PL make make test make install # Shell::Config::Generate cd .. tar -xvf Shell-Config-Generate-0.34.tar.gz cd Shell-Config-Generate-0.34 perl Makefile.PL make make test make install # Alien::Base::ModuleBuild cd .. tar -xvf Alien-Base-ModuleBuild-1.17.tar.gz cd Alien-Base-ModuleBuild-1.17 perl Build.PL ./Build ./Build test ./Build install # Alien:LibXML tar -xvf Alien-LibXML-0.004.tar.gz cd Alien-LibXML-0.004 perl Build.PL ./Build # 这一步似乎要联网下载libxml2,看看后续怎么改 ./Build test ./Build install # Alien::Build::Plugin::Download::GitLab cd .. tar -xvf Alien-Build-Plugin-Download-GitLab-0.01.tar.gz cd Alien-Build-Plugin-Download-GitLab-0.01 perl Makefile.PL make make test make install # Mozilla::CA cd .. tar -xvf Mozilla-CA-20221114.tar.gz cd Mozilla-CA-20221114 perl Makefile.PL make make test make install # Net::SSLeay cd .. tar -xvf Net-SSLeay-1.92.tar.gz cd Net-SSLeay-1.92 # IO::Socket::SSL cd .. tar -xvf IO-Socket-SSL-2.083.tar.gz cd IO-Socket-SSL-2.083 # Alien::Libxml2 cd .. tar -xvf Alien-Libxml2-0.19.tar.gz cd Alien-Libxml2-0.19 # XML::LibXML,修改35huge_mode.t使其跳过该项测试 cd .. tar -xvf XML-LibXML-2.0208.tar.gz cd XML-LibXML-2.0208
==下面的软件安装均和以前一样,不展开了,细节可参考 CESM移植记录 ==
02_cmake.sh
export CC=icc export CXX=icpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=ifort export FC=ifort export F90=ifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' DIR=/share/home/dq060/software/libcesm/cmake tar -xvf cmake-2.8.12.2.tar.gz cd cmake-2.8.12.2 ./bootstrap --prefix=${DIR} make make install
配置cmake环境变量。
# cmake
export PATH=/share/home/dq060/software/libcesm/cmake/bin:$PATH
用 cmake --version
验证
cmake version 2.8.12.2
04_zlib.sh
export CC=icc export CXX=icpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=ifort export FC=ifort export F90=ifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' DIR=/share/home/dq060/software/libcesm/zlib tar -xvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure --prefix=${DIR} make make check make install
配置 zlib 环境变量。
# zlib
export CPATH=/share/home/dq060/software/libcesm/zlib/include:$CPATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/zlib/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/zlib/lib:$LD_LIBRARY_PATH
05_hdf5.sh
export CC=mpiicc export CXX=mpiicpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=mpiifort export FC=mpiifort export F90=mpiifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' DIR=/share/home/dq060/software/libcesm/hdf5 tar -xvf hdf5-1.10.4.tar.gz cd hdf5-1.10.4 ./configure --with-zlib=/share/home/dq060/software/libcesm/zlib --prefix=${DIR} --enable-fortran --enable-fortran2003 -enable-parallel --with-pic make make check make install
配置 hdf5 环境变量。
# hdf5
export PATH=/share/home/dq060/software/libcesm/hdf5/bin:$PATH
export CPATH=/share/home/dq060/software/libcesm/hdf5/include:$CPATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/hdf5/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/hdf5/lib:$LIBRARY_PATH
06_pnetcdf.sh
export CC=mpiicc export CXX=mpiicpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel -fPIC' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel -fPIC' export F77=mpiifort export FC=mpiifort export F90=mpiifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel -fPIC' export CPP='mpiicc -E' export CXXCPP='mpiicpc -E' DIR=/share/home/dq060/software/libcesm/pnetcdf tar -xvf pnetcdf-1.12.0.tar.gz cd pnetcdf-1.12.0 ./configure --prefix=${DIR} --enable-relax-coord-bound make make check make install
配置 pnetcdf 环境变量
# pnetcdf
export PATH=/share/home/dq060/software/libcesm/pnetcdf/bin:$PATH
export CPATH=/share/home/dq060/software/libcesm/pnetcdf/include:$CPATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/pnetcdf/lib:$LD_LIBRARY_PATH
export MANPATH=/share/home/dq060/software/libcesm/pnetcdf/share/man:$MANPATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/pnetcdf/lib:$LIBRARY_PATH
07_netcdf_c.sh
export CC=mpiicc export CXX=mpiicpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=mpiifort export FC=mpiifort export F90=mpiifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' export CPPFLAGS='-I/share/home/dq060/software/libcesm/hdf5/include -I/share/home/dq060/software/libcesm/pnetcdf/include' export LDFLAGS='-L/share/home/dq060/software/libcesm/hdf5/lib -L/share/home/dq060/software/libcesm/pnetcdf/lib' DIR=/share/home/dq060/software/libcesm/netcdf tar -xvf netcdf-c-4.7.4.tar.gz cd netcdf-c-4.7.4 ./configure --prefix=${DIR} --enable-pnetcdf --disable-dap make make check make install
配置 netcdf 环境变量。
# netcdf
export PATH=/share/home/dq060/software/libcesm/netcdf/bin:$PATH
export CPATH=/share/home/dq060/software/libcesm/netcdf/include:$CPATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/netcdf/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/netcdf/lib:$LD_LIBRARY_PATH
export MANPATH=/share/home/dq060/software/libcesm/netcdf/share/man:$MANPATH
用 nc-config --all
验证
This netCDF 4.7.4 has been built with the following features: --cc -> mpiicc --cflags -> -I/share/home/dq060/software/libcesm/netcdf/include -I/share/home/dq060/software/libcesm/hdf5/include -I/share/home/dq060/software/libcesm/pnetcdf/include --libs -> -L/share/home/dq060/software/libcesm/netcdf/lib -lnetcdf --static -> -lpnetcdf -lhdf5_hl -lhdf5 -lm -lz --has-c++ -> no --cxx -> --has-c++4 -> no --cxx4 -> --has-fortran -> yes --fc -> mpiifort --fflags -> -I/share/home/dq060/software/libcesm/netcdf/include -I/share/home/dq060/software/libcesm/netcdf/include --flibs -> -L/share/home/dq060/software/libcesm/netcdf/lib -lnetcdff --has-f90 -> --has-f03 -> yes --has-dap -> no --has-dap2 -> no --has-dap4 -> no --has-nc2 -> yes --has-nc4 -> yes --has-hdf5 -> yes --has-hdf4 -> no --has-logging -> no --has-pnetcdf -> yes --has-szlib -> no --has-cdf5 -> yes --has-parallel4 -> yes --has-parallel -> yes --prefix -> /share/home/dq060/software/libcesm/netcdf --includedir -> /share/home/dq060/software/libcesm/netcdf/include --libdir -> /share/home/dq060/software/libcesm/netcdf/lib --version -> netCDF 4.7.4
注意,两个要装在同一目录下
参数中除了之前的 hdf5 和 pnetcdf 外,还要带上上一步的 netcdf-c。
08_netcdf_f.sh
export CC=mpiicc export CXX=mpiicpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=mpiifort export FC=mpiifort export F90=mpiifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' export CFLAGS=$(nc-config --cflags) export CPPFLAGS='-I/share/home/dq060/software/libcesm/netcdf/include -I/share/home/dq060/software/libcesm/hdf5/include -I/share/home/dq060/software/libcesm/pnetcdf/include' export LDFLAGS='-L/share/home/dq060/software/libcesm/netcdf/lib -L/share/home/dq060/software/libcesm/hdf5/lib -L/share/home/dq060/software/libcesm/pnetcdf/lib' DIR=/share/home/dq060/software/libcesm/netcdf tar -xvf netcdf-fortran-4.5.3.tar.gz cd netcdf-fortran-4.5.3 ./configure --prefix=${DIR} --enable-pnetcdf make make check make install
验证 nf-config --all
This netCDF-Fortran 4.5.3 has been built with the following features: --cc -> mpiicc --cflags -> -I/share/home/dq060/software/libcesm/netcdf/include -I/share/home/dq060/software/libcesm/netcdf/include -I/share/home/dq060/software/libcesm/hdf5/include -I/share/home/dq060/software/libcesm/pnetcdf/include --fc -> mpiifort --fflags -> -I/share/home/dq060/software/libcesm/netcdf/include -I/share/home/dq060/software/libcesm/netcdf/include --flibs -> -L/share/home/dq060/software/libcesm/netcdf/lib -lnetcdff --has-f90 -> --has-f03 -> yes --has-nc2 -> yes --has-nc4 -> yes --prefix -> /share/home/dq060/software/libcesm/netcdf --includedir-> /share/home/dq060/software/libcesm/netcdf/include --version -> netCDF-Fortran 4.5.3
这两个是线性代数的计算包。
blas包含在lapack的安装包内,但默认不编译,所以要修改 Makefile
文件让它编译。
如下面注释所示,然后通过 make
安装,再进入到LAPACKE
文件夹中再 make
一次,最后把产生的 .h
文件和 .a
文件都放到安装目录里面就可以了。
09_lapack_blas.sh
export CC=icc export CXX=icpc export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export F77=ifort export FC=ifort export F90=ifort export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' export CPP='icc -E' export CXXCPP='icpc -E' DIR=/share/home/dq060/software/libcesm/lapack tar -xvf lapack-3.10.1.tar.gz cd lapack-3.10.1 cp INSTALL/make.inc.ifort make.inc # 修改Makefile文件使其编译blas sed -i '12s/^/#/g' Makefile sed -i '13s/#//g' Makefile # /******************************************************************* # .PHONY: lib # lib: lapacklib tmglib # #lib: blaslib variants lapacklib tmglib # 变成 # .PHONY: lib # #lib: lapacklib tmglib # lib: blaslib variants lapacklib tmglib # *******************************************************************/ make cd LAPACKE make mkdir ${DIR} mkdir ${DIR}/include mkdir ${DIR}/lib cp include/*.h ${DIR}/include/ cd .. cp *.a ${DIR}/lib/ make cd LAPACKE make mkdir ${DIR} mkdir ${DIR}/include mkdir ${DIR}/lib cp include/*.h ${DIR}/include/ cd .. cp *.a ${DIR}/lib/
配置环境变量
# lapack
export CPATH=/share/home/dq060/software/libcesm/lapack/include:$CPATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/lapack/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/lapack/lib:$LIBRARY_PATH
10. esmf
同以前一样,不过因为对比了两个版本 esmf 的不同而修改了下安装路径,参考了许多帖子之后还是选择了比较旧的 esmf 7.1.0
10_esmf.sh
ESMF_HOME=/share/home/dq060/software/libcesm/esmf_7_1_0/esmf-ESMF_7_1_0r export ESMF_DIR=$ESMF_HOME export ESMF_COMM=intelmpi export ESMF_COMPILER=intel export ESMF_ABI=64 export ESMF_INSTALL_PREFIX=/share/home/dq060/software/libcesm/esmf_7_1_0/install export ESMF_NETCDF_INCLUDE=/share/home/dq060/software/libcesm/netcdf/include export ESMF_NETCDF_LIBPATH=/share/home/dq060/software/libcesm/netcdf/lib export ESMF_NETCDF_LIBS="-lnetcdf -lnetcdff" export ESMF_CCOMPILER="mpiicc -cc=icc" export ESMF_CXXCOMPILER=mpiicpc export ESMF_CXXLINKER=mpiicpc export ESMF_F90COMPILER=mpiifort export ESMF_F90LINKER=mpiifort unzip esmf-ESMF_7_1_0r.zip -d /share/home/dq060/software/libcesm/esmf_7_1_0/ cd $ESMF_DIR make make check make install
配置环境变量
# esmf
export PATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/bin/binO/Linux.intel.64.intelmpi.default:$PATH
export CPATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/include:$CPATH
export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/lib/libO/Linux.intel.64.intelmpi.default:$LD_LIBRARY_PATH
export LIBRARY_PATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/lib/libO/Linux.intel.64.intelmpi.default:$LIBRARY_PATH
我把 cesm 的运行环境的环境变量放在软件安装目录下的一个shell脚本里面,这样只要每次登录后 source
一下该脚本即可。
位置: /share/home/dq060/software/libcesm/env_cesm.sh
env_cesm.sh
# compiler and mpi module load compiler/2021.3.0 module load mpi/2021.3.0 # perl5 export PATH=/share/home/dq060/software/libcesm/perl5/bin:$PATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/perl5/lib:$LIBRARY_PATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/perl5/lib:$LD_LIBRARY_PATH # cmake export PATH=/share/home/dq060/software/libcesm/cmake/bin:$PATH # zlib export CPATH=/share/home/dq060/software/libcesm/zlib/include:$CPATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/zlib/lib:$LIBRARY_PATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/zlib/lib:$LD_LIBRARY_PATH # hdf5 export PATH=/share/home/dq060/software/libcesm/hdf5/bin:$PATH export CPATH=/share/home/dq060/software/libcesm/hdf5/include:$CPATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/hdf5/lib:$LD_LIBRARY_PATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/hdf5/lib:$LIBRARY_PATH # pnetcdf export PATH=/share/home/dq060/software/libcesm/pnetcdf/bin:$PATH export CPATH=/share/home/dq060/software/libcesm/pnetcdf/include:$CPATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/pnetcdf/lib:$LD_LIBRARY_PATH export MANPATH=/share/home/dq060/software/libcesm/pnetcdf/share/man:$MANPATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/pnetcdf/lib:$LIBRARY_PATH # netcdf export PATH=/share/home/dq060/software/libcesm/netcdf/bin:$PATH export CPATH=/share/home/dq060/software/libcesm/netcdf/include:$CPATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/netcdf/lib:$LIBRARY_PATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/netcdf/lib:$LD_LIBRARY_PATH export MANPATH=/share/home/dq060/software/libcesm/netcdf/share/man:/$MANPATH # lapack export CPATH=/share/home/dq060/software/libcesm/lapack/include:$CPATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/lapack/lib:$LD_LIBRARY_PATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/lapack/lib:$LIBRARY_PATH # esmf export PATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/bin/binO/Linux.intel.64.intelmpi.default:$PATH export CPATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/include:$CPATH export LD_LIBRARY_PATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/lib/libO/Linux.intel.64.intelmpi.default:$LD_LIBRARY_PATH export LIBRARY_PATH=/share/home/dq060/software/libcesm/esmf_7_1_0/install/lib/libO/Linux.intel.64.intelmpi.default:$LIBRARY_PATH
我目前使用的cesm版本为 2.1.3,这个是目前比较稳定的版本,注意,某些 compset 和 res 的搭配可能在某个版本上是可以的,但在更新版本中则要加上 --run-unsupported
这个标签才能创建 case。
源码在超算上的路径: /share/home/dq060/model/cesm/cesm_2.1.3
输入数据在超算上的路径: /share/home/dq060/model/cesm/inputdata
cesm输出在超算上的路径:/share/home/dq060/model/cesm/scratch
cesm下载好全部组件的源代码链接:
链接:https://pan.baidu.com/s/1M6l-trumaqswWw3JwSs3nA?pwd=aqyj
提取码:aqyj
然后在自己 home 目录下新建文件夹 .cime
,将以下三个配置文件放到这个目录下,用来覆盖cesm原有的配置,配置文件的含义可以参考上一篇博客,这里只指出一些新的修改和细节。
config_machines.xml
<?xml version="1.0"?> <config_machines version="2.0"> <machine MACH="daqi"> <DESC>test</DESC> <NODENAME_REGEX>ln9.*</NODENAME_REGEX> <OS>LINUX</OS> <COMPILERS>intel</COMPILERS> <MPILIBS>intelmpi</MPILIBS> <PROJECT>none</PROJECT> <CIME_OUTPUT_ROOT>$ENV{HOME}/model/cesm/scratch</CIME_OUTPUT_ROOT> <DIN_LOC_ROOT>$ENV{HOME}/model/cesm/inputdata</DIN_LOC_ROOT> <DIN_LOC_ROOT_CLMFORC>$ENV{HOME}/model/cesm/inputdata/atm/datm7</DIN_LOC_ROOT_CLMFORC> <DOUT_S_ROOT>$ENV{HOME}/model/cesm/scratch/$CASE</DOUT_S_ROOT> <BASELINE_ROOT>$ENV{HOME}/model/cesm/baselines</BASELINE_ROOT> <CCSM_CPRNC>$ENV{HOME}/model/cesm/cesm_2.1.3/cime/tools/cprnc</CCSM_CPRNC> <GMAKE>make</GMAKE> <GMAKE_J>8</GMAKE_J> <BATCH_SYSTEM>none</BATCH_SYSTEM> <SUPPORTED_BY>ouzhliang@mail2.sysu.edu.cn</SUPPORTED_BY> <MAX_TASKS_PER_NODE>48</MAX_TASKS_PER_NODE> <MAX_MPITASKS_PER_NODE>48</MAX_MPITASKS_PER_NODE> <PROJECT_REQUIRED>FALSE</PROJECT_REQUIRED> <mpirun mpilib="default"> <executable>mpirun</executable> <arguments> <arg name="num_tasks" > -n {{ total_tasks }}</arg> </arguments> </mpirun> <module_system type="none"></module_system> <environment_variables> <env name="OMP_STACKSIZE">256M</env> </environment_variables> <resource_limits> <resource name="RLIMIT_STACK">-1</resource> </resource_limits> </machine> </config_machines>
其中,
<machine>
是机器的名称,可以理解为方便模式识别的id,主要用于创建case时指定某种配置。
<CIME_OUTPUT_ROOT>
就是模式输出的数据的存放目录,这里统一将所有输出放在 $ENV{HOME}/model/cesm/scratch
这个目录下,这里的 $ENV{HOME}
是自适应的写法,会根据自己的用户目录进行替换,以前以为是不能这样用的,但看了别人的配置文件后学会了这么写,当然更简单的是直接用绝对路径。
<DIN_LOC_ROOT>
就是模式输入数据的存放目录,这里统一将所有输入文件放在 $ENV{HOME}/model/cesm/inputdata
方便不同版本的cesm共同调用。
<DOUT_S_ROOT>
就是模式最终输出数据的存放目录,这里统一将所有输出放在 $ENV{HOME}/model/cesm/scratch/$CASE
中,$CASE
是创建case时的名字,模式的输出会归档到每个case下面。再详细点其实就是,在模式运行过程中的中间输出会暂时存放在该目录下的 run
文件夹,一旦运行完成,就会把所有输出分门别类地移动到其他文件夹,如 atm
表示大气模块相关的输出的存放位置; rest
表示模式重启所需的重启动文件的存放位置。
<MAX_TASKS_PER_NODE>
和<MAX_MPITASKS_PER_NODE>
就是模式在单个节点使用的最大核数,按照超算的数据填写即可。
config_compilers.xml
<?xml version="1.0"?> <config_compilers version="2.0"> <compiler COMPILER="intel" MACH="daqi"> <CPPDEFS> <append>-DLINUX</append> </CPPDEFS> <LDFLAGS> <append compile_threaded="TRUE"> -fopenmp </append> <!-- <append> -mkl </append> --> </LDFLAGS> <CFLAGS> <append DEBUG="FALSE"> -O2 </append> </CFLAGS> <CONFIG_ARGS> <base> --host=Linux </base> </CONFIG_ARGS> <FFLAGS> <append DEBUG="FALSE"> -O2 </append> </FFLAGS> <SCC>/share/apps/lico/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/icc</SCC> <SCXX>/share/apps/lico/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/icpc</SCXX> <SFC>/share/apps/lico/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/ifort</SFC> <MPICC>/share/apps/lico/intel/oneapi/mpi/2021.3.0/bin/mpiicc</MPICC> <MPICXX>/share/apps/lico/intel/oneapi/mpi/2021.3.0/bin/mpiicpc</MPICXX> <MPIFC>/share/apps/lico/intel/oneapi/mpi/2021.3.0/bin/mpiifort</MPIFC> <ESMF_LIBDIR>/share/home/dq060/software/libcesm/esmf_7_1_0/install/lib/libO/Linux.intel.64.intelmpi.default</ESMF_LIBDIR> <MPI_PATH>/share/apps/lico/intel/oneapi/mpi/2021.3.0/bin</MPI_PATH> <NETCDF_PATH>/share/home/dq060/software/libcesm/netcdf</NETCDF_PATH> <PNETCDF_PATH>/share/home/dq060/software/libcesm/pnetcdf</PNETCDF_PATH> <SLIBS> <append>-L/share/home/dq060/software/libcesm/netcdf/lib -lnetcdf -lnetcdff -L/share/home/dq060/software/libcesm/hdf5/lib -lhdf5 -lhdf5_hl -L/share/home/dq060/software/libcesm/zlib/lib -lz -L/share/home/dq060/software/libcesm/lapack/lib -llapack</append> </SLIBS> </compiler> </config_compilers>
其中,
<SCC>
至 <MPIFC>
的这些标签分别指各编译器的执行路径,这里可以直接用命令而不用给出完整路径,不过我为了稳妥一点还是用完整路径了。
ESMF_LIBDIR
指 esmf 的动态链接库的目录,这个标签十分重要,错误的话会导致cesm运行时报错。
<SLIBS>
里相比上次删掉了 -mkl
因为发现超算上的intel编译器似乎没有 mkl 这个功能(我也不是很动这个),报错了好几次,所以直接删掉不添加了。
注意:以上<SCC>
等标签不要分行写,即,不要写成
<SCC>
/share/apps/lico/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/icc
</SCC>
不然会在编译过程中会报错在make文件里发现了不合适的分隔符,原因就是这里的换行符也会被直接传进去make文件里
config_batchs.xml
<?xml version="1.0"?>
<config_batch version="2.0">
<batch_system MACH="daqi" type="none" >
</batch_system>
</config_batch>
因为最近在跑 WACCM-X 的原因,重装了cesm很多次来排查问题,所以安装基本上能碰到的坑都踩了一遍了,这次也正好记录下来供大家参考一下。csdn的私信我不是经常看,如果文中有错误的地方或者有写不清楚的地方的话,可以发邮件给我大家一起讨论~
我的邮箱:ouzhliang@mail2.sysu.edu.cn
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。