编译和安装

操作步骤

  1. 使用PuTTY工具,以root用户登录服务器。
  2. 执行以下命令创建并且进入NEMO安装目录。

    mkdir -p /path/to/NEMO
    cd /path/to/NEMO

  3. 执行以下命令配置NEMO编译需要的环境变量。

    echo "export NETCDF_DIR=/path/to/NETCDF" >> nemo-env.sh
    echo "export HDF_DIR=/path/to/HDF5" >> nemo-env.sh
    echo "export XIOS_DIR=/path/to/XIOS/xios-1.0" >> nemo-env.sh
    source nemo-env.sh

  4. 执行以下命令解压安装包。

    unzip NEMO_releases_release-3.6-10083.zip

  5. 执行以下命令进入NEMO源码目录。

    cd NEMO/releases/release-3.6/NEMOGCM

  6. 执行以下命令创建文件“arch-aarch64_gnu.fcm”

    1. 创建文件“arch-aarch64_gnu.fcm”
      vi ARCH/arch-aarch64_gnu.fcm
    2. 按“i”进入编辑模式,添加如下内容。
      #generic gfortran compiler options for linux 
      #NCDF_INC    netcdf include file 
      #NCDF_LIB    netcdf library 
      #FC          Fortran compiler command 
      #FCFLAGS     Fortran compiler flags 
      #FFLAGS      Fortran 77 compiler flags 
      #LD          linker 
      #LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a 
      #FPPFLAGS    pre-processing flags 
      #AR          assembler 
      #ARFLAGS     assembler flags 
      #MK          make 
      #USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
      #USER_LIB    additional libraries to pass to the linker, e.g. -l<library> 
      #CC          C compiler used to compile conv for AGRIF 
      #CFLAGS      compiler flags used with CC 
      # 
      #Note that: 
      # - unix variables "$..." are accpeted and will be evaluated before calling fcm. 
      # - fcm variables are starting with a % (and not a $) 
      %NCDF_HOME           $NETCDF_DIR
      %HDF5_HOME           $HDF_DIR
      %XIOS_HOME           $XIOS_DIR
      
      %NCDF_INC            -I%NCDF_HOME/include -I%HDF5_HOME/include
      %NCDF_LIB            -L%HDF5_HOME/lib -L/%NCDF_HOME/lib -lnetcdf -lnetcdff
      %XIOS_INC            -I%XIOS_HOME/inc
      %XIOS_LIB            -L%XIOS_HOME/lib -lxios
      
      %CPP                 cpp -Dkey_nosignedzero
      %FC                  mpif90 -c -cpp
      %FCFLAGS             -mcpu=native -fdefault-real-8 -fdefault-double-8 -O3 -funroll-all-loops -fcray-pointer -ffree-line-length-none -g
      %FFLAGS              %FCFLAGS
      %LD                  mpif90
      %LDFLAGS             -lstdc++
      %FPPFLAGS            -P -C -traditional
      %AR                  ar
      %ARFLAGS             rs
      %MK                  gmake
      %USER_INC            %XIOS_INC %NCDF_INC
      %USER_LIB            %XIOS_LIB %NCDF_LIB
      
      %CC                  cc
      %CFLAGS              -O0

      行尾和空行不能有空格。

    3. 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。

  7. 执行以下命令编译安装软件。

    chmod 777 ./ -R
    cd ./CONFIG/
    ./makenemo -m aarch64_gnu -j 32 -r AMM12 -n 'MY_AMM12' add_key "key_nosignedzero"