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 CMAQ installation directory.
    mkdir -p /path/to/CMAQ
  3. Decompress and rename the ioapi file.
    tar -xvf ioapi-3.2-2020111.tar.gz
    mv ioapi-3.2-2020111 ioapi-3.2
  4. Copy the configuration file.
    cd ioapi-3.2
    cp ioapi/Makeinclude.Linux2_ia64gfort ioapi/Makeinclude.Linux4_aarch64
  5. Modify the Makeinclude.Linux4_aarch64 configuration file.
    1. Open the Makeinclude.Linux4_aarch64 configuration file.
      vi ioapi/Makeinclude.Linux4_aarch64
    2. Press i to enter the edit mode.

      Modify the compiler options.

      CC = mpicc
      CXX = mpicxx
      FC = mpifort

      Comment out the parameters corresponding to some keywords, as shown in the following figure:

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Copy the Makefile file and configure HOME.
    cp ioapi/Makefile.nocpl ioapi/Makefile
    export HOME=/path/to/CMAQ
  7. Copy the configuration file.
    cp m3tools/Makefile.nocpl m3tools/Makefile
  8. Modify the Makefile configuration file.
    1. Open the Makefile configuration file.
      vi m3tools/Makefile
    2. Press i to enter the edit mode and modify the file as follows:
      LIBS = -L${OBJDIR} -lioapi -L/path/to/NETCDF/lib -lnetcdff -lnetcdf -L/path/to /HDF5/lib -lhdf5_hl -lhdf5 -lz $(OMPLIBS) $(ARCHLIB) $(ARCHLIBS)
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  9. Copy the configuration file.
    cp Makefile.template Makefile
  10. Modify the Makefile configuration file.
    1. Open the Makefile configuration file.
      vi Makefile
    2. Press i to enter the edit mode.

      Modify the following content and delete the comment tag (#).

      BIN = Linux4_aarch64
      BASEDIR = ${PWD}
      INSTALL = ${HOME}
      LIBINST = $(INSTALL)/$(BIN)
      BININST = $(INSTALL)/$(BIN)
      CPLMODE = nocpl
      IOAPIDEFS = "-DIOAPI_NCF4"

      Modify the NCFLIBS parameter in lines 146 and 193.

      NCFLIBS = -L/path/to/NETCDF/lib -lnetcdff -lnetcdf -L/path/to/HDF5/lib -lhdf5_hl -lhdf5 -lz

      After performing 10.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  11. Compile IOAPI.
    make BIN=Linux4_aarch64
  12. Modify the STATE3.EXT file.
    1. Open the STATE3.EXT file.
      vi ioapi/STATE3.EXT
    2. Press i to enter the edit mode. Delete the ampersands (&) at the end of some lines in the STATE3.EXT file, as shown in the following figure:

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  13. Go to the C shell environment and configure HOME.
    csh
    setenv HOME /path/to/CMAQ
  14. Add the environment variables to the C shell environment.
    setenv PATH /path/to/Bisheng131/bin:$PATH
    setenv INCLUDE /path/to/Bisheng131/include
    setenv LD_LIBRARY_PATH /path/to/Bisheng131/lib
    setenv PATH /path/to/HMPI_1.0.2_aarch64/source/hmpi/bin:$PATH
    setenv INCLUDE /path/to/HMPI_1.0.2_aarch64/source/hmpi/include:$INCLUDE
    setenv LD_LIBRARY_PATH /path/to/HMPI_1.0.2_aarch64/source/hmpi/lib:$LD_LIBRARY_PATH
  15. Decompress the CMAQ installation package and go to the directory generated after the decompression.
    cd /path/to/CMAQ
    tar -xzvf CMAQ-CMAQv5.3.1_19Dec2019.tar.gz
    cd CMAQ-CMAQv5.3.1_19Dec2019
  16. Modify the bldit_project.csh configuration file.
    1. Open the bldit_project.csh configuration file.
      vi bldit_project.csh
    2. Press i to enter the edit mode and modify the file as follows:
      set CMAQ_HOME = /path/to/CMAQ/CMAQ_Project
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  17. Create the file required for the initialization.
    ./bldit_project.csh
  18. Go to the working directory.
    cd ../CMAQ_Project/
  19. Modify the config_cmaq.csh configuration file.
    1. Open the config_cmaq.csh configuration file.
      vi config_cmaq.csh
    2. Press i to enter the edit mode.

      In the case gcc area, change case gcc to case bisheng.

      setenv IOAPI_INCL_DIR /path/to/CMAQ/ioapi-3.2/ioapi/
      setenv IOAPI_LIB_DIR /path/to/CMAQ/ioapi-3.2/Linux4_aarch64/
      setenv NETCDF_LIB_DIR /path/to/NETCDF/lib/
      setenv NETCDF_INCL_DIR /path/to/NETCDF/include/
      setenv MPI_LIB_DIR /path/to/HMPI/
      setenv NETCDFF_LIB_DIR /path/to/NETCDF/lib/
      setenv NETCDFF_INCL_DIR /path/to/NETCDF/include/

      Modify the compiler parameters, as shown in the following figure. (A warning may be displayed during the compilation but it does not affect the compilation. You can also delete the related parameters according to the warning.)

      Comment out the following content:

      #if ( ! -e $NETCDFF_DIR/lib/libnetcdff.a ) then
      #    echo "ERROR: $NETCDFF_DIR/lib/libnetcdff.a does not exist in your CMAQ_LIB directory!!! Check your installation before proceeding with CMAQ build."
      #    exit
      # endif
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  20. Connect to the dependent libraries.
    ./config_cmaq.csh bisheng 1.3.1
  21. Go to the compilation directory and compile the main program.
    cd CCTM/scripts/
    cp /path/to/HMPI/include/mpif.h /path/to/CMAQ/CMAQ_Project/CCTM/scripts/BLD_CCTM_v531_bisheng1.3.1
    ./bldit_cctm.csh bisheng 1.3.1

    After the compilation is complete, the executable program CCTM_v531.exe is generated in the BLD_CCTM_v531_bisheng1.3.1 directory.