Compilation and Installation
Procedure
- Use PuTTY to log in to the server as the root user.
- Run the following command to go to the CMAQ directory:
cd /path/to/CMAQ
- 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
- Run the following commands to copy the configuration file:
cd ioapi-3.2 cp ioapi/Makeinclude.Linux2_ia64gfort ioapi/Makeinclude.Linux4_aarch64
- Edit the configuration file.
- Run the following command to modify the Makeinclude.Linux4_aarch64 configuration file:
vim ioapi/Makeinclude.Linux4_aarch64
- 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the following command to modify the Makeinclude.Linux4_aarch64 configuration file:
- Run the following commands to copy Makefile and configure HOME:
cp ioapi/Makefile.nocpl ioapi/Makefile export HOME=/path/to/CMAQ
- Run the following command to copy the configuration file:
cp m3tools/Makefile.nocpl m3tools/Makefile
- Edit the configuration file.
- Run the following command to modify the Makefile configuration file:
vim m3tools/Makefile
- 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) - Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the following command to modify the Makefile configuration file:
- Run the following command to copy the configuration file:
cp Makefile.template Makefile
- Edit the configuration file.
- Open the configuration file.
vim Makefile
- 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the configuration file.
- Run the following command to compile ioapi:
make BIN=Linux4_aarch64
- Modify the STATE3.EXT file.
- Open STATE3.EXT.
vim ioapi/STATE3.EXT
- 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:

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open STATE3.EXT.
- 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
- Edit the configuration file.
- Open the configuration file.
vim bldit_project.csh
- Press i to enter the insert mode and modify the file as follows:
set CMAQ_HOME = /path/to/CMAQ/CMAQ_Project
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the configuration file.
- Run the following command to create the files required for initialization:
./bldit_project.csh
- Run the following command to switch to the working directory:
cd ../CMAQ_Project/
- Edit the configuration file.
- Open the configuration file.
vim config_cmaq.csh
- 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the configuration file.
- Run the following command to connect to various dependent libraries:
./config_cmaq.csh gcc 9.3.0
- 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.
Parent topic: CMAQ 5.3.1 Porting Guide (CentOS 7.6)