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. Run the following command to go to the CMAQ directory:
    cd /path/to/CMAQ
  3. Run the following commands to decompress the package and rename ioapi:
    tar -xvf ioapi-3.2-2020111.tar.gz
    mv ioapi-3.2-2020111 ioapi-3.2
  4. Run the following commands to copy the configuration file:
    cd ioapi-3.2
    cp ioapi/Makeinclude.Linux2_ia64gfort ioapi/Makeinclude.Linux4_aarch64
  5. Edit the configuration file.
    1. Run the following command to modify the Makeinclude.Linux4_aarch64 configuration file:
      vim ioapi/Makeinclude.Linux4_aarch64
    2. Press i to enter the insert mode.
      Modify the compiler options:
      CC   = mpicc
      CXX  = mpicxx
      FC   = mpifort
      Comment out the line corresponding to the FSFLAGS keyword, for example:
      #FSFLAGS = -save
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Run the following commands to copy Makefile and configure HOME:
    cp ioapi/Makefile.nocpl ioapi/Makefile
    export HOME=/path/to/CMAQ
  7. Run the following command to copy the configuration file:
    cp m3tools/Makefile.nocpl m3tools/Makefile
  8. Edit the configuration file.
    1. Run the following command to modify the Makefile configuration file:
      vim m3tools/Makefile
    2. Press i to enter the insert 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. Run the following command to copy the configuration file:
    cp Makefile.template Makefile
  10. Edit the configuration file.
    1. Open the configuration file.
      vim Makefile
    2. Press i to enter the insert 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 item:
      NCFLIBS    = -L/path/to/NETCDF/lib -lnetcdff -lnetcdf -L/path/to/HDF5/lib -lhdf5_hl -lhdf5 -lz
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  11. Run the following command to compile ioapi:
    make BIN=Linux4_aarch64
  12. Modify the STATE3.EXT file.
    1. Open STATE3.EXT.
      vim ioapi/STATE3.EXT
    2. Press i to enter the insert mode. Delete & at the end of some lines in the STATE3.EXT file, as shown in the red box in the following figure:

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  13. Run the following commands to decompress the package and go to the directory:
    tar -xvf CMAQ-CMAQv5.3.1_19Dec2019.tar.gz
    cd CMAQ-CMAQv5.3.1_19Dec2019
  14. Edit the configuration file.
    1. Open the configuration file.
      vim bldit_project.csh
    2. Press i to enter the insert 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.
  15. Run the following command to create the files required for initialization:
    ./bldit_project.csh
  16. Run the following command to switch to the working directory:
    cd ../CMAQ_Project/
  17. Edit the configuration file.
    1. Open the configuration file.
      vim config_cmaq.csh
    2. Press i to enter the insert mode.
      In the case gcc area, modify the paths to dependencies, as shown in the following figure:
      setenv IOAPI_MOD_DIR   /path/to/CMAQ/ioapi-3.2/Linux4_aarch64/
      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/OPENMPI/
      Modify the compiler parameters. For example:
      setenv myCC mpicc
      setenv myLINK_FLAG  "-fopenmp"
      setenv mpi_lib "-lmpi"
      Add the openmp attribute to the netcdf_lib variable. For example:
      setenv netcdf_lib "-lnetcdf -lnetcdff -lgomp"  #> -lnetcdff -lnetcdf for netCDF v4.2.0 and later
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  18. Run the following command to connect to various dependent libraries:
    ./config_cmaq.csh gcc 9.3.0
  19. Run the following commands in sequence to go to the compilation directory and compile the main program:
    cd CCTM/scripts/
    ./bldit_cctm.csh gcc 9.3.0

    After the compilation is complete, the executable program CCTM_v531.exe is generated in the BLD_CCTM_v531_gcc9.3.0 directory.