Skip to content

Commit

Permalink
Merge pull request #19 from fetch4/jwallwork23/giss-gc-14-rebased
Browse files Browse the repository at this point in the history
Upgrade `develop` to v14.3.1
  • Loading branch information
jwallwork23 authored Aug 20, 2024
2 parents a22b1c0 + f9fec59 commit b12e037
Show file tree
Hide file tree
Showing 25 changed files with 2,126 additions and 283 deletions.
111 changes: 111 additions & 0 deletions .github/modelErc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# This file contains global options for modelE.
# By default it assumes that the directory structure for modelE runs
# is set under /home/joe/data/giss-gc .

## Directory structure ##

# DECKS_REPOSITORY - a directory for permanenet storage of run info.
# All rundecks that you create will be copied to this directory.
DECKS_REPOSITORY=/__w/GISS-GC/GISS-GC/run/prod_decks

# CMRUNDIR - directory to which all run directories will be linked.
# This directory will be searched by most scripts for locations of
# specific runs.
CMRUNDIR=/__w/GISS-GC/GISS-GC/run/prod_runs

# GCMSEARCHPATH - directory to search for gcm input files.
# All necessary input files should be copied or linked to this directory.
GCMSEARCHPATH=/__w/GISS-GC/GISS-GC/run/prod_input_files

# EXECDIR - path to directory with modelE scripts and with some
# executables. This directory should contain the scripts from modelE/exec.
EXECDIR=/__w/GISS-GC/GISS-GC/run/exec

# SAVEDISK - a directory where all run directories (which will contain
# all output files such as rsf, acc etc.) will be created. This should
# be big enough to accomodate all model output.
SAVEDISK=/__w/GISS-GC/GISS-GC/run/huge_space

## External libraries ##

# Some of these options can be provided by environment modules (if you
# use them). Specify here only what is necessary. Options specified
# here will overwrite options proviided by environment modules.

# NETCDFHOME - path to location of netcdf installation directory.
NETCDFHOME=${NETCDF_F_HOME}

# MPI - set to YES if you want to compile the model for parallel
# execution on multiple CPU cores. Keep in mind, that functional
# MPI library should be installed on your computer and its type
# and location should be specified below.
# This option can be overwritten from the compile line.
MPI=YES

# MPIDISTR - the MPI distribution you are using. Currently supported
# distributions are: 'intel, 'openmpi', 'mpich2', 'mvapich2', 'SCALI',
# 'mpt'
MPIDISTR=openmpi

# MPIDIR - path to the MPI installation directory. (Needs to be set
# only if compiler can't find correct MPI library and include files by
# default)
# MPIDIR=/opt/openmpi
MPIDIR=${MPI_ROOT}

# MPILIBDIR - path to the location of MPI library. Set it only if
# it is different from the default $MPIDIR/lib
# MPILIBDIR=/opt/openmpi/lib

# MPIINCLUDEDIR - path to location of MPI include files. Set it only
# if it is different from the default $MPIDIR/include
# MPIINCLUDEDIR=/opt/openmpi/include

# ESMF5_DIR - path to the installation directory of ESMF (version 5)
# library. (Required only for Cubed Sphere simulations)
# ESMF5_DIR=

# ESMF_BOPT - optimization level of ESMF library. (Should only be used
# togeteher with ESMF5_DIR)
# ESMF_BOPT=O
ESMF=NO

## Architecture and compiler

# ABI - Application Binary Interfaces. This variable specifies the
# architecture you are using. The valid values are '64' and '32'.
# On most modern systems you should use '64'. Use '32' if your
# hardware or compiler support only 32-bit binaries.
ABI=64

# COMPILER - specifies the Fortran compiler you are using. Currently
# only 'intel' and 'gfortran' are supported. ('nag' has partial
# support on development branch.) If you are using Modules for
# Environment Management, then this variable may already be set in the
# environment. In this case you don't need to set it here.
COMPILER=gfortran

## General User Preferences ##

# MAILTO - email address of the user. When the program ends/crashes
# all notifications will be sent to this address. Leave empty
# or unset if you don't want to receive these emails
MAILTO=

# UMASK - the value of 'umask' you want to use for model runs. The files
# inside the run directory will have permissions set according to this
# mask.
UMASK=002

# OVERWRITE - can "gmake rundeck" overwrite files already in repository?
# (i.e. in the directory DECKS_REPOSITORY)
OVERWRITE=NO

# OUTPUT_TO_FILES - if set to YES all errors and warnings will be sent
# to files with the names <source_name>.ERR
OUTPUT_TO_FILES=NO

# VERBOSE_OUTPUT - if set to YES gmake will show compilation commands
# and some other information. Otherwise most of the output will be
# suppressed
VERBOSE_OUTPUT=YES
131 changes: 131 additions & 0 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Test suite

on:
# Trigger the CI whenever a commit is pushed to main or develop, i.e., a PR is merged
push:
branches: [main, develop]

# Trigger the CI whenever a commit is pushed to an open PR
pull_request:

env:
# Environment variables for GISS modelE
GISS_HOME: /__w/GISS-GC/GISS-GC
ModelE_Support: /__w/GISS-GC/GISS-GC/run
DATA: /__w/GISS-GC/GISS-GC/run/prod_input_files
# Environment variables for compiler
CC: gcc
CXX: g++
FC: gfortran
F90: gfortran
F77: gfortran
# Misc. environment variables
F_UFMTENDIAN: big
KMP_STACKSIZE: 100000000
OMP_NUM_THREADS: 36

jobs:
# Test that GISS-GC can be compiled without error
compile:
runs-on: ubuntu-22.04
container:
image: ghcr.io/fetch4/giss-gc-dev-env:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}

steps:
- uses: actions/checkout@v2

- name: Setup submodules
run: |
git config --global --add safe.directory ${GISS_HOME}
git submodule init
git submodule update
- name: Create fake inputs
run: |
# Make run directories
mkdir -p ${DATA}
mkdir -p ${ModelE_Support}/exec
mkdir -p ${ModelE_Support}/huge_space
mkdir -p ${ModelE_Support}/prod_decks
mkdir -p ${ModelE_Support}/prod_runs
# Fake input files
touch ${DATA}/CD144X90.ext.nc
touch ${DATA}/cloud.epsilon4.72x46
touch ${DATA}/CO2profile.Jul16-2017.txt
touch ${DATA}/CROPS_and_pastures_Pongratz_to_Hurtt_144X90N_nocasp.nc
touch ${DATA}/dH2O_by_CH4_monthly
touch ${DATA}/GHG.CMIP6.1-2014.txt
touch ${DATA}/GIC.144X90.DEC01.1.ext_1.nc
touch ${DATA}/GLMELT_144X90_gas.OCN.nc
touch ${DATA}/H2Ocont_MT_CKD
touch ${DATA}/Irrig144x90_1848to2100_FixedFuture_v3.nc
touch ${DATA}/ISCCP.tautables
touch ${DATA}/LWCorrTables33k
touch ${DATA}/LWTables33k_lowH2O_CO2_O3_planck_1-800
touch ${DATA}/miescatpar.abcdv2
touch ${DATA}/MSU_SSU_RSS_weights.txt
touch ${DATA}/NCARIC.144x90.D7712010_ext.nc
touch ${DATA}/o3_2010_shindell_144x90x49_April1850.nc
touch ${DATA}/oct2003.relhum.nr.Q633G633.table
touch ${DATA}/OST_144x90.1876-1885avg.CMIP6.nc
touch ${DATA}/RD_Fd.nc
touch ${DATA}/RD_Fd.names.txt
touch ${DATA}/REG2X2.5
touch ${DATA}/S144X900098M.ext.nc
touch ${DATA}/sgpgxg.table8
touch ${DATA}/SICE_144x90.1876-1885avg.CMIP6.nc
touch ${DATA}/soil_textures_top30cm_2x2.5
touch ${DATA}/soilcarb_top30cm_2x2.5.nc
touch ${DATA}/solar.CMIP6official.ann1850-2299_with_E3_fastJ.nc
touch ${DATA}/STRATAER.VOL.1850-2014_CMIP6_hdr
touch ${DATA}/top_index_144x90_a.ij.ext.nc
touch ${DATA}/topcld.trscat8
touch ${DATA}/V144x90_EntMM16_height_trimmed_scaled_ext.nc
touch ${DATA}/V144x90_EntMM16_lai_max_trimmed_scaled_ext.nc
touch ${DATA}/V144x90_EntMM16_lai_trimmed_scaled_ext.nc
touch ${DATA}/V144x90_EntMM16_lc_max_trimmed_scaled_nocrops.ext.nc
touch ${DATA}/Z2HX2fromZ1QX1N.BS1.nc
touch ${DATA}/ZSIfac_144x90.1876-1885avg.CMIP6.nc
touch ${DATA}/ZVAR2X25A.nc
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/BCA
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/BCB
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/BCdalbsn
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/DUST
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/NIT
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/O3
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/OCA
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/SSA
mkdir -p ${DATA}/cmip6_nint_inputs_E14TomaOCNf10_4av_decadal/SUL
mkdir -p ${DATA}/nudging/merra2
touch ${DATA}/nudging/merra2/uwnd.2014.MERRA2onGISSE2.nc4
touch ${DATA}/nudging/merra2/vwnd.2014.MERRA2onGISSE2.nc4
touch ${DATA}/nudging/merra2/uwnd.2015.MERRA2onGISSE2.nc4
touch ${DATA}/nudging/merra2/vwnd.2015.MERRA2onGISSE2.nc4
touch ${DATA}/nudging/merra2/uwnd.2016.MERRA2onGISSE2.nc4
touch ${DATA}/nudging/merra2/vwnd.2016.MERRA2onGISSE2.nc4
- name: Build GISS-GC with GISS_GC_14 rundeck
run: |
. /opt/spack-environment/activate.sh
export RUNID=GISS_GC_14
# Environment variables for passing NetCDF-C paths to GEOS-Chem
export NETCDF_HOME=$(nc-config --prefix)
export GC_BIN=${NETCDF_HOME}/bin
export GC_INCLUDE=${NETCDF_HOME}/include
export GC_LIB=${NETCDF_HOME}/lib
# Environment variables for passing NetCDF-Fortran paths to GEOS-Chem
export NETCDF_F_HOME=$(nf-config --prefix)
export GC_F_BIN=${NETCDF_F_HOME}/bin
export GC_F_INCLUDE=${NETCDF_F_HOME}/include
export GC_F_LIB=${NETCDF_F_HOME}/lib
# Environment variable for OpenMPI build
export MPI_ROOT=/opt/software/linux-ubuntu22.04-skylake/gcc-11.4.0/openmpi-4.1.6-s3fu5gvaasgjy4jecnb6rvemx7oofexx
# Copy over rundeck and modelErc
cp .github/rundecks/${RUNID}.R decks
cp .github/modelErc ~/.modelErc
# Build the model
cd decks
make -j setup RUN=${RUNID} F90=mpif90 GC=YES
16 changes: 12 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[submodule "model/geos-chem/src"]
path = model/geos-chem/src
url = git@github.com:fetch4/geos-chem.git
branch = dev/giss-gc
[submodule "model/geos-chem/src/GEOS-Chem"]
path = model/geos-chem/src/GEOS-Chem
url = https://github.com/fetch4/geos-chem.git
branch = dev/giss-gc-14
[submodule "model/geos-chem/src/HEMCO"]
path = model/geos-chem/src/HEMCO
url = https://github.com/fetch4/HEMCO.git
branch = dev/giss-gc-14
[submodule "model/geos-chem/src/Cloud-J"]
path = model/geos-chem/src/Cloud-J
url = https://github.com/fetch4/Cloud-J.git
branch = dev/giss-gc-14
10 changes: 9 additions & 1 deletion config/compiler.gfortran.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ endif
FMAKEDEP = $(SCRIPTS_DIR)/sfmakedepend
CPPFLAGS += -DCOMPILER_G95
FFLAGS = -g -cpp -fconvert=big-endian -O2 -fno-range-check -fallow-argument-mismatch
F90FLAGS = -g -cpp -fconvert=big-endian -O2 -fno-range-check -ffree-line-length-none -fallow-argument-mismatch
F90FLAGS = $(FFLAGS) -ffree-line-length-none
LFLAGS =
ifeq ($(GC),YES)
LFLAGS += -nostartfiles -Wno-main
endif
ifeq ($(MP),YES)
FFLAGS += -fopenmp
F90FLAGS += -fopenmp
LFLAGS += -fopenmp
endif

F90_VERSION = $(shell $(F90) --version | head -1)

Expand Down
13 changes: 8 additions & 5 deletions config/compiler.intel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ IFORT_RELEASE := $(shell ifort --version | perl -e \
'while(<>){ if(/ifort.* (\d+\.\d+)/) { print "$$1"; } }')
FMAKEDEP = $(SCRIPTS_DIR)/sfmakedepend
CMP_MOD = $(SCRIPTS_DIR)/compare_module_file.pl -compiler INTEL-ifort-9-0-on-LINUX
FFLAGS = -fpp -O2 -ftz -convert big_endian
F90FLAGS = -fpp -O2 -ftz -convert big_endian -free
FFLAGS = -fpp -O2 -ftz -convert big_endian
F90FLAGS = $(FFLAGS) -free
LFLAGS = -O2 -ftz
ifeq ($(GC),YES)
LFLAGS += -nostartfiles -nofor-main
endif
CPPFLAGS += -DCOMPILER_Intel8 -DCONVERT_BIGENDIAN
F90_VERSION = $(shell $(F90) -v 2>&1)
ifeq ($(MP),YES)
FFLAGS += -openmp
F90FLAGS += -openmp
LFLAGS += -openmp
FFLAGS += -qopenmp
F90FLAGS += -qopenmp
LFLAGS += -qopenmp
endif
R8 = -r8
EXTENDED_SOURCE = -extend_source
Expand Down
53 changes: 30 additions & 23 deletions config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -229,36 +229,43 @@ endif

ifneq ($(CUBED_SPHERE),YES)

ifdef NETCDFHOME
ifneq ($(wildcard $(NETCDFHOME)/include/netcdf.inc),)
NETCDFINCLUDEDIR ?= $(NETCDFHOME)/include
else
ifneq ($(wildcard $(NETCDFHOME)/include/netcdf-3/netcdf.inc),)
NETCDFINCLUDEDIR ?= $(NETCDFHOME)/include/netcdf-3
ifneq ($(and $(NETCDF_HOME),$(NETCDF_F_HOME)),)
LIBS += -L$(NETCDF_HOME)/lib -lnetcdf -L$(NETCDF_F_HOME)/lib -lnetcdff
FFLAGS += -I$(NETCDF_HOME)/include -I$(NETCDF_F_HOME)/include
F90FLAGS += -I$(NETCDF_HOME)/include -I$(NETCDF_F_HOME)/include
INCS += -I$(NETCDF_HOME)/include -I$(NETCDF_F_HOME)/include
else
ifdef NETCDFHOME
ifneq ($(wildcard $(NETCDFHOME)/include/netcdf.inc),)
NETCDFINCLUDEDIR ?= $(NETCDFHOME)/include
else
$(error NetCDF include files not found)
ifneq ($(wildcard $(NETCDFHOME)/include/netcdf-3/netcdf.inc),)
NETCDFINCLUDEDIR ?= $(NETCDFHOME)/include/netcdf-3
else
$(error NetCDF include files not found)
endif
endif
endif

ifneq ($(wildcard $(NETCDFHOME)/$(LIBABI)/libnetcdf*),)
NETCDFLIBDIR ?= $(NETCDFHOME)/$(LIBABI)
else
NETCDFLIBDIR ?= $(NETCDFHOME)/lib
ifneq ($(wildcard $(NETCDFHOME)/$(LIBABI)/libnetcdf*),)
NETCDFLIBDIR ?= $(NETCDFHOME)/$(LIBABI)
else
NETCDFLIBDIR ?= $(NETCDFHOME)/lib
endif
endif
endif

ifdef NETCDFINCLUDEDIR
FFLAGS += -I$(NETCDFINCLUDEDIR)
F90FLAGS += -I$(NETCDFINCLUDEDIR)
INCS += -I$(NETCDFINCLUDEDIR)
endif
ifdef NETCDFINCLUDEDIR
FFLAGS += -I$(NETCDFINCLUDEDIR)
F90FLAGS += -I$(NETCDFINCLUDEDIR)
INCS += -I$(NETCDFINCLUDEDIR)
endif

ifdef NETCDFLIBDIR
LIBS += -L$(NETCDFLIBDIR) -lnetcdf
ifeq ($(wildcard $(NETCDFLIBDIR)/libnetcdff.*),)
ifdef NETCDFLIBDIR
LIBS += -L$(NETCDFLIBDIR) -lnetcdf
else
LIBS += -L$(NETCDFLIBDIR) -L/opt/local/lib -lnetcdff -lnetcdf
ifeq ($(wildcard $(NETCDFLIBDIR)/libnetcdff.*),)
LIBS += -L$(NETCDFLIBDIR) -lnetcdf
else
LIBS += -L$(NETCDFLIBDIR) -L/opt/local/lib -lnetcdff -lnetcdf
endif
endif
endif

Expand Down
Loading

0 comments on commit b12e037

Please sign in to comment.