Sample initialization script for GEOS-Chem

From Geos-chem
Revision as of 21:28, 8 December 2020 by Bmy (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Previous | Next | Getting Started with GEOS-Chem

  1. Minimum system requirements
  2. Installing required software
  3. Configuring your computational environment
  4. Downloading source code
  5. Downloading data directories
  6. Creating run directories
  7. Configuring runs
  8. Compiling
  9. Running
  10. Output files
  11. Python tools for use with GEOS-Chem
  12. Coding and debugging
  13. Further reading


Sample initialization script using Lmod modules

This sample initialization script is based on an actual script used on the Harvard Cannon cluster. The script uses the Lmod module system to load the GNU Fortran compiler version 7.1 (which is part of the GNU Compiler Collection, or GCC). The script is named init.gc-classic.gfortran71.centos7, and it is invoked with:

source init.gc-classic.gfortran71.centos7 

By default, this will set the OMP_NUM_THREADS to 1. If you wish to tell GEOS-Chem to run on e.g. 6 computational cores, you can type:

source init.gc-classic.gforgran71.centos7 6

The module load commands in the script below may be different on your system.

 #==============================================================================
 # %%%%% Clear existing environment variables %%%%%
 #==============================================================================
 unset PERL_HOME
 unset IDL_HOME
 unset EMACS_HOME
 unset CC
 unset CXX
 unset FC
 unset F77
 unset F90
 unset NETCDF_BIN
 unset NETCDF_HOME
 unset NETCDF_INCLUDE
 unset NETCDF_LIB
 unset NETCDF_FORTRAN_BIN
 unset NETCDF_FORTRAN_HOME
 unset NETCDF_FORTRAN_INCLUDE
 unset NETCDF_FORTRAN_LIB
 unset GC_BIN
 unset GC_INCLUDE
 unset GC_LIB
 unset GC_F_BIN
 unset GC_F_INCLUDE
 unset GC_F_LIB
 unset OMP_NUM_THREADS
 unset OMP_STACKSIZE
  
 #==============================================================================
 # %%%%% Load modules for GNU Fortran 7.1 %%%%%
 #
 # NOTE: Your module load commands may be different than these.
 # Ask your IT staff for more information.
 #==============================================================================
 echo "Loading modules for compiler gfortran71 ..."
 module purge
 module load git/2.17.0-fasrc01
 module load perl/5.26.1-fasrc01
 module load IDL/8.4.1-fasrc01
 module load flex/2.6.4-fasrc01
 module load gcc/7.1.0-fasrc01
 module load openmpi/2.1.0-fasrc02
 module load netcdf/4.3.2-fasrc05
 module load netcdf-fortran/4.4.0-fasrc03
 module load cdo/1.9.4-fasrc02
 module load nco/4.7.4-fasrc01
 module load ncview/2.1.7-fasrc02
 module load emacs/26.1-fasrc01
 module load cmake/3.12.1-fasrc01
 module list
 
 # Define F90 and F77 environment variables (may be needed by some software)
 export F90=$FC
 export F77=$FC
 
 #==============================================================================
 # %%%%% Settings for OpenMP parallelization %%%%%
 #==============================================================================
 
 # Max out the stack memory for OpenMP
 # Asking for a huge number will just give you the max availble
 export OMP_STACKSIZE=500m
 
 # By default, set the number of threads for OpenMP parallelization to 1
 export OMP_NUM_THREADS=1
 
 # Redefine number threads for OpenMP parallelization
 # (a) If in a SLURM partition, set OMP_NUM_THREADS = SLURM_CPUS_PER_TASK
 # (b) Or, set OMP_NUM_THREADS to the optional first argument that is passed
 if [[ -n "${SLURM_CPUS_PER_TASK+1}" ]]; then
   export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
 elif [[ "$#" -eq 1 ]]; then
   if [[ "x$1" != "xignoreeof" ]]; then
      export OMP_NUM_THREADS=$1
   fi
 fi
 echo "Number of OpenMP threads: $OMP_NUM_THREADS"
 
 #==============================================================================
 # %%%%% Define relevant environment variables %%%%%
 #==============================================================================
 
 # Machine architecture
 export ARCH=`uname -s`
 
 # NETCDF_HOME
 if [[ "x$NETCDF_HOME" == x ]]; then
   export NETCDF_HOME=`nc-config --prefix`
   fi
 fi

--Bob Yantosca (talk) 14:13, 2 December 2020 (UTC)


Previous | Next | Getting Started with GEOS-Chem