使用Intel编译器安装netcdf库记录

尉迟边浩
2023-12-01

使用Intel编译器安装netCDF库记录

将编译器写到env后source env

export CC=mpiicc
export CXX=mpiicpc
export FC=mpiifort
export F90=mpiifort
export F77=mpiifort
export MPIF90=mpiifort
export MPIF77=mpiifort
export MPICC=mpiicc
export MPICXX=mpiicpc

安装完每个包后添加到环境变量:
export PATH=xxx/bin:$PATH
export LD_LIBRARY_PATH=xxx/lib:$LD_LIBRARY_PATH

1 zlib, szip

简单,不再赘述

2 HDF5

https://github.com/HDFGroup/hdf5/releases
这里使用hdf5-1.8.10-patch1
解压后:

$ ./configure --prefix=$PREFIX --enable-fortran --enable-parallel --with-zlib=$ZLIBPATH --with-szlib=$SZIPPATH \
CFLAGS=-O2 -fPIC FCFLAGS=-O2 -fPIC CXXFLAGS=-O2 -fPIC  \
CPPFLAGS= -I$ZLIBPATH/include -I$SZIPPATH/include LDFLAGS= -L$ZLIBPATH/lib -L$SZIPPATH/lib LIBS= -lz -lsz

$ make; make install; make check; make distclean

3 netCDF-C

https://github.com/Unidata/netcdf-c
这里使用netcdf-c-4.3.2
解压后:

$ ./configure --prefix=$PREFIX --enable-netcdf4 --enable-extra-example-tests --enable-parallel-tests \
--enable-logging --enable-extra-tests --enable-large-file-tests \
LDFLAGS=-L$HDFPATH/lib -L$SZIPPATH/lib/ -L$ZLIBPATH/lib/ \
LIBS=-lhdf5 -lhdf5_hl -lhdf5hl_fortran -lhdf5_fortran -lz -lsz -lcurl \
CPPFLAGS=-I$HDFPATH/include -I$SZIPPATH/include -I$ZLIBPATH/include

$ make; make install; make check; make distclean

添加到$PATH后使用nc-config --all检查

4 netCDF-Fortran

https://github.com/Unidata/netcdf-fortran
这里使用netcdf-fortran-4.4.1
解压后:

$ ./configure --prefix=$PREFIX LDFLAGS=-L$HDFPATH/lib -L$SZIPPATH/lib/ -L$ZLIBPATH/lib/ -L$NETCDFPATH/lib \
LIBS=-lhdf5 -lhdf5_hl -lhdf5hl_fortran -lhdf5_fortran -lz -lsz -lcurl -lnetcdf\
CPPFLAGS=-I$HDFPATH/include -I$SZIPPATH/include -I$ZLIBPATH/include -I$NETCDFPATH/include

$ make; make install; make check; make distclean

添加到$PATH后使用nf-config --all检查

5 PnetCDF

https://parallel-netcdf.github.io/wiki/Download.html
这里使用parallel-netcdf-1.8.1
解压后:

$ ./configure --prefix=$PREFIX --enable-netcdf4 --enable-extra-example-tests --enable-parallel-tests \
--enable-logging --enable-extra-tests --enable-large-file-tests \
LDFLAGS=-L$HDFPATH/lib -L$SZIPPATH/lib/ -L$ZLIBPATH/lib/ -L$NETCDFPATH/lib \
LIBS=-lhdf5 -lhdf5_hl -lhdf5hl_fortran -lhdf5_fortran -lz -lsz -lcurl -lnetcdf -lnetcdff\
CPPFLAGS=-I$HDFPATH/include -I$SZIPPATH/include -I$ZLIBPATH/include -I$NETCDFPATH/include

$ make; make install; make check; make distclean

添加到$PATH后使用pnetcdf-config --all检查

 类似资料: