Difference between revisions of "Sample initialization script for GEOS-Chem"
From Geos-chem
Line 17: | Line 17: | ||
#[[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]] | ||
− | |||
− | |||
== Sample initialization script using Lmod modules == | == Sample initialization script using Lmod modules == | ||
Line 59: | Line 57: | ||
# %%%%% Load modules for GNU Fortran 7.1 %%%%% | # %%%%% Load modules for GNU Fortran 7.1 %%%%% | ||
# | # | ||
− | # NOTE: | + | # NOTE: Your module load commands may be different than these. |
+ | # Ask your IT staff for more information. | ||
#============================================================================== | #============================================================================== | ||
echo "Loading modules for compiler gfortran71 ..." | echo "Loading modules for compiler gfortran71 ..." | ||
Line 117: | Line 116: | ||
fi | fi | ||
− | + | # GC_LIB | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | # GC_LIB | + | |
if [[ "x$NETCDF_LIB" == x ]]; then | if [[ "x$NETCDF_LIB" == x ]]; then | ||
export GC_LIB="$NETCDF_HOME/lib" | export GC_LIB="$NETCDF_HOME/lib" | ||
Line 129: | Line 123: | ||
fi | fi | ||
− | # GC_INCLUDE | + | # GC_INCLUDE |
if [[ "x$NETCDF_INCLUDE" == x ]]; then | if [[ "x$NETCDF_INCLUDE" == x ]]; then | ||
export GC_INCLUDE="$NETCDF_HOME/include" | export GC_INCLUDE="$NETCDF_HOME/include" | ||
Line 136: | Line 130: | ||
fi | fi | ||
− | # GC_BIN | + | # GC_BIN |
export GC_BIN="$NETCDF_HOME/bin" | export GC_BIN="$NETCDF_HOME/bin" | ||
Revision as of 21:46, 19 December 2019
Previous | Next | Getting Started with GEOS-Chem
- Minimum system requirements
- Configuring your computational environment
- Specifying compilers for GEOS-Chem
- Specifying software libraries for GEOS-Chem
- Specifying parallelization settings
- A sample initialization script
- Downloading source code
- Downloading data directories
- Creating run directories
- Configuring runs
- Compiling
- Running
- Output files
- Visualizing and processing output
- Coding and debugging
- 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 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: 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 # GC_LIB if [[ "x$NETCDF_LIB" == x ]]; then export GC_LIB="$NETCDF_HOME/lib" else export GC_LIB="$NETCDF_LIB" fi # GC_INCLUDE if [[ "x$NETCDF_INCLUDE" == x ]]; then export GC_INCLUDE="$NETCDF_HOME/include" else export GC_INCLUDE="$NETCDF_INCLUDE" fi # GC_BIN 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