Navigation : Top/Linux/netcdf for Linux

  • 追加された行はこの色です。
  • 削除された行はこの色です。
netcdfをLinuxにインストールする.
netcdf-4.2.xより,CとFORTRANでファイルがわかれた.
netcdf-4.2.xより,CとFORTRANでパッケージが分離された.

* 前提条件 [#x4e7cbe3]
- Compiler
-- Intel composer (C and Fortan)
- 各種libraryがインストール済み
-- zlib, szip, jpeg, hdf5
** Compiler [#xa0fe86a]
- GNU C, gfortran
- Intel composer (C and Fortran)
- PGI

**  各種libraryがインストール済み [#nb3bd9b6]
*** 必要なlibrary [#f7a0c2bb]
- zlib
-- http://www.zlib.net/
- szip
-- https://www.hdfgroup.org/doc_resource/SZIP/
- jpeglib
-- http://www.ijg.org/
- hdf5
-- https://www.hdfgroup.org/HDF5/
*** 手順 [#h078e09a]
- 基本 ./configure make, make test, make install
- path
-- PATH, LD_LIBRARY_PATH, C_INCLUDE_PATH




* インストール [#i15d19bb]
** C [#p52d842c]
- 環境設定
// export HDFROOT="/usr/local/hdf5-1.8.9"
// export LD_LIBRARY_PATH="${HDFROOT}/lib:${LD_LIBRARY_PATH}"
// export LDFLAGS="-L${HDFROOT}/lib -I${HDFROOT}/include"
// export OPTIM="-O3 -xAVX -fma -mcmodel=large"
 export CC=icc
 export CXX=icpc
** C [#m10b1974]
*** Download [#v56bf06f]
- 4.7.3
- https://www.unidata.ucar.edu/downloads/netcdf/
- https://github.com/Unidata/netcdf-c

*** 環境設定 [#s6268dba]
- GNU
 export FORT=gfortran
 export FC=gfortran
 export CC=gcc
 export CPP=
 export CXX=
- Intel
 export FORT=ifort
 export FC=ifort
 export F77=ifort
 export F90=ifort
// export CFLAGS=" ${OPTIM}"
// export CXXFLAGS=" ${OPTIM}"
// export FCFLAGS=" ${OPTIM}"
// export F77FLAGS=" ${OPTIM}"
// export F90FLAGS=" ${OPTIM}"
// export CPP='icc -E -mcmodel=large'
// export CXXCPP='icpc -E -mcmodel=large'
// export CPPFLAGS="-DNDEBUG -DpgiFortran ${LDFLAGS}"
- 設定
 ./configure --prefix=/opt/netcdf4-ifort \
 --disable-shared --enable-netcdf-4 --enable-dap
 export CC=icc
 export CPP=
 export CXX=icpc
- PGI
 export FORT=pgf77 
 export FC=pgf90 
 export F90=pgf90 
 export CC=pgcc 
 export CPP=
 export CXX= 


*** Compile and install [#i5de203d]
- configure
 ./configure --prefix=/opt/netcdf4-c  --disable-shared --enable-netcdf-4 
- コンパイル
 make
 make check
 make install
-- make, make check, make install

//- hdf5関係のErrorが出たら
//-- hdf5のlib, include
//--- /usr/local/lib, /usr/local/includeにコピー



** FORTRAN [#hbe26233]
- version
-- 4.4はコンパイルできなかった. 4.2については以下のとおり
- 環境設定
 export LDFLAGS="-lnetcdf -L/opt/netcdf4-ifort/lib -I/opt/netcdf4-ifort/include"
 export OPTIM="-O3 -xAVX -fma -mcmodel=large"
 export CC=icc
 export CXX=icpc
*** Download [#q39ac366]
- 4.5.0
-- CentOS6.2: 4.5.3のコンパイルは失敗 
- https://www.unidata.ucar.edu/downloads/netcdf/
- https://github.com/Unidata/netcdf-fortran

*** 環境設定 [#g2ec90a5]
# export LDFLAGS="-lnetcdf -L/opt/netcdf4-c_XXX/lib -I/opt/netcdf4-c_XXX/include"
- 共通
 GNU
 export CPPFLAGS=-I/opt/netcdf4-c_gnu/include
 export FDFLAGS=-L/opt/netcdf4-c_gnu/lib
 PGI
 export CPPFLAGS=-I/opt/netcdf4-c_pgi/include
 export FDFLAGS=-L/opt/netcdf4-c_pgi/lib
- GNU
 export FORT=gfortran
 export FC=gfortran
 export CC=gcc
 export CPP=
 export CXX=
- Intel
 export FORT=ifort
 export FC=ifort
 export F77=ifort
 export F90=ifort
 export CFLAGS=" ${OPTIM} ${LDFLAGS}"
 export CXXFLAGS=" ${OPTIM}"
 export FCFLAGS=" ${OPTIM}"
 export F77FLAGS=" ${OPTIM}"
 export F90FLAGS=" ${OPTIM}"
 export CPP='icc -E -mcmodel=large'
 export CXXCPP='icpc -E -mcmodel=large'
 export CPPFLAGS="-DNDEBUG -DpgiFortran ${LDFLAGS}"
- 設定
 ./configure --prefix=/opt/netcdf4-ifort --disable-shared
 export CC=icc
 export CPP=
 export CXX=icpc
- PGI

*** Compile and install [#w00240bb]
- configure
 ./configure --prefix=/opt/netcdf4-fortran_gnu   --disable-shared
 ./configure --prefix=/opt/netcdf4-fortran_intel --disable-shared
 ./configure --prefix=/opt/netcdf4-fortran_pgi   --disable-shared
- コンパイル
 make
 make check
 make install


* インストール後の環境設定 [#m61ce1c2]
- GNU
 export NETCDF=/opt/netcdf4-c_gnu
 export NETCDF_F_ROOT=/opt/netcdf4-fortran_gnu
- Intel
 export NETCDF=/opt/netcdf4-c_intel
 export NETCDF_F_ROOT=/opt/netcdf4-fortran_intel
- PGI
 export NETCDF=/opt/netcdf4-c_gnu
 export NETCDF_F_ROOT=/opt/netcdf4-fortran_pgi
- 共通
 export NCHOME="${NETCDF}"
 export NETCDFHOME="${NETCDF}"
 export NETCDFROOT="${NETCDF}"
 export PATH="${NETCDF}/bin:${PATH}"
 export LD_LIBRARY_PATH="${NETCDF}/lib:${LD_LIBRARY_PATH}"



---------------------------------------------------
アーカイブ
---------------------------------------------------


* netcdf-3.6.X [#wd5a43fd]
** netcdf with Intel Fortran 10.0 for Linux [#d374a2a1]
+ netcdf-3.6.Xをダウンロ−ドして展開.コンパイル×(libstdc+xx)
+ netcdf-3.6.Xをダウンロ−ドして展開.
+ 以下の環境を設定し,
 setenv  FC                 ifort
 setenv  FC90               ifort
 setenv  CC                 icc
 setenv  CXX                icpc
 setenv  FFLAGS             "-g -O2 -mp -recursive"
 setenv  CFLAGS             "-g -O"
 setenv  CXXFLAGS           "-g"
 setenv  CPPFLAGS           "-DpgiFortran"
-- ./configure --prefix=/usr/local/netcdf-ifort_10.0
-- make check
-- mkdir /usr/local/netcdf-ifort
-- make install
- インストール後の環境設定
 setenv  NETCDF            /usr/local/netcdf-ifort
 setenv  NCHOME            $NETCDF
 setenv  NETCDFHOME        $NETCDF
 setenv  NETCDF_LIBDIR     $NETCDF/lib
 setenv  NETCDF_INCDIR     $NETCDF/include
 setenv  PATH              $NETCDF/bin:"$PATH"
 setenv  LD_LIBRARY_PATH   $NETCDF/lib:"$LD_LIBRARY_PATH" 



* Archive [#c3a71931]
- [[netcdf/netcdf with Intel Fortran for Linux - 9.0]]
- [[netcdf/netcdf with Intel Fortran for Linux - 8.0]]
- [[netcdf/netcdf with Intel Fortran for Linux - 7.0]]



* Link [#v2a17385]
- [[参考:http://www.unidata.ucar.edu/software/netcdf/docs/other-builds.html#pg6]]
- http://blog.livedoor.jp/rootan2007/archives/51847001.html
- http://blog.livedoor.jp/rootan2007/archives/51847527.html
- https://sites.google.com/site/airseaairsea/ji-suan-ji-huan-jing/netcdf