Difference between revisions of "Compiling with GNU Make"

From Geos-chem
Jump to: navigation, search
(Setting up the run directory Makefile)
 
(50 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
 
'''''[[Compiling with CMake|Previous]] | [[Running GEOS-Chem|Next]] | [[Getting Started with GEOS-Chem]]'''''
 
'''''[[Compiling with CMake|Previous]] | [[Running GEOS-Chem|Next]] | [[Getting Started with GEOS-Chem]]'''''
#[[Minimum system requirements for GEOS-Chem|Minimum system requirements]]
+
#[[Minimum system requirements for GEOS-Chem|Minimum system requirements (and software installation)]]
 
#[[Configuring your computational environment]]
 
#[[Configuring your computational environment]]
 
#[[Downloading GEOS-Chem source code|Downloading source code]]
 
#[[Downloading GEOS-Chem source code|Downloading source code]]
Line 12: Line 12:
 
#[[Running GEOS-Chem|Running]]
 
#[[Running GEOS-Chem|Running]]
 
#[[GEOS-Chem output files|Output files]]
 
#[[GEOS-Chem output files|Output files]]
#[[Guide_to_visualization_and_analysis_tools_for_GEOS-Chem|Visualizing and processing output]]
+
#[[Python tools for use with GEOS-Chem]]
 
#[[GEOS-Chem_coding_and_debugging|Coding and debugging]]
 
#[[GEOS-Chem_coding_and_debugging|Coding and debugging]]
 
#[[GEOS-Chem_overview#Further_reading|Further reading]]
 
#[[GEOS-Chem_overview#Further_reading|Further reading]]
  
  
[[Image: Page is under construction.jpg]]
+
On this page, we describe how to compile GEOS-Chem using the GNU Make build system.
  
== GNU Make will be retired in GEOS-Chem 13.0.0 ==
+
== GNU Make was retired in GEOS-Chem 13.0.0 ==
  
== Compiling from a run directory ==
+
<span style="color:red">'''The GNU Make build system has been retired in both GEOS-Chem and GCHP 13.0.0.'''</span>  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.
  
<span style="color:red">'''*** RECOMMENDED COMPILING APPROACH ***'''</span>
+
GEOS-Chem "Classic" versions 12.6.0 through 12.9.* are compatible with both GNU Make and CMake.
  
All run directories downloaded from the GEOS-Chem Unit Tester come with a router Makefile that enables you to easily compile and run GEOS-Chem from the run directory. Using this feature enables you to eliminate certain compile options from the make command that are always the same for a given run directory (e.g. MET and GRID) and thereby avoid common mistakes. It also creates and stores compile logs locally for easy reference.
+
== Compiling GEOS-Chem "Classic" ==
  
Please see the [[Creating_GEOS-Chem_run_directories|''Creating GEOS-Chem run directories'' wiki page]] for instructions on how to create a GEOS-Chem run directory from the GEOS-Chem Unit Tester.  
+
[[Creating_GEOS-Chem_run_directories|Each run directory that you create]] contains 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.
  
=== Setting up the run directory Makefile ===
+
In this section, we list the steps that are needed to compile [[GEOS-Chem 12#12.4.0|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.
  
Once you have a run directory, open the Makefile in a text editor and edit the following three configurable variables with your preferences:
+
=== Run directory contents ===
  
# Source code location
+
The following files and folders are part of a typical run directoryThis example is for the <tt>geosfp_4x5_standard</tt> simulation.
ifndef CODE_DIR
+
  CODE_DIR :=/home/$(USER)/GC/Code.v11-01
+
  endif
+
+
# Output log file destination (default is run directory)
+
ifndef LOG_DIR
+
  LOG_DIR :=.
+
endif
+
  
 +
CodeDir@                              getRunInfo*      HISTORY.rc  OutputDir/
 +
download_data.py*                    HEMCO_Config.rc  input.geos  README
 +
GEOSChem.Restart.YYYYMMDD_hhmmz.nc4@  HEMCO_Diagn.rc  Makefile*  validate.pl*
  
Each of these three variables are automatically passed to the make command using the default values you define in this file. Alternatively, you may define them at the terminal within the make call. For example, if you want to override your default <tt>CODE_DIR</tt>, you can include <tt>CODE_DIR=/GC/Code.Ref</tt> to compile <tt>Code.Ref</tt> rather than <tt>Code.Dev</tt>.
+
#<tt>CodeDir</tt> is a symbolic link to the code directory that you specified when you created the run directory. 
 +
#<tt>Makefile</tt> is the run-directory Makefile. This controls the build sequence.  The Makefile relies on the <tt>getRunInfo</tt> script to obtain necessary information.
 +
#<tt>OutputDir</tt> is where diagnostic files will be placed.
 +
#<tt>input.geos</tt> and the <tt>*.rc</tt> files are [[GEOS-Chem_configuration_files|configuration files]] that allow you to specify settings for the GEOS-Chem simulation.
 +
#<tt>download_data.py</tt> is the data download script for the GEOS-Chem dry-run simulation (available in [[GEOS-Chem 12#12.7.0|12.7.0]] and later versions).
 +
#<tt>validate.pl</tt> is only used for GEOS-Chem unit tests and difference tests.  You can usually ignore this.
  
=== Makefile options ===
+
Earlier versions of GEOS-Chem might not have all of these files in the run directory.  For example, the <tt>CodeDir</tt> symbolic link was only added in [[#GEOS-Chem 12#12.3.0|GEOS-Chem 12.3.0]].
  
The compiler flags required for compiling GEOS-Chem, specifically <tt>MET</tt> and <tt>GRID</tt>, and in some cases <tt>NEST</tt>, <tt>TOMAS</tt>, <tt>RRTMG</tt>, or <tt>UCX</tt>, are automatically passed when you compile using the run directory Makefile. The flags are set using the <tt>getRunInfo</tt> perl script located in the run directory which reads the simulation information from the <tt>input.geos</tt> configuration file. If you wish to change any of these options you must create a new run directory.
+
=== Determining available compilation options ===
  
There are two processing modes available for compiling GEOS-Chem:
+
The GEOS-Chem Makefiles allow you to choose from several different user-definable options. The best way to learn about these options is to type:  
#Single processor ("sp")
+
#Multi-processor ("mp"), which uses [[Parallelizing_GEOS-Chem|OpenMP parallelization]]
+
 
+
Output files, including the GEOS-Chem executable <tt>geos</tt>, have a <tt>.sp</tt> or <tt>.mp</tt> suffix depending on what processing mode is used.
+
 
+
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
 
  make help
  
at the Unix prompt. If you are using '''''GEOS-Chem 12.4.0 or later''''', then you will see a screen similar to this:  
+
at the Unix prompt. Near the bottom of the printout you will see this section:
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
%%%    GEOS-Chem Run Directory Makefile Options        %%%
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
Usage: make -jN TARGET [OPTIONAL-FLAGS]
 
 
-jN              Compiles N files at a time (reduces compile time)
 
 
----------------------------------------------------------
 
TARGET may be one of the following:
 
----------------------------------------------------------
 
 
%%% COMPILE AND RUN %%%
 
all              Cleans, compiles, and runs GEOS-Chem
 
hco              Cleans, compiles, and runs HEMCO
 
 
%%% BUILD ONLY %%%
 
build            Compiles GEOS-Chem
 
hcobuild          Compiles HEMCO
 
 
%%% RUN ONLY %%%
 
run              Runs GEOS-Chem
 
hcorun            Runs HEMCO
 
 
%%% CLEAN UP %%%
 
cleanup_output    Synonym for: cleanup_data cleanup_logs
 
cleanup_data      Removes all GEOS-Chem diagnostic and restart file
 
cleanup_hco      Removes all HEMCO diagnostic and restart files
 
cleanup_logs      Removes all GEOS-Chem and HEMCO output log files
 
cleanup_exe      Removes all GEOS-Chem and HEMCO executable files
 
 
%%% CLEAN SOURCE CODE %%%
 
clean            Makes "clean" in source code directory ODE_DIR
 
realclean        Makes "realclean" in the source code directory ODE_DIR
 
tauclean          Removes all TAU files in the source code directory ODE_DIR
 
 
%%% CLEAN AND REMOVE ALL %%%
 
superclean        Synonym for: realclean tauclean cleanup_output cleanup_exe
 
 
%%% PRINT INFORMATION %%%
 
printruninfo      Prints the run settings for GEOS-Chem simulations
 
printruninfohco  Prints the run settings for HEMCO standalone simulations
 
printbuildinfo    Prints the build settings for GEOS-Chem simulations
 
printallinfo      Synonym for: printbuildinfo printruninfo
 
printcodeinfo    Print code directory git information
 
 
%%% UTILITIES %%%
 
help              Prints this help screen
 
%%% PRINT INFORMATION %%%
 
printruninfo      Prints the run settings for GEOS-Chem simulations
 
printruninfohco  Prints the run settings for HEMCO standalone simulations
 
printbuildinfo    Prints the build settings for GEOS-Chem simulations
 
printallinfo      Synonym for: printbuildinfo printruninfo
 
printcodeinfo    Print code directory git information
 
 
%%% UTILITIES %%%
 
help              Prints this help screen
 
 
 
  ----------------------------------------------------------
 
  ----------------------------------------------------------
 
  OPTIONAL-FLAGS may be one of the following:
 
  OPTIONAL-FLAGS may be one of the following:
Line 129: Line 65:
 
  TIMERS=1          Compiles GEOS-Chem with timers turned on
 
  TIMERS=1          Compiles GEOS-Chem with timers turned on
  
 +
Because the options might change from version to version, you should always use <tt>make help</tt> to find the specific options for the GEOS-Chem version that you are using.
  
or if you are using a version of GEOS-Chem older than 12.4.0, you will see this screen:
+
Please see the [[#Examples|Examples]] section below for some common compilation commands.
  
 +
=== 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.
%%%    GEOS-Chem Run Directory Makefile Help Screen    %%%
+
 
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
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.  
+
 
Usage: make -jN TARGET [OPTIONAL-FLAGS]
+
If you are using a recent version of GEOS-Chem (say [[GEOS-Chem 12#12.6.0|12.6.0]] or newer), you can clean up the run directory with:
+
 
-jN              Compiles N files at a time (reduces compile time)
+
  make cleanup_output
+
 
  ----------------------------------------------------------
+
But if you are using an older version (prior to 12.6.0), use this command instead:
TARGET may be one of the following:
+
 
----------------------------------------------------------
+
  make fileclean
all              Default target (synonym for "unittest")
+
 
+
If you also want to remove all object (*.o), module (*.mod) and library (*.a) files in the GEOS-Chem code directory (all GEOS-Chem versions), type:
  %%% COMPILE AND RUN %%%
+
 
unittest          Runs a GEOS-Chem unit test:
+
  make superclean
                  (1) Builds & runs GEOS-Chem with parallelization OFF;
+
 
                  (2) Builds & runs GEOS-Chem with parallelzation ON;
+
=== Build the GEOS-Chem executable ===
                  (3) Checks to see if the output is identical.
+
 
  sp                Builds and runs GEOS-Chem with parallelization OFF.
+
To create the GEOS-Chem executable file, type:
mp                Builds and runs GEOS-Chem with parallelization ON.
+
 
+
  make -j4 build [OPTIONS]
  %%% BUILD ONLY %%%
+
 
spbuild          Just builds GEOS-Chem with parallelization OFF.
+
This will build the <tt>geos</tt> executable file and send all text output to the <tt>compile.log</tt> file.
mpbuild          Just builds GEOS-Chem with parallelization ON.
+
 
+
If you are using a GEOS-Chem version prior to 12.4.0, use this command instead:
  %%% RUN ONLY %%%
+
 
sprun            Just runs GEOS-Chem with parallelization OFF.
+
  make -j4 mpbuild [OPTIONS]
  mprun            Just runs GEOS_Chem with parallelization ON.
+
 
+
<tt>[OPTIONS]</tt> denotes additional Makefile options that you wish to apply to the build. These are displayed with <tt>make help</tt>, as described above.
%%% REMOVE DATA FILES %%%
+
 
dataclean        Removes ALL GEOS-Chem diagnostic and restart files
+
''NOTE: the -jN option will compile N files at a time. If you have 8 cores available to you, you can type <tt>make -j8 ...</tt>, etc.''
spdataclean      Removes diagnostic and restart files from GEOS-Chem
+
 
                    simulations with parallelization turned OFF.
+
--[[User:Bmy|Bob Yantosca]] ([[User talk:Bmy|talk]]) 19:24, 20 December 2019 (UTC)
mpdataclean      Removes diagnostic and restart files from GEOS-Chem
+
 
                    simulations with parallelization turned ON.
+
=== Build the HEMCO standalone executable ===
+
 
%%% REMOVE LOG FILES %%%
+
To build the HEMCO standalone executable (if you are in a HEMCO standalone run directory), type:
  logclean          Removes all GEOS-Chem and HEMCO output log files.
+
 
splogclean        Removes GEOS-Chem and HEMCO log files from GEOS-Chem
+
  make -j4 hcobuild [OPTIONS]
                    simulations with parallelization turned OFF.
+
 
mplogclean        Removes GEOS-Chem and HEMCO log files from GEOS-Chems
+
This will build the <tt>hemco_standalone.x</tt> executable file.
                    simulations with parallelization turned ON.
+
 
+
''NOTE: the -jN option will compile N files at a time. If you have 8 cores available to you, you can type <tt>make -j8 ...</tt>, etc.''
%%% REMOVE EXECUTABLE FILES %%%
+
 
execlean          Removes all GEOS-Chem executable files
+
=== Log files created by the compilation ===
spexeclean        Removes GEOS-Chem executable files for which the
+
 
                    parallelization has been turned OFF.
+
GEOS-Chem version 12.6.0 and later will produce these compilation log files:
mpexeclean        Removes GEOS-Chem executable files for which the
+
 
                    parallelization has been turned ON.
+
#[[GEOS-Chem_log_files#compile.log_file|<tt>compile.log</tt>]]
   
+
#[[GEOS-Chem_log_files#The lastbuild file|<tt>lastbuild</tt>]]
%%% REMOVE ALL FILES %%%
+
 
fileclean        Synonym for: dataclean  logclean  execlean
+
Versions prior to this sent the compilation output (i.e. what would go into <tt>compile.log</tt>) into the GEOS-Chem log fileThe lastbuild file would have been named either:
spclean          Synonym for: spdataclean splogclean spexeclean
+
 
mpclean          Synonym for: mpdataclean mplogclean mpexeclean
+
#<tt>lastbuild.mp</tt>: Compilation output when <tt>make -j4 mpbuild</tt> was used (i.e. for multi-processor)
+
#<tt>lastbuild.sp</tt>: Compilation output when <tt>make -j4 spbuild</tt> was used (i.e. for single-processor)
%%% REMOVE CONFIG FILES %%%
+
 
extrafileclean  Removes input.geos and HEMCO_Config.rc files
+
=== Examples ===
+
 
%%% CLEAN SOURCE CODE %%%
+
Here are a few examples of the most common GEOS-Chem compilation commands with GNU Make:
clean            Makes "clean" in source code directory ODE_DIR
+
 
realclean        Makes "realclean" in the source code directory ODE_DIR
+
==== Build GEOS-Chem with debugging options ====
tauclean          Removes all TAU files in the source code directory ODE_DIR
+
 
+
To build GEOS-Chem with debugging flags turned on, use the command below. This will allow you to run GEOS-Chem in a debugger such as gdb:
%%% CLEAN AND REMOVE ALL %%%
+
 
  superclean        Synonym for: fileclean realclean
+
  make -j4 build DEBUG=y BOUNDS=y FPEX=y
+
  ...
+
  
To compile only, type the following at the command line, including any optional compiler flags as needed:
+
==== Build GEOS-Chem with timers ====
  
make -j4 mpbuild
+
To turn on GEOS-Chem timers, use:
  
Prior to compiling, <tt>geos.mp</tt>, <tt>lastbuild.mp</tt>, and all <tt>.mp</tt> log files will be removed from the directory by calling other make targets <tt>mpexeclean</tt> and <tt>mplogclean</tt>. All standard output generated while building the new executable will be displayed in your terminal window. The executable created will reside in the <tt>/bin</tt> directory within <tt>CODE_DIR</tt> and a copy will be placed in the run directory with name <tt>geos.mp</tt>. Finally, your compile settings will be stored in log <tt>lastbuild.mp</tt> and will also be printed to the terminal window. The unix commands for each of these steps is stored under various targets in the Makefile. Note that you make call any of the make targets from the command line (e.g. <tt>make mplogclean</tt> to remove all <tt>.mp</tt> logs). You can then [[Running GEOS-Chem|submit your GEOS-Chem simulation]] to your local cluster's queue using a simple script.
+
make -j4 build TIMERS=1
  
For testing purposes, you may also  compile and run GEOS-Chem interactively, by typing the following at the command line:
+
etc.
  
make -j4 mp
+
--[[User:Bmy|Bob Yantosca]] ([[User talk:Bmy|talk]]) 16:31, 2 January 2020 (UTC)
  
With this option, output data files are appended with the <tt>.mp</tt> suffix except for restart and HEMCO diagnostic files that do not correspond to the simulation end date.  
+
== Compiling GCHP (prior to 13.0.0) ==
  
The GNU Make utility is a powerful and flexible software development tool and we encourage you to explore the existing Makefile options and to customize the Makefile to optimize your own needs.
+
GCHP versions prior to 13.0.0 use GNU Make as well.  But the compilation process is more complex than for GEOS-Chem "Classic".  For more information, please see [[Compiling GCHP|our ''Compiling GCHP'' wiki page]].
  
--[[User:Lizzie Lundgren|Lizzie Lundgren]] 10:59, 22 April 2015 (EDT)
+
--[[User:Bmy|Bob Yantosca]] ([[User talk:Bmy|talk]]) 19:25, 20 December 2019 (UTC)
  
=== Information from the last time GEOS-Chem was compiled ===
+
== Further reading ==
  
When compiling from the run directory Makefile, a [[GEOS-Chem_log_files#The_lastbuild_filelog file called <tt>lastbuild</tt>]] will be created.  This file contains the settings that were used to compile GEOS-Chem, for your reference.
+
#[https://www.gnu.org/software/make/ GNU Make home page]
 +
#[https://www.gnu.org/software/make/manual/ GNU Make manual]
 +
#[https://opensourceforu.com/2012/06/gnu-make-in-detail-for-beginners/ ''GNU Make in detail for beginners'' (Open Source for you)]
 +
#[[GEOS-Chem coding and debugging]]
 +
#''[[Guide to GEOS-Chem error messages]]''
  
  
 
----
 
----
 
'''''[[Compiling with CMake|Previous]] | [[Running GEOS-Chem|Next]] | [[Getting Started with GEOS-Chem]]'''''
 
'''''[[Compiling with CMake|Previous]] | [[Running GEOS-Chem|Next]] | [[Getting Started with GEOS-Chem]]'''''

Latest revision as of 15:23, 4 August 2022

Previous | Next | Getting Started with GEOS-Chem

  1. Minimum system requirements (and software installation)
  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. Python tools for use with GEOS-Chem
  11. Coding and debugging
  12. Further reading


On this page, we describe how to compile GEOS-Chem using the GNU Make build system.

GNU Make was retired in GEOS-Chem 13.0.0

The GNU Make build system has been 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"

Each run directory that you create contains 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*      HISTORY.rc  OutputDir/
download_data.py*                     HEMCO_Config.rc  input.geos  README
GEOSChem.Restart.YYYYMMDD_hhmmz.nc4@  HEMCO_Diagn.rc   Makefile*   validate.pl*
  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. download_data.py is the data download script for the GEOS-Chem dry-run simulation (available in 12.7.0 and later versions).
  6. validate.pl is only used for GEOS-Chem unit tests and difference tests. You can usually ignore this.

Earlier versions of GEOS-Chem might not have all of these files in the run directory. For example, the CodeDir symbolic link was only added in GEOS-Chem 12.3.0.

Determining available compilation options

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

make help

at the Unix prompt. Near the bottom of the printout you will see this section:

----------------------------------------------------------
OPTIONAL-FLAGS may be one of the following:
----------------------------------------------------------
DEBUG=y           Compiles GEOS-Chem with various debugging options
BOUNDS=y          Compiles GEOS-Chem with out-of-bounds error checks
FPE=y             Compiles GEOS-Chem with floating-point math error checks
TRACEBACK=y       Compiles GEOS-Chem with traceback error printout (this is the default)
TIMERS=1          Compiles GEOS-Chem with timers turned on

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.

Please see the Examples section below for some common compilation commands.

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.

If you are using a recent version of GEOS-Chem (say 12.6.0 or newer), you can clean up the run directory with:

make cleanup_output

But if you are using an older version (prior to 12.6.0), use this command instead:

make fileclean

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

make superclean

Build the GEOS-Chem executable

To create the GEOS-Chem executable file, type:

make -j4 build [OPTIONS]

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

If you are using a GEOS-Chem version prior to 12.4.0, use this command instead:

make -j4 mpbuild [OPTIONS]

[OPTIONS] denotes additional Makefile options that you wish to apply to the build. These are displayed with make help, as described above.

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) 19:24, 20 December 2019 (UTC)

Build the HEMCO standalone executable

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

make -j4 hcobuild [OPTIONS]

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.

Log files created by the compilation

GEOS-Chem version 12.6.0 and later will produce these compilation log files:

  1. compile.log
  2. lastbuild

Versions prior to this sent the compilation output (i.e. what would go into compile.log) into the GEOS-Chem log file. The lastbuild file would have been named either:

  1. lastbuild.mp: Compilation output when make -j4 mpbuild was used (i.e. for multi-processor)
  2. lastbuild.sp: Compilation output when make -j4 spbuild was used (i.e. for single-processor)

Examples

Here are a few examples of the most common GEOS-Chem compilation commands with GNU Make:

Build GEOS-Chem with debugging options

To build GEOS-Chem with debugging flags turned on, use the command below. This will allow you to run GEOS-Chem in a debugger such as gdb:

make -j4 build DEBUG=y BOUNDS=y FPEX=y

Build GEOS-Chem with timers

To turn on GEOS-Chem timers, use:

make -j4 build TIMERS=1

etc.

--Bob Yantosca (talk) 16:31, 2 January 2020 (UTC)

Compiling GCHP (prior to 13.0.0)

GCHP versions prior to 13.0.0 use GNU Make as well. But the compilation process is more complex than for GEOS-Chem "Classic". For more information, please see our Compiling GCHP wiki page.

--Bob Yantosca (talk) 19:25, 20 December 2019 (UTC)

Further reading

  1. GNU Make home page
  2. GNU Make manual
  3. GNU Make in detail for beginners (Open Source for you)
  4. GEOS-Chem coding and debugging
  5. Guide to GEOS-Chem error messages



Previous | Next | Getting Started with GEOS-Chem