netcdf ビルドログ @ pifront

  • 作業日 2021/05/17
  • 作業者 高橋芳幸

前準備

$ export LC_CTYPE=C
$ module load compiler

.bashrc にも書いておく

準備

必要なファイルの取得

必要なファイル

  • netcdf
wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-c-4.8.0.tar.gz
wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-fortran-4.5.3.tar.gz

ビルド

ビルドは ~/tmp/netcdf で行う.

netcdf-c

展開

$ tar xvf netcdf-c-4.8.0.tar.gz

$ cd netcdf-c-4.8.0

環境変数の設定, configure, make

$ export NCDIR=$HOME/local/netcdf-c-4.8.0-fortran-4.5.3-intel

$ export CC=icc
$ export CXX=icpc
$ export CPP='icc -E'
$ export CXXCPP='icpc -E'

$ ./configure --prefix=${NCDIR}

$ make
$ make check
$ make install

netcdf-fortran

展開

$ tar xvf netcdf-fortran-4.5.3.tar.gz

$ cd netcdf-fortran-4.5.3

環境変数の設定, configure, make

$ NFDIR=${NCDIR}

$ export LD_LIBRARY_PATH=${NCDIR}/lib:${LD_LIBRARY_PATH}

$ export F77=ifort
$ export FC=ifort

$ export CPPFLAGS="-I${NCDIR}/include"
$ export LDFLAGS="-L${NCDIR}/lib"

$ ./configure --prefix=${NFDIR}

$ make check |& tee make_check.log
$ make install |& tee install.log

.bashrc の編集

$ emacs -nw ~/.bashrc

 export NCDIR=$HOME/local/netcdf-c-4.8.0-fortran-4.5.3-intel
 export LD_LIBRARY_PATH=${NCDIR}/lib:${LD_LIBRARY_PATH}
 export PATH=${NCDIR}/bin:${PATH}

参考情報

  • https://www.unidata.ucar.edu/software/netcdf/docs/netCDF-CMake.html
  • https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html