1.1: Compiling GCAM core model - jayfuhrman/gcam-hpc-starterpack GitHub Wiki

TEMPORARY: CLONING AND COMPILING GCAM (REPLACES THIS PORTION IN MAKESCRIPT.SH)

Note: this page largely replicates what is found on the the JGCRI wiki page on how to setup and build GCAM, but attempts to be even more accessible for beginner HPC users, building off of accumulated knowledge from UVA's high-performance computing support, JGCRI staff, and past and current UVA graduate students

Load the required libraries:

https://rivanna-portal.hpc.virginia.edu/pun/sys/dashboard/batch_connect/sessions

Open a terminal window on Rivanna (using MobaXterm or FastX) and type the following: (Note that these libraries worked with GCAM 5.4 on Rivanna as of Fall semester 2021. If the build fails because GCAM requires updated libraries or they are no longer maintained on Rivanna, you may need to contact UVA HPC support for help with loading the correct libraries, which you will also need to load in the same order when you run GCAM).

module purge

module load xerces java

module load gcc/7.1.0

module load intel/20.0 intelmpi/20.0 eigen/3.4-rc1 boost

module load git

Clone the gcam repository, as well as this repository:

git clone https://github.com/JGCRI/gcam-core.git

git clone https://github.com/jayfuhrman/gcam-hpc-starterpack.git

Before attempting to compile/run GCAM, you will need to substitute your computing ID in two and only two files: makescript.sh and master.sh shell scripts.

Once you've cloned GCAM and this installation helper directory successfully, copy (cp) the gcam_build.setup file from this install directory into gcam core. This file contains path information to the libraries on Rivanna that GCAM will require to compile:

cp gcam-hpc-starterpack/gcam_build.setup gcam-core

cd (change directory) into your newly-created gcam-core directory:

cd gcam-core

Now, "make" (build/compile) GCAM's simple climate model, Hector

make clean

make install_hector

If this doesn't work, follow the instructions for compiling hector provided by JGCRI here.

Finally, load the environment variables and then build the gcam executable file (note that this will fail if you do not first do the previous step).

source gcam_build.setup

the gcam_build.setup file will likely need to be modified with environment variables for your specific cluster. Consult the generic instructions for installing GCAM and it's dependent libraries here

make gcam -j 16

The compile process should take ~30-40 minutes. When it completes, a "BUILD COMPLETE" message should print in your terminal window, and there will be a new gcam.exe file created in the exe directory.

Run gcamdata to create the input files GCAM requires

cd input/gcamdata

module load goolf/7.1.0_3.1.4 R

R

#an R session will open in your terminal

https://github.com/JGCRI/gcamdata/wiki/1.-Getting-Started

install.packages(c("dplyr", "tidyr", "readr", "testthat", "assertthat", "roxygen2","data.table","devtools"))

devtools::install_github("krlmlr/mockr")

devtools::load_all()

driver(write_outputs = FALSE, write_xml = TRUE)

#the gcamdata R package should run for 30-40 mins and create a bunch of xml input files in input/gcamdata/xml