Error of using ioapi-3.2 to compile cctm


In the past, I compiled CMAQ with ioapi-3.1 version. Recently, I encountered an issue where when I enable PA and ISAM, and track 30 tags, I receive an error saying that the maximum number of files that can be opened has been exceeded. After searching on the forum, I believe that compiling with ioapi-3.2 should solve this problem. However, when I compiled CCTM using ioapi-3.2, I encountered the following error. I could not find similar posts on the forum, so I am hoping to get some help.

Following is part of the error messages:

ld: Warning: size of symbol `bstate3_' changed from 14835740 in pshut3.o to 14835744 in /WORK/sysu_fq_1/xuyf/Model/CMAQv5.4/AQ_2305/lib/x86_64/intel/ioapi/lib/libioapi.a(initblk3.o)
/WORK/sysu_fq_1/xuyf/Model/CMAQv5.4/AQ_2305/lib/x86_64/intel/ioapi/lib/libioapi.a(name2fid.o): In function `name2fid_':
/WORK/sysu_fq_1/shenao/software/ioapi-3.2-20200828/ioapi/name2fid.f:(.text+0x21): undefined reference to `__kmpc_global_thread_num'
/WORK/sysu_fq_1/shenao/software/ioapi-3.2-20200828/ioapi/name2fid.f:(.text+0x38): undefined reference to `__kmpc_critical'
/WORK/sysu_fq_1/shenao/software/ioapi-3.2-20200828/ioapi/name2fid.f:(.text+0x59): undefined reference to `__kmpc_end_critical'

I compiled ioapi3.2 using netcdf4.4.1, and I have libioapi.a file. I’m not sure where the bug originates from.

Here is the complete error log file when compile cctm.
makelog.txt (29.8 KB)

This is most-probably a CCTM-compilation problem, since CCTM-PARIO routine PSHUT3 is using (private!) I/O API INCLUDE-file STATE3.EXT but is compiling its COMMONs differently than the I/O API did while building libioapi.a – in particular, choosing different “padding” for optimization-purposes.

Fortunately, I carefully ordered the entries in this file so that the COMMONs should be padding-independent, so that this should not be a problem.

– Carlie J. Coats, Jr., Ph.D. I/O API Author/Maintainer

Please try using the ioapi-3.2 large as described in this documentation:

This version is also available as a zip file from the following address:

Installation instructions for I/O API v3.2-large are provided in README.txt in the .tar.gz file.

Note: Users using the I/O API v3.2-large will require additional computional resources during compile and runtime to account for the increase in memory footprint. Additionally, users may encounter upward and backwards compatability issues using different versions of I/O API, if the files are produced with this version of I/O API.

Thank you for your response, but I’m sorry I didn’t understand. What do you mean “this shouldn’t be a problem”? Because I’m still confused about how to resolve the error I’m currently experiencing.

It’s a “warning” not an “error”.

While there is one make error showing

make: *** [CCTM_v54_ISAM.exe] Error 1

Please see my complete logfile.
And thus I didn’t get the CCTM.exe

Thanks for your suggestion. I would like to try using ioapi-3.2 large if I cannot successfully compile CCTM using ioapi-3.2. Or does it is a must to use ioapi-3.2 large to tracking many tags in ISAM?

This message
*undefined reference to __kmpc_end_critical'
can be resolved using the following flag in the Makeinclude.$BIN that you used to build the I/O API library

’ setenv myLINK_FLAG “-qopenmp” ’

The actual errors start with a section of the log you did not quote:

/WORK/sysu_fq_1/shenao/software/ioapi-3.2-20200828/ioapi/name2fid.f:(.text+0x21): undefined reference to `__kmpc_global_thread_num'
/WORK/sysu_fq_1/shenao/software/ioapi-3.2-20200828/ioapi/name2fid.f:(.text+0x38): undefined reference to `__kmpc_critical'
/WORK/sysu_fq_1/shenao/software/ioapi-3.2-20200828/ioapi/name2fid.f:(.text+0x59): undefined reference to `__kmpc_end_critical'

This is a known and documented problem: The I/O API by default is compiled to support OpenMP parallelism because a number of its client applications are in fact OpenMP-parallel. (Note that this does not slow down programs that do not use OpenMP.)
You need to add one of -fopenmp, -openmp, -qopenmp to your link flags for CMAQ (which one to use depends upon what compiler underlies your mpif90gfortran? ifort version before 15? ifort version 15 or later?)

Thanks for your help! I followed your guidance and set setenv myLINK_FLAG "-qopenmp" in config_cmaq.csh, and this time the compilation was successful.