同时更新地址:http://bbs.06climate.com/forum.php?mod=viewthread&tid=93914
PNETCDF 和NETCDF安装经验分享(亲测)
第一次分享,不足支出请多包涵。
编译器 : Intel Intelmpi
我分享的版本:
zlib 1.2.11
szip 2.1
hdf5 1.10.5
pnetcdf 1.12.1
netcdf-c 4.7.3
netcdf-f 4.4.5
首先定义几个路径:
MPIPATH mpi所在路径(which mpiifort)
NETCDFPATH NETCDF自定义安装路径
整套库安装包:
链接:https://pan.baidu.com/s/1k54TBJU7EjdF0dHLSEVHsA
提取码:6plx (当然也可去官网自行下载所需)
1、zlib
env CC=“mpiicc” CFLAGS="-O2 -fPIC" CXX=“mpiicpc” CXXFLAGS="-O2 -fPIC"
./configure --prefix=/NETCDFPATH/zlib1.2.11
make
make check
make install
2、szip
env CC=“mpiicc” CFLAGS="-O2 -fPIC" CXX=“mpiicpc” CXXFLAGS="-O2 -fPIC"
./configure --prefix=/NETCDFPATH/szip2.1
make
make check
make install
3、hdf5
env CC=“mpiicc” CFLAGS="-O3 -fPIC" FC=“mpiifort” FCFLAGS="-O3 -fPIC" CXX=“mpicpc” CXXFLAGS="-O3 -fPIC" CPPFLAGS=-I/MPIPATH/include LDFLAGS="-L/MPIPATH/lib" ./configure --with-zlib=/NETCDFPATH/zlib1.2.11 --with-szlib=/NETCDFPATH/szip2.1 --prefix=/NETCDFPATH/hdf5 --enable-fortran --enable-parallel
make
make check
make install
4、pnetcdf
env CC=“mpiicc” CFLAGS="-O2 -fPIC" FC=“mpiifort” FCFLAGS="-O2 -fPIC" CXX=“mpiicpc” CXXFLAGS="-O2 -fPIC" CPPFLAGS=-I/NETCDFPATH/hdf5/include LDFLAGS= "-L/NETCDFPATH/hdf5/lib -lhdf5_hl -lhdf5 -lz -lm " ./configure --prefix=/NETCDFPATH/pnetcdf1.12.0 --with-mpi=/MPIPATH --enable-subfiling --enable-shared --enable-large-file-test --enable-null-byte-header-padding --enable-burst-buffering --enable-profiling
make
make check
make install
5、netcdf-c-4.7.3
env CC=“mpiicc” FC=“mpiifort” CXX=“mpiicpc” CPPFLAGS="-I/NETCDFPATH/hdf5/include -I/NETCDFPATH/pnetcdf1.12.0/include" LDFLAGS="-L/NETCDFPATH/hdf5/lib -lhdf5_hl -lhdf5 -lz -lm -L/NETCDFPATH/pnetcdf1.12.0/lib -lpnetcdf" ./configure --prefix=/NETCDFPATH/netcdf4.7.3 --enable-shared --enable-pnetcdf --enable-parallel-tests
make
make check
make install
此处把netcdf-c的环境变量添加到.bashrc文件中
export NETCDF=NETCDFPATH
export PATH= $ PATH: $ NETCDF/bin: $ NETCDF/include: $ NETCDF/lib: $ NETCDF/man
export LD_LIBRARY_PATH= $ LD_LIBRARY_PATH: $NETCDF/lib
export MANPATH= $MANPATH: $ NETCDF/share/man
source ~/.bashrc
6、netcdf-c-4.4.5
env CC=“mpiicc” FC=“mpiifort” CXX=“mpiicpc” CPPFLAGS="-I/NETCDFPATH/hdf5/include -I/NETCDFPATH/pnetcdf1.12.0/include -I/NETCDFPATH/netcdf4.7.3/include" LDFLAGS="-L/NETCDFPATH/hdf5/lib -lhdf5_hl -lhdf5 -lz -lm -L/NETCDFPATH/pnetcdf1.12.0/lib -lpnetcdf -L/NETCDFPATH/netcdf4.7.3/lib" ./configure --prefix=/NETCDFPATH/netcdf4.7.3 --enable-shared --enable-pnetcdf --enable-parallel-tests
make
make check
make install
都安装完成之后
source ~/.bashrc
nc-config --all 查看netcdf-c
nf-config --all 查看netcdf-f
好了,到此完成整个安装过程。
当然,我也用openmpi安装过,过程类似,注意编译器的不同表达,其他都一样。
有问题欢迎提出,旨在与大家共同进步。