Compilation and Installation
Procedure
- Use PuTTY to log in to the server as the root user.
- Create a main program installation directory.
mkdir -p /path/to/MITGCM
- Copy the installation package to the main program installation directory.
cp MITgcm_c67o.tar.gz /path/to/MITGCM
- Go to the main program installation directory.
cd /path/to/MITGCM
- Decompress the installation package.
tar -xvf MITgcm_c67o.tar.gz
- Go to the directory generated after the decompression.
cd MITgcm
- Configure the files.
- Go to the build_options directory.
cd tools/build_options
- Create and edit the Linux_arm64_gfortran file.
- Create Linux_arm64_gfortran.
vi linux_arm64_gfortran
- 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 -march=armv8.2-a' 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 -march=armv8.2-a' 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" - Press Esc, type :wq!, and press Enter to save the file and exit.
- Create Linux_arm64_gfortran.
- Go to the build_options directory.
- Perform the compilation and installation, using exp4 as an example:
- Go to the corresponding directory.
cd /path/to/MITGCM/MITgcm/verification/exp4/code
- Rename SIZE.h_mpi to SIZE.h to replace the original SIZE.h file.
mv SIZE.h_mpi SIZE.h
- Go to the corresponding directory.
cd /path/to/MITGCM/MITgcm/verification/exp4/build
- Generate a makefile file.
../../../tools/genmake2 -mods=../code -mpi -of=../../../tools/build_options/linux_arm64_gfortran
- Perform the compilation and installation.
make depend make -j
- Go to the corresponding directory.
Parent topic: MITgcm c67o Porting Guide (CentOS 7.6)