Rate This Document
Findability
Accuracy
Completeness
Readability

Compilation and Installation

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Go to the MITgcm installation package directory.
    cd /path/to/MITGCM
  3. Decompress the installation package.
    tar -xvf MITgcm_c67o.tar.gz
    cd MITgcm
  4. Configure the related files.
    1. Go to the build_options directory.
      cd tools/build_options
    2. Create and edit the Linux_arm64_gfortran file.
      vi linux_arm64_gfortran
    3. Press i to enter the insert mode and add the following content:
      #!/bin/bash
      MPI='true'
      CC=mpicc
      FC=mpif77
      F90C=mpif90
      DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR -DALLOW_USE_MPI -DALWAYS_USE_MPI'
      EXTENDED_SRC_FLAG='-ffixed-line-length-132'
      F90FIXEDFORMAT='-ffixed-form'
      GET_FC_VERSION="--version"
      OMPFLAG='-fopenmp'
      NOOPTFLAGS='-O0 -g'
      NOOPTFILES=''
      CFLAGS='-O3 '
      FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
      CFLAGS="$CFLAGS -fPIC"
      FFLAGS="$FFLAGS -fPIC"
      #- with FC 19, need to use this without -fPIC (which cancels -mcmodel option):
      # CFLAGS="$CFLAGS -mcmodel=medium"
      # FFLAGS="$FFLAGS -mcmodel=medium"
      #- might want to use '-fdefault-real-8' for fizhi pkg:
      #FFLAGS="$FFLAGS -fdefault-real-8 -fdefault-double-8"
      if test "x$IEEE" = x ; then #- with optimisation:
      #- full optimisation
      FOPTIM='-O3 -funroll-loops'
      NOOPTFILES="$NOOPTFILES ini_masks_etc.F"
      #- can use -O2 (safe optimisation) to avoid Pb with some gcc version of -O3:
      #FOPTIM='-O2 -funroll-loops'
      else
      # these may also be useful, but require specific gfortran versions:
      # -Wnonstd-intrinsics for gfortran <= 4.3
      # -Wintrinsics-std for gfortran >= 4.4
      # -Wno-tabs for gfortran >= 4.3
      # -Wno-unused-dummy-argument for gfortran >= 4.6
      #FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
      #- or simply:
      FFLAGS="$FFLAGS -Wall"
      #- to get plenty of warnings: -Wall -Wextra (older form: -Wall -W) or:
      #FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
      if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
      FOPTIM='-O0'
      else #- development/check options:
      FOPTIM='-O0 -g -fbounds-check'
      FOPTIM="$FOPTIM -ffpe-trap=invalid,zero,overflow -finit-real=inf"
      fi
      fi
      F90FLAGS=$FFLAGS
      F90OPTIM=$FOPTIM
      # --------------------------
      # NETCDF DIRECTORIES
      # --------------------------
      HDF5_HOME=/path/to/HDF5
      NETCDF_HOME=/path/to/NETCDF
      INCLUDEDIRS=''
      INCLUDES="-I$NETCDF_HOME/include -I$HDF5_HOME/include"
      LIBS="-L$NETCDF_HOME/lib -lnetcdff -lnetcdf -L$HDF5_HOME/lib -lhdf5_hl -lhdf5"
      # -----------------------
      # INCLUDE MPI DIRECTORIES
      # -----------------------
      MPI_HOME=/path/to/OPENMPI-4.0.1
      MPI_INC_DIR=$MPI_HOME/include
      INCLUDES="$INCLUDES -I$MPI_HOME/include"
      INCLUDEDIRS="$INCLUDEDIRS $MPI_HOME/include"
      MPIINCLUDEDIR="$MPI_INC_DIR"
    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. The following uses the exp4 test case as an example to describe how to compile and install the software.
    1. Go to the related directory.
      cd /path/to/MITGCM/MITgcm/verification/exp4/code
    2. Rename SIZE.h_mpi to SIZE.h to replace the original SIZE.h file.
      mv SIZE.h_mpi SIZE.h
    3. Go to the related directory.
      cd /path/to/MITGCM/MITgcm/verification/exp4/build
    4. Create a makefile file.
      ../../../tools/genmake2 -mods=../code -mpi -of=../../../tools/build_options/linux_arm64_gfortran
    5. Perform the compilation and installation. If the mitgcmuv file is generated, the compilation is successful.
      make depend
      make