GEOS GCM Quick Start

Revision as of 07:03, 1 June 2020 by Mathomp4 (talk | contribs)

This page describes the minimum steps required to build and run GEOS GCM on NCCS discover and NAS pleiades. You should successfully complete the steps in these instructions before doing anything more complicated. Also, it is helpful to read this page in its entirety before starting.

Back to Documentation for GEOS GCM v10

How to Obtain GEOS GCM and Compile Source Code

There are two options for obtaining the model source code: from the CVS repository on the NCCS progress server, and from the SVN "public" repository on the trac server. Since the code on progress is more current, elgible users are strongly encouraged to obtain accounts from NCCS and use the progress repository.

Using the NCCS CVS code repository

The following assumes that you know your way around Unix, have successfully logged into your cluster account and have an account on the source code repository with the proper ssh configuration -- see the NCCS repository quick start pages at: https://www.nccs.nasa.gov/trac/admin/wiki/QuickStart. The link requires your NCCS username and password. The recommend SSH config setup for CVS on discover is:

Host cvsacldirect
    HostName cvsacl.nccs.nasa.gov
    Port 22223

That's it. Progress is not needed unless you specifically know you need it. It won't hurt to add it, but at present it isn't needed. Also, you'll need to generate RSA or ED25519 keys and upload them (this is mentioned in the quick start page above) to https://www.nccs.nasa.gov/keyupload/. (NOTE: DSA keys are not recommended as some sites, e.g., NAS, have started disallowing them.) The usual way of doing this is to go to your .ssh directory and run ssh-keygen, making a key with no password:

$ cd $HOME/.ssh
$ ssh-keygen -o -a 100 -b 3072 -t rsa

The commands below assume that your shell is csh. Since the scripts to build and run GEOS tend to be written in the same, you shouldn't bother trying to import too much into an alternative shell. If you prefer a different shell, it is easiest just to open a csh process to build the model and your experiment.

Furthermore, model builds should be created in your space under /discover/nobackup, as creating them under your home directory will quickly wipe out your disk quota.

Set the following three environment variables:

setenv CVS_RSH ssh
setenv CVSROOT :ext:USERID@cvsacldirect:/cvsroot/esma

where USERID is, of course, your repository username, which should be the same as your NASA and NCCS username. Then, issue the command:

cvs co -r Jason-3_0 GEOSagcm

This should check out the latest stable version of the model from the repository and create a directory called GEOSagcm.

CVS Errors

If the CVS checkout doesn't work for you, there are many possibilities.

Keyupload

If the error says something about "keyupload", then the key upload either hasn't taken hold yet (can take 5-10 minutes to work after uploading the key), or, perhaps, the wrong key was uploaded.

Access denied for this host

If you see something like "access denied for this host", then your best bet is to contact NCCS. Per a response from NCCS to a user that had something similar happen, they need to add the CVS hosts to an LDAP entry.

Failed to create lock/permission denied

If you see something like:

cvs checkout: failed to create lock directory for `/cvsroot/esma/CVSROOT' (/cvsroot/esma/CVSROOT/#cvs.history.lock): Permission denied
cvs checkout: failed to obtain history lock in repository `/cvsroot/esma'
cvs checkout: Updating src
cvs checkout: failed to create lock directory for `/cvsroot/esma/esma/src/Applications/GEOSdas' (/cvsroot/esma/esma/src/Applications/GEOSdas/#cvs.lock): Permission denied
cvs checkout: failed to obtain dir lock in repository `/cvsroot/esma/esma/src/Applications/GEOSdas'
cvs [checkout aborted]: read lock failed - giving up

this means you don't have a home directory on progress. Try doing:

$ ssh progress.nccs.nasa.gov

You'll enter your PASSCODE and password and then it'll seem like the terminal is "stuck". Just hit Ctrl-C. Now try the CVS command again.

Compiling the Model

First, you need to set ESMADIR. For example, if your src/ directory is:

/discover/nobackup/mathomp4/Models/Jason-3_0/GEOSagcm/src

then you should set:

setenv ESMADIR /discover/nobackup/mathomp4/Models/Jason-3_0/GEOSagcm

Next, we need to source g5_modules with:

source $ESMADIR/src/g5_modules

This will set up the build environment. If you then type

module list 

you should see:

Currently Loaded Modulefiles:
 1) other/comp/gcc-6.3
 2) comp/intel-18.0.1.163
 3) mpi/sgi-mpt-2.17
 4) lib/mkl-18.0.1.163
 5) other/SIVO-PyD/spd_1.25.0_gcc-6.3_mkl-17.0.4.196

If this all worked, then type:

cd $ESMADIR/src
gmake install

This will build the model. It will take about 30 minutes. If this works, it should create a directory under GEOSagcm called Linux/bin. In here you should find the executable: GEOSgcm.x .

Setting up a Run

Passwordless Logins

First of all, to run jobs on the cluster you will need to set up passwordless ssh (which operates within the cluster, between the nodes running the job). To do so, run the following from your discover home directory:

 cat id_rsa.pub >>  authorized_keys

Similarly, transferring the daily output files (in monthly tarballs) requires passwordless authentication from discover to dirac. While in ~/.ssh on discover, run

 ssh-copy-id -i id_rsa.pub dirac

Then, log into dirac and cut and paste the contents of the id_rsa.pub file on discover into the ~/.ssh/authorized_keys file on dirac. Problems with ssh should be referred to NCCS support.

DSA Keys

Note: Due to evolution of security, it is recommended to not use DSA keys. NAS currently doesn't not allow them, and RSA and ED25519 keys are considered "better" anyway.

Setting up a model run

To set the model up to run, cd to GEOSagcm/src/Applications/GEOSgcm_App and run:

./gcm_setup

The gcm_setup script asks you to provide an experiment name :

Enter the Experiment ID:

Your experiment name (later called EXPID) should be one word with no spaces, not starting with a numeral. Then the script will ask for a description:

Enter a 1-line Experiment Description:

Spaces are ok here. It will then ask for the source code version tag to associate with the model -- you should hit enter for the default:

Enter an Experiment Source Tag for History (Default: Jason-3_0):

Hit enter for the default to the next question:

Do you wish to CLONE an old experiment? (Default: NO or FALSE)

It will also ask you for the atmospheric model resolution, expecting the code for one of the displayed resolutions.

Enter the Atmospheric Horizontal Resolution code:
-----------------------------------------------------------
     Lat/Lon                     Cubed-Sphere
-----------------------------------------------------------
   b --  2  deg                c48  --  2   deg 
   c --  1  deg                c90  --  1   deg 
   d -- 1/2 deg                c180 -- 1/2  deg (56-km) 
   e -- 1/4 deg (35-km)        c360 -- 1/4  deg (28-km)  
                               c720 -- 1/8  deg (14-km) 
                               c1440 - 1/16 deg ( 7-km) 

For your first time out you will probably want to enter c48 (corresponding to ~2 degree resolution with the cubed sphere). On the next eight questions, hitting enter to accept the default will let you run a PChem run:

Enter the Atmospheric Model Vertical Resolution: LM (Default: 72)

Do you wish to run the COUPLED Ocean/Sea-Ice Model? (Default: NO or FALSE)

Enter the Data_Ocean Horizontal Resolution code: o1 (1  -deg,  360x180  Reynolds) Default
                                                 o2 (1/4-deg, 1440x720  MERRA-2)
                                                 o3 (1/8-deg, 2880x1440 OSTIA)

Do you wish to run GOCART with Actual or Climatological Aerosols? (Enter: A (Default) or C)


Enter the GOCART Emission Files to use: MERRA2 (Default), PIESA, CMIP, NR, MERRA2-DD or OPS:

Enter the tag or directory (/filename) of the HISTORY.AGCM.rc.tmpl to use
(To use HISTORY.AGCM.rc.tmpl from current build, Type:  Current         )
-------------------------------------------------------------------------
Hit ENTER to use Default Tag/Location: (Current)

NOTE: Some/Many things are easier if your HOME and EXPERIMENT directories are the same. For the next two, look carefully at the default and make sure they are both pointing to the same nobackup location.

Enter Desired Location for the HOME Directory (to contain scripts and RC files)
Hit ENTER to use Default Location:
----------------------------------
Default:  /discover/nobackup/USER/EXPID

Enter Desired Location for the EXPERIMENT Directory (to contain model output and restart files)
Hit ENTER to use Default Location:
----------------------------------
Default:  ~USER/geos5/EXPID
/discover/nobackup/USER/EXPID 

Enter Location for Build directory containing:  src/ Linux/ etc...
Hit ENTER to use Default Location:
----------------------------------
Default:  /discover/nobackup/USER/GEOSagcm 

After these it will ask you for a group ID -- the default for this writer is g0620 (GMAO modeling group). Enter whatever is appropriate, as necessary.

 Current GROUPS: g0620 gmaoint
Enter your GROUP ID for Current EXP: (Default: g0620)
-----------------------------------


The script will produce some messages and create an experiment directory (EXPDIR) in your space as /discover/nobackup/USERID/EXPID, which contains the files and sub-directories:

  • AGCM.rc -- resource file with specifications of boundary conditions, initial conditions, parameters, etc.
  • archive/ -- contains job script for archiving output
  • CAP.rc -- resource file with run job parameters
  • convert -- contains job script that converts restarts (initial condition files) from older model versions
  • ExtData.rc -- sample resource file for external data, not used
  • forecasts/ -- contains scripts used for data assimilation mode
  • fvcore_layout.rc --
  • gcm_run.j -- run script
  • GEOSgcm.x -- model executable
  • HISTORY.rc -- resource file specifying the fields in the model that are output as data
  • plot/ -- contains plotting job script template and .rc file
  • post/ -- contains the script template and .rc file for post-processing model output
  • RC/ -- contains resource files for various components of the model
  • regress/ -- contains scripts for doing regression testing of model
  • src -- directory with a tarball of the model version's source code


The post-processing script will generate the archiving and plotting scripts as it runs. The setup script that you ran also creates an experiment home directory (HOMDIR) as either in ~USERID/geos5/EXPID (if you accepted the default) or in /discover/nobackup/USERID/EXPID (if you followed the above advice) containing the run scripts and GEOS resource (.rc) files.

Running GEOS-5

Before running the model, there is some more setup to be completed. The run scripts need some environment variables set in ~/.cshrc (regardless of which login shell you use -- the GEOS-5 scripts use csh). Here are the minimum contents of a .cshrc:

umask 022
unlimit
limit stacksize unlimited
set arch = `uname`

The umask 022 is not strictly necessary, but it will make the various files readable to others, which will facilitate data sharing and user support. Your home directory ~USERID is also inaccessible to others by default; running chmod 755 ~ is helpful.

Copy the restart (initial condition) files and associated cap_restart into EXPDIR. You can get an arbitrary set of restarts by copying the contents of the directory /discover/nobackup/mathomp4/Restarts-I30/nc4/Reynolds/c48, containing 2-degree cubed sphere restarts from April 14, 2000, and their corresponding cap_restart.

The script you submit, gcm_run.j, is in HOMEDIR. It should be ready to go as is. The parameter END_DATE in CAP.rc can be set to the date you want the run to stop. Submit the job with sbatch gcm_run.j. You can keep track of it with squeue or squeue -u USERID, or follow stdout with tail -f EXPDIR/slurm-JOBID.out, JOBID being returned by sbatch and displayed with squeue. Jobs can be killed with scancel JOBID.

Output and Plots

During a normal run, the gcm_run.j script will run the model for the segment length (current default is 15 days in model time). The model creates output files (with an nc4 extension), also called collections (of output variables), in EXPDIR/scratch directory. After each segment, the script moves the output to the EXPDIR/holding and spawns a post-processing batch job which partitions and moves the output files within the holding directory to their own distinct collection directory, which is again partitioned into the appropriate year and month. The post processing script then checks to see if a full month of data is present. If not, the post-processing job ends. If there is a full month, the script will then run the time-averaging executable to produce a monthly mean file in EXPDIR/geosgcm_*. The post-processing script then spawns a new batch job which will archive the data onto the mass-storage drives (/archive/u/USERID/GEOS5.0/EXPID).

If a monthly average file was made, the post-processing script will also check to see if it should spawn a plot job. Currently, our criteria for plotting are: 1) if the month created was February or August, AND 2) there are at least 3 monthly average files, then a plotting job for the seasons DJF or JJA will be issued. The plots are created as gifs in EXPDIR/plots_CLIM.

The post-processing script can be found in: GEOSagcm/src/GMAO_Shared/GEOS_Util/post/gcmpost.script. The nc4 output files can be opened and plotted with grads -- see http://www.iges.org/grads/gadoc/tutorial.html for a tutorial, but use sdfopen instead of open.

The contents of the output files (including which variables get saved) may be configured in the HOMEDIR/HISTORY.rc -- a good description of this file may be found at http://modelingguru.nasa.gov/clearspace/docs/DOC-1190 .


Back to Documentation for GEOS GCM v10

Contact Matthew Thompson at GMAO with questions and comments