并行安装 CMAQ
Edited by Guo Yakai, 2018
[***@bogon scripts]$ ifort -v
ifort version 15.0.0
[***@bogon scripts]$ uname -a
Linux bogon 4.12.9-300.fc26.x86_64 #1 SMP Fri Aug 25 13:09:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
安装CMAQ所需要的库
1. 安装mpich
a> wget http://www.mpich.org/static/downloads/3.1.4/mpich-3.1.4.tar.gz
b> tar xf mpich-3.1.4.tar.gz
c> cd mpich-3.1.4
d> ./configure --prefix=$mpichinstalldir
e> make -j 4
f> make -j 4 check
g> make -j 4 install
2. 安装netcf4+
a> tar -zxvf netcdf4.1.2.tar.gz
b> cd netcdf4.1.2
c> ./configure --prefix=$netcdfinstalldir FC=ifort CC=icc --disable-separate-fortran --disable-netcdf4 --disable-dap --enable-f77 --disable-compiler-recover --disable-cxx --disable-shared
#**这一步里的参数很重要,会影响到ioapi的编译, **#
#**具体原因请查看官方安装手册,串行安装必须的设置**#
d> make
#** 预编译**#
e> make install
#** 安装 **#
3.安装ioap3.2
-
3.1配置环境变量
# Setting compilers variables
a > vim ~/.bashrc
export CC=icc
export CXX=icpc
export FC=ifort
export F90=ifort
export F77=ifort
export PERL=/usr/bin/perl
export BIN=Linux2_x86_64ifort
# Setting code generation options
export CPPFLAGS="-O2 -DNDEBUG -DpgiFortran"
export CFLAGS="-g -O2"
export CXXFLAGS="-g -O2"
export FFLAGS='-g -O2 -mp -recursive'
b > source ~/.bashrc
-
3.2利用git下载安装包
git clone https://github.com/cjcoats/ioapi-3.2
-
进入文件目录查看并开始安装
-
配置makefile
a > vim Makefile
BIN = Linux2_x86_64ifort
BASEDIR = ${PWD}
INSTALL = ${PWD}/install
LIBINST = $(INSTALL)/$(BIN)
BININST = $(INSTALL)/$(BIN)
CPLMODE = nocpl
IOAPIDEFS =
PVMINCL = /dev/null #dev$(PVM_ROOT)/conf/$(PVM_ARCH).def
NCFLIBS = -lnetcdf
b > make configure
#Makefile:250: 警告:覆盖关于目标“/cmaqlib/ioapi3.2/Linux2_x86_64ifort的配方 ......
#**这个Makefile写的有点啰嗦,有不少重复的地方,很可能是IDE直接生成的**
... [+] mkdir -p Linux2_x86_64ifort
c> ln -fs $netcdfinstalldir/version_4.1.2/cmapnc/lib/libnetcet.a ./Linux2_x86_64ifort/
#**将libnetcdf的对应库包放入我们的安装文件夹下**#
d> vim ./ioapi/Makeinclude.Linux2_x86_64ifort
COPTFLAGS = -O2 ${MFLAGS}
FOPTFLAGS = -O2 -unroll -stack_temps -safe_cray_ptr \
e> make bins
... [+] ioap/Makefile 需修改make功能下的重复命令行
原来
bins:
make BIN=Linux2_x86_64
make BIN=Linux2_x86_64sun
make BIN=Linux2_x86_64ifort
make BIN=Linux2_x86_64dbg
make BIN=Linux2_x86_64sundbg
make BIN=Linux2_x86_64ifortdbg
修改
bins:
make BIN=Linux2_x86_64ifort
#** **#
....[+] ./m3tools/中也如此
- 注意的是,可能是机器中make的版本不同,才会出现上述需修改的问题。
4.安装lapack
a> tar -zxvf lapack-3.8.0.tar.gz
b> cp mak.inc.example make.inc
c> ulimit -s unlimited
d> make all
5.安装blas
a> tar -zxvf blas-3.8.0.tgz
b> vim make.inc
FORTRAN = ifort
OPTS = -O3
DRVOPTS = $(OPTS)
NOOPT =
LOADER = ifort
LOADOPTS =
#** **#
c> make
安装 CMAQ
-
1. 注意事项
<-- ####目录结构 -->
export CMAQ_LIB= $CMAQ_HOME/lib
export CMAQ_DATA = $CMAQ_HOME/data
a> cd $CMAQ_LIB
b> tree
.
└── x86_64
└── intel
├── ioapi
│ ├── include_files -> /opt/apps/cmaqlib/ioapi-3.2/include/ (.h and .txt)
│ ├── lib -> /opt/apps/cmaqlib/ioapi-3.2/lib/
│ └── modules -> /opt/apps/cmaqlib/ioapi-3.2/mod
├── mpi -> /opt/apps/cmaqlib/mpich-3.1.4
└── netcdf
├── include -> /opt/apps/cmaqlib/netcdf/instructor/include
└── lib -> /opt/apps/cmaqlib/netcdf/instructor/lib
10 directories, 0 files
-## **包含了netcdf ioapi mpich 等库**
-##
-
2. 配置CMAQ
# test for cmaq5.3 dirs
export CMAQ_HOME=$yourCMAQcodepath
export CMAQ_LIB=$CMAQ_HOME/x86_64/intel
export MPI_DIR=$CMAQ_LIB/mpi
export NETCDF_DIR=$CMAQ_LIB/netcdf
#export PNETCDF_DIR=$CMAQ_LIB/pnetcdf
export IOAPI_DIR=$CMAQ_LIB/ioapi
-
3. 编译MCIP
a> cd $CMAQ_HOME/PREP/mcip/src
b> vim Makefile
#...Intel Fortran
FC = ifort
NETCDF = /home/guoyk/Program/CMAQ/5.2.1/lib/x86_64/intel/netcdf
IOAPI_ROOT = /home/guoyk/Program/CMAQ/5.2.1/lib/x86_64/intel/ioapi
FFLAGS = -FR -O3 -traceback -I$(NETCDF)/include -I$(IOAPI_ROOT)/include_files
LIBS = -L$(IOAPI_ROOT)/lib -lioapi \
-L$(NETCDF)/lib -lnetcdf
c> make
-
4. 编译ICON (Note: Possibly in depence of exports in bashrc)
a> cd $CMAQ_HOME/PREP/icon/scripts
b> ./bldit_icon.csh intel
-
5. 编译BCON (Note: Possibly in depence of exports in bashrc )
a>cd $CMAQ_HOME/PREP/bco
b>bldit_bcon.csh intel
-
6. 编译CCTM (Note: Possibly in depence of ioapi/fix_src/*.txt )
a> cd $CMAQ_HOME/CCTM/scripts
b> ./bldit_cctm.csh intel
网友评论