Difference between revisions of "Sample initialization script for GEOS-Chem"

From Geos-chem
Jump to: navigation, search
(Created page with "__FORCETOC__ '''''Previous | Next | Getting Started with GEOS-Chem''''' #Minimum sy...")
 
Line 19: Line 19:
  
 
[[Image:Page is under construction.jpg]]
 
[[Image:Page is under construction.jpg]]
 +
 +
== 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 <tt>init.gc-classic.gfortran71.centos7</tt> and can be invoked with:
 +
 +
source init.gc-classic.gfortran.centos7
 +
 +
The module load commands may be different on your system.
 +
 +
<nowiki> #==============================================================================
 +
# %%%%% 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: Must Specify version numbers
 +
#==============================================================================
 +
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
 +
 +
# NETCDF_BIN
 +
if [[ "x$NETCDF_BIN" == x ]]; then
 +
  export NETCDF_BIN="$NETCDF_HOME/bin"
 +
fi
 +
 +
# GC_LIB (deprecated)
 +
if [[ "x$NETCDF_LIB" == x ]]; then
 +
  export GC_LIB="$NETCDF_HOME/lib"
 +
else
 +
  export GC_LIB="$NETCDF_LIB"
 +
fi
 +
 +
# GC_INCLUDE (deprecated)
 +
if [[ "x$NETCDF_INCLUDE" == x ]]; then
 +
  export GC_INCLUDE="$NETCDF_HOME/include"
 +
else
 +
  export GC_INCLUDE="$NETCDF_INCLUDE"       
 +
fi
 +
 +
# GC_BIN (deprecated)
 +
export GC_BIN="$NETCDF_HOME/bin"
 +
 +
# If the netCDF-Fortran library is loaded separately
 +
# then also define the GC_F_* environment variables (deprecated)
 +
if [[ "x$NETCDF_FORTRAN_HOME" != x ]]; then
 +
  export NETCDF_FORTRAN_BIN="$NETCDF_FORTRAN_HOME/bin"
 +
  export GC_F_BIN="$NETCDF_FORTRAN_HOME/bin"
 +
  export GC_F_INCLUDE="$NETCDF_FORTRAN_INCLUDE"
 +
  export GC_F_LIB="$NETCDF_FORTRAN_LIB"
 +
fi</nowiki>
 +
  
  
 
----
 
----
 
'''''[[Specifying software libraries for GEOS-Chem|Previous]] | [[Downloading GEOS-Chem source code|Next]] | [[Getting Started with GEOS-Chem]]'''''
 
'''''[[Specifying software libraries for GEOS-Chem|Previous]] | [[Downloading GEOS-Chem source code|Next]] | [[Getting Started with GEOS-Chem]]'''''

Revision as of 21:31, 19 December 2019

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
  8. Running
  9. Output files
  10. Visualizing and processing output
  11. Coding and debugging
  12. Further reading

Page is under construction.jpg

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 can be invoked with:

source init.gc-classic.gfortran.centos7

The module load commands 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: Must Specify version numbers
 #==============================================================================
 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
 
 # NETCDF_BIN
 if [[ "x$NETCDF_BIN" == x ]]; then
   export NETCDF_BIN="$NETCDF_HOME/bin"
 fi
 
 # GC_LIB (deprecated)
 if [[ "x$NETCDF_LIB" == x ]]; then 
   export GC_LIB="$NETCDF_HOME/lib"
 else
   export GC_LIB="$NETCDF_LIB"
 fi
 
 # GC_INCLUDE (deprecated)
 if [[ "x$NETCDF_INCLUDE" == x ]]; then
   export GC_INCLUDE="$NETCDF_HOME/include"
 else
   export GC_INCLUDE="$NETCDF_INCLUDE"         
 fi
 
 # GC_BIN (deprecated)
 export GC_BIN="$NETCDF_HOME/bin"
 
 # If the netCDF-Fortran library is loaded separately
 # then also define the GC_F_* environment variables (deprecated)
 if [[ "x$NETCDF_FORTRAN_HOME" != x ]]; then
   export NETCDF_FORTRAN_BIN="$NETCDF_FORTRAN_HOME/bin"
   export GC_F_BIN="$NETCDF_FORTRAN_HOME/bin"
   export GC_F_INCLUDE="$NETCDF_FORTRAN_INCLUDE"
   export GC_F_LIB="$NETCDF_FORTRAN_LIB"
 fi



Previous | Next | Getting Started with GEOS-Chem