Compilation and Installation
Procedure
- Use PuTTY to log in to the server as the root user.
- Go to the CMAQ installation directory.
mkdir -p /path/to/CMAQ
- Decompress and rename the ioapi file.
tar -xvf ioapi-3.2-2020111.tar.gz mv ioapi-3.2-2020111 ioapi-3.2
- Copy the configuration file.
cd ioapi-3.2 cp ioapi/Makeinclude.Linux2_ia64gfort ioapi/Makeinclude.Linux4_aarch64
- Modify the Makeinclude.Linux4_aarch64 configuration file.
- Open the Makeinclude.Linux4_aarch64 configuration file.
vi ioapi/Makeinclude.Linux4_aarch64
- 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:

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the Makeinclude.Linux4_aarch64 configuration file.
- Copy the Makefile file and configure HOME.
cp ioapi/Makefile.nocpl ioapi/Makefile export HOME=/path/to/CMAQ
- Copy the configuration file.
cp m3tools/Makefile.nocpl m3tools/Makefile
- Modify the Makefile configuration file.
- Open the Makefile configuration file.
vi m3tools/Makefile
- 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) - Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the Makefile configuration file.
- Copy the configuration file.
cp Makefile.template Makefile
- Modify the Makefile configuration file.
- Open the Makefile configuration file.
vi Makefile
- 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the Makefile configuration file.
- Compile IOAPI.
make BIN=Linux4_aarch64
- Modify the STATE3.EXT file.
- Open the STATE3.EXT file.
vi ioapi/STATE3.EXT
- 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:

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the STATE3.EXT file.
- Go to the C shell environment and configure HOME.
csh setenv HOME /path/to/CMAQ
- 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
- 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
- Modify the bldit_project.csh configuration file.
- Open the bldit_project.csh configuration file.
vi bldit_project.csh
- Press i to enter the edit 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 bldit_project.csh configuration file.
- Create the file required for the initialization.
./bldit_project.csh
- Go to the working directory.
cd ../CMAQ_Project/
- Modify the config_cmaq.csh configuration file.
- Open the config_cmaq.csh configuration file.
vi config_cmaq.csh
- 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the config_cmaq.csh configuration file.
- Connect to the dependent libraries.
./config_cmaq.csh bisheng 1.3.1
- 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.
Parent topic: CMAQ 5.3.1 Porting Guide (openEuler 21.03)
