# Compiling CMAQ on Cheyenne at NCAR

**URL:** <https://forum.cmascenter.org/t/compiling-cmaq-on-cheyenne-at-ncar/1995>\
**Category:** Compiling\
**Created:** [January 5, 2021, 2:31am UTC](https://forum.cmascenter.org/t/compiling-cmaq-on-cheyenne-at-ncar/1995 "2021-01-05T02:31:53Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![ckuo6](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ckuo6](https://forum.cmascenter.org/u/ckuo6)\
**Post date:** [January 17, 2021, 2:49am UTC](https://forum.cmascenter.org/t/compiling-cmaq-on-cheyenne-at-ncar/1995/25 "2021-01-17T02:49:05Z")

</div>

I solved the problem.

For IOAPI3.2, I used Linux2\_x86\_64ifortmpi. Here are the steps:

1. Modify /ioapi-3.2/ioapi/Makeinclude.Linux2\_x86\_64ifortmpi  
cd /…/ioapi-3.2/ioapi  
vi Makeinclude.Linux2\_x86\_64ifortmpi  
Line 23: OMPFLAGS = #-openmp  
Line 24: OMPLIBS = #-openmp  
Add a line after Line 33: -DIOAPI\_NCF4=1   
Line 41: #ARCHLIB = -Bstatic  
:wq  
Here’ s my reference for Line 33: [Availability/Download of the BAMS/Models-3 I/O&nbsp;API](https://www.cmascenter.org/ioapi/documentation/all_versions/html/AVAIL.html#medium)

2. Modify /ioapi-3.2/Makefile  
cd …/  
vi Makefile  
Line 193: NCFLIBS = -L/glade/u/apps/ch/opt/netcdf/4.7.4/intel/19.0.5/lib -lnetcdff -lnetcdf -qopenmp  
:wq

3. Set environment  
export BIN=Linux2\_x86\_64ifortmpi  
export BASEDIR=$PWD  
export CPLMODE=nocpl  
mkdir $BIN

4. compiling IOAPI  
make configure  
make

The environment settings in config\_cmaq.sh is:  
case intel:

```
    #> I/O API, netCDF, and MPI library locations
    setenv IOAPI_INCL_DIR /glade/scratch/chengpin/ioapi-3.2/ioapi/fixed_src #ioapi_inc_intel #> I/O API include header files
    setenv IOAPI_LIB_DIR /glade/scratch/chengpin/ioapi-3.2/Linux2_x86_64ifortmpi #ioapi_lib_intel #> I/O API libraries
    setenv NETCDF_LIB_DIR /glade/u/apps/ch/opt/netcdf/4.7.4/intel/19.0.5/lib #netcdf_lib_intel #> netCDF C directory path
    setenv NETCDF_INCL_DIR /glade/u/apps/ch/opt/netcdf/4.7.4/intel/19.0.5/include #netcdf_inc_intel #> netCDF C directory path
    setenv NETCDFF_LIB_DIR /glade/u/apps/ch/opt/netcdf/4.7.4/intel/19.0.5/lib #netcdff_lib_intel #> netCDF Fortran directory path
    setenv NETCDFF_INCL_DIR /glade/u/apps/ch/opt/netcdf/4.7.4/intel/19.0.5/include #netcdff_inc_intel #> netCDF Fortran directory path
    setenv MPI_LIB_DIR /glade/u/apps/opt/intel/2019u5/impi/2019.6.154/intel64 #mpi_lib_intel #> MPI directory path

    #> Compiler Aliases and Flags
    #> set the compiler flag -qopt-report=5 to get a model optimization report in the build directory with the optrpt extension
    setenv myFC mpiifort
    setenv myCC mpicc
    setenv myFSTD "-O3 -fno-alias -mp1 -fp-model source -ftz -simd -align all -xHost -vec-guard-write -unroll-aggressive"
    setenv myDBG "-O0 -g -check bounds -check uninit -fpe0 -fno-alias -ftrapuv -traceback"
    setenv myLINK_FLAG "" #"-qopenmp-simd" openMP not supported w/ CMAQ
    setenv myFFLAGS "-fixed -132"
    setenv myFRFLAGS "-free"
    setenv myCFLAGS "-O2"
    setenv extra_lib "-lcurl"
    #setenv extra_lib ""
    setenv mpi_lib "" #> No Library specification needed for mpiifort
                         #> -lmpich for mvapich
                         #> -lmpi for openmpi

    breaksw

```

Hope it will help other users on NCAR Cheyenne.  
Thank you, guys.

---

_[View the full topic](https://forum.cmascenter.org/t/compiling-cmaq-on-cheyenne-at-ncar/1995)._
