Navigation : Top / Linux / netcdf for Linux

netcdf for Linux

netcdfをLinuxにインストールする. netcdf-4.2.xより,CとFORTRANでファイルがわかれた.

前提条件

Compiler

  • GNU C, gfortran
  • Intel composer (C and Fortran)
  • PGI

各種libraryがインストール済み

インストール

Download

環境設定

  • 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 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

  • configure
    ./configure --prefix=/opt/netcdf4-c_gnu   --disable-shared --enable-netcdf-4 --enable-dap
    ./configure --prefix=/opt/netcdf4-c_intel --disable-shared --enable-netcdf-4 --enable-dap
    ./configure --prefix=/opt/netcdf4-c_pgi   --disable-shared --enable-netcdf-4 --enable-dap
  • コンパイル
    make
    make check
    make install
  • Error
    • hdf5のlib, include
      • /usr/local/lib, /usr/local/includeにコピー

FORTRAN

Download

環境設定

# export LDFLAGS="-lnetcdf -L/opt/netcdf4-c_XXX/lib -I/opt/netcdf4-cXXX/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 CC=icc
    export CPP=
    export CXX=icpc
  • PGI

Compile and install

  • 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

インストール後の環境設定

  • 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

netcdf with Intel Fortran 10.0 for Linux

  1. netcdf-3.6.Xをダウンロ−ドして展開.コンパイル×(libstdc+xx)
  2. netcdf-3.6.Xをダウンロ−ドして展開.
  3. 以下の環境を設定し,
    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

Link