Skip to content

Compiling GEOS-Chem Classic

GEOS-Chem Classic. Consult the official documentation for details on building.[1] GCClassic is (single-node) multithreaded (using OpenMP[2]) code.

Prerequisites♯

Modules to load♯

  • intel/composerxe/2020u4
  • netcdf-fortran/intel/2020/4.5.4 (this is a “serial” version even though not designated in the modulefile name, i.e. not MPI-enabled; if in doubt, pick a “serial” version)
  • cmake (only used for building)
  • git (optional; may be needed if GitHub-related errors are shown)

netcdf-fortran will also pull in other dependencies.

If you need a version of NetCDF not currently on Picotte, you can build it yourself. N.B. netcdf-c can be built with cmake, but netcdf-fortran’s cmake configuration seems to have errors. It should be built using the “configure ; make ; make install” method.

Download Sources♯

Download from Git, checking out the desired tag. The tag here is “13.4.0”.

[juser@picotte001 ~]$ cd /ifs/groups/myrsrchGrp
[juser@picotte001 myrsrchGrp]$ mkdir software
[juser@picotte001 myrsrchGrp]$ cd software
[juser@picotte001 software]$ git clone https://github.com/geoschem/GCClassic
...
[juser@picotte001 software]$ cd GCClassic
[juser@picotte001 GCClassic]$ git checkout 13.4.0
[juser@picotte001 GCClassic]$ git submodule update --init --recursive

If you want the latest “head”, omit the “git checkout 13.4.0” command.

Configure and Build♯

We use ccmake, the text-based user interface (TUI) for CMake.[3]

Configure♯

[juser@picotte001 GCClassic]$ mkdir BUILD
[juser@picotte001 GCClassic]$ cd BUILD
[juser@picotte001 BUILD]$ ccmake ..
                                                     Page 0 of 1
 EMPTY CACHE

...


EMPTY CACHE:
Keys: [enter] Edit an entry [d] Delete an entry                                     CMake Version 3.22.2
      [l] Show log output   [c] Configure
      [h] Help              [q] Quit without generating
      [t] Toggle advanced mode (currently off)

Type “c” to configure.

 The Fortran compiler identification is Intel 19.1.3.20200925
 Detecting Fortran compiler ABI info
 Detecting Fortran compiler ABI info - done
 Check for working Fortran compiler: /ifs/opt/intel/2020/compilers_and_libraries_2020.4.304/linux/bin/intel64/ifort - skipped
 =================================================================
 GCClassic 13.4.0 (superproject wrapper)
 Current status: 13.4.0
 =================================================================
 Found NetCDF: /ifs/opt/netcdf-fortran/intel/2020/4.5.4/lib/libnetcdff.so
 Useful CMake variables:
   + CMAKE_PREFIX_PATH:  /ifs/opt/netcdf/intel/2020/4.8.1
   ...         /ifs/opt/netcdf-fortran/intel/2020/4.5.4
   + CMAKE_BUILD_TYPE:  Release
 Run directory setup:

 Threading:
   * OMP:  [32mON[m  OFF
 Found OpenMP_Fortran: -qopenmp (found version "5.0")
 Found OpenMP: TRUE (found version "5.0")
 General settings:
   * MECH:  [32mfullchem[m  Hg  custom
   * BPCH_DIAG:  ON  [32mOFF[m
   * USE_REAL8:  [32mON[m  OFF
 Components:
   * TOMAS:  ON  [32mOFF[m
   * TOMAS_BINS:  [32mNA[m  15  40
   * APM:  ON  [32mOFF[m
   * RRTMG:  ON  [32mOFF[m
   * GTMM:  ON  [32mOFF[m
   * HCOSA:  ON  [32mOFF[m
   * LUO_WETDEP:  ON  [32mOFF[m
 =================================================================
 HEMCO 3.4.0
 Current status: 3.4.0
 =================================================================
 =================================================================
 GEOS-Chem 13.4.0 (science codebase)
 Current status: 13.4.0
 =================================================================
 Creating /ifs/groups/myrsrchGrp/softwear/GCClassic/src/GEOS-Chem/Interfaces/GCClassic/gc_classic_version.H
 Configuring done

A successful configuration step should show “Configuring done”.

Type “e” to exit the messages screen.

Modify install location♯

Use the arrow keys to go down to the line:

 CMAKE_INSTALL_PREFIX            */ifs/groups/myrsrchGrp/software/GCClassic/BUILD/install

We suggest changing this value. To change it, hit the Enter key, and type in the desired installation location:

 CMAKE_INSTALL_PREFIX            */ifs/groups/myrsrchGrp/software

If this value is used, the resulting gcclassic executable will be installed as /ifs/groups/myrsrchGrp/software/bin/gcclassic Choose a value which fits the way you currently work. Or leave it unchanged.

Hit “c” again to configure. Then, “e” to exit messages.

Build a.k.a. compile a.k.a. make♯

Hit “g” to generate the makefile. The status line in Ccmake should show “Generating...” and will return you to the shell when done.

Now, run the compilation:

[juser@picotte001 BUILD]$ make -j 24 | tee Make.out 2>&1

The “-j 24” tells make to run up to 24 simultaneous compilations. The “tee” command splits input into two, one to the terminal and one to the file Make.out. The “2>&1” joins stderr (i.e. error output) to stdout (i.e. normal output).

The build will take a few minutes. If successful, it should show the following at the end:

...
Scanning dependencies of target gcclassic
[ 98%] Building Fortran object src/CMakeFiles/gcclassic.dir/GEOS-Chem/Interfaces/GCClassic/main.F90.o
[100%] Linking Fortran executable ../bin/gcclassic
[100%] Built target gcclassic

Check the executable is there:

[juser@picotte001 BUILD]$ ls -l bin
total 17704
-rwxrwxr-x 1 juser myrsrchGrp 14904144 May 12 16:23 gcclassic

Run it just to see its “hello” message:

[juser@picotte001 BUILD]$ ./bin/gcclassic
*************   S T A R T I N G   G E O S - C H E M   *************

===> Mode of operation         : GEOS-Chem "Classic"
===> GEOS-Chem version         : 13.4.0
===> Compiler                  : Intel Fortran Compiler (aka ifort)
===> Flexible precision set to : 8-byte real (aka REAL*8)
===> Parallelization w/ OpenMP : ON
===> Binary punch diagnostics  : OFF
===> netCDF diagnostics        : ON
===> netCDF file compression   : SUPPORTED
===> Luo et al (2019) wetdep?  : OFF

===> SIMULATION START TIME: 2022/05/12 16:24 <===

===============================================================================
G E O S - C H E M   U S E R   I N P U T

READ_INPUT_FILE: Opening ./input.geos
===============================================================================
GEOS-CHEM I/O ERROR    29 in file unit    11
Encountered at routine:location read_input_file:1

Error   29: File not found
...

Then, install it to the location specified above:

[juser@picotte001 BUILD]$ make install | tee Make.install.out 2>&1

See Also♯

References♯

[1] GEOS-Chem Classic documentation

[2] OpenMP official website

[3] CMake Documentation - ccmake (also available as a man page)