Compiling with GNU Make

From Geos-chem
Revision as of 18:40, 20 December 2019 by Bmy (Talk | contribs) (Compiling GEOS-Chem "Classic" versions 12.4.0 to 12.9.0)

Jump to: navigation, search

Previous | Next | Getting Started with GEOS-Chem

  1. Minimum system requirements
  2. Configuring your computational environment
  3. Downloading source code
  4. Downloading data directories
  5. Creating run directories
  6. Configuring runs
  7. Compiling GEOS-Chem
  8. Running
  9. Output files
  10. Visualizing and processing output
  11. Coding and debugging
  12. Further reading

Page is under construction.jpg

GNU Make will be retired in GEOS-Chem 13.0.0

The GNU Make build system will be retired in both GEOS-Chem and GCHP 13.0.0. This is necessary in order to keep pace with software engineering developments that are taking place at NASA/GMAO and elsewhere in the GEOS-Chem modeling community.

GEOS-Chem "Classic" versions 12.6.0 through 12.9.* are compatible with both GNU Make and CMake.

Compiling GEOS-Chem "Classic"

All run directories that you create contain a Makefile that enables you to easily compile and run GEOS-Chem from the run directory. Using this feature enables you to only select those options that are relevant to the GEOS-Chem simulation that you are using.

In this section, we list the steps that are needed to compile GEOS-Chem 12.4.0 to 12.9.* with GNU Make. If you are using an earlier GEOS-Chem version, then please see the next section.

Run directory contents

The following files and folders are part of a typical run directory. This example is for the geosfp_4x5_standard simulation.

CodeDir@           getRunInfo*      HEMCO_Diagn.rc  input.geos  OutputDir/**  HEMCO_Config.rc  HISTORY.rc      Makefile*   README
  1. CodeDir is a symbolic link to the code directory that you specified when you created the run directory.
  2. Makefile is the run-directory Makefile. This controls the build sequence. The Makefile relies on the getRunInfo script to obtain necessary information.
  3. OutputDir is where diagnostic files will be placed.
  4. input.geos and the *.rc files are configuration files that allow you to specify settings for the GEOS-Chem simulation.
  5. is the data download script for the GEOS-Chem dry-run simulation (available in 12.7.0 and later versions).
  6. is only used for GEOS-Chem unit tests and difference tests. You can usually ignore this.

Determining available compilation options

The compiler flags required for compiling GEOS-Chem, specifically MET and GRID, and in some cases NEST, TOMAS, RRTMG, or UCX, are automatically passed when you compile using the run directory Makefile. The flags are automatically set bu tje getRunInfo script, which parses the input.geos configuration file.

The GEOS-Chem Makefiles allow you to choose from several different options. The best way to learn about these options is to type:

make help

at the Unix prompt. Because the options might change from version to version, you should always use make help to find the specific options for the GEOS-Chem version that you are using.

Clean up files in the run directory

If you have created a fresh run directory, then there is no need to clean it prior to starting a simulation.

If you are reusing the same run directory to start a new GEOS-Chem simulation (i.e. for debugging or testing purposes), then we recommend that you remove any files that were generated by a prior simulation. This can be done by typing:

make cleanup_output

If you also want to remove all object (*.o), module (*.mod) and library (*.a) files in the GEOS-Chem code directory (CodeDir), then type:

make superclean

Build the GEOS-Chem or HEMCO standalone executable

To create the GEOS-Chem executable file, type:

make -j4 mpbuild

This will build the geos executable file and send all text output to the compile.log file.

NOTE: the -jN option will compile N files at a time. If you have 8 cores available to you, you can type make -j8 ..., etc.

Build the HEMCO standalone executable

To build the HEMCO standalone executable (if you are in a HEMCO standalone run directory), type:

make -j4 hcobuild

This will build the hemco_standalone.x executable file.

NOTE: the -jN option will compile N files at a time. If you have 8 cores available to you, you can type make -j8 ..., etc.

--Bob Yantosca (talk) 18:31, 20 December 2019 (UTC)

Information from the last time GEOS-Chem was compiled

When compiling from the run directory Makefile, a [[GEOS-Chem_log_files#The_lastbuild_filelog file called lastbuild]] will be created. This file contains the settings that were used to compile GEOS-Chem, for your reference.

Compiling from a run directory (in versions prior to 12.4.0)

Previous | Next | Getting Started with GEOS-Chem