Skip to content

Using GEOStag for multiple clone management

Yonggang Yu edited this page Jul 31, 2023 · 15 revisions

1 Rationale:

The GEOSgcm and GEOSadas source codes have very deep source trees with long names making directory navigation a pain. In addition, once you have more than one clone of the model, managing the multiple source codes becomes a challenge. In order to facilitate nagigating from one code version to another, we have developed some scripts to assist.

2 Overview

The scripts described in this document address several issues. First select which clone when you have multiple checkouts to use, loading the correct modules, and finally setting alias's to the various source directories. They rely on keeping all model clones in one directory. This script can work with the GEOSctm/GEOSadas/GEOSgcm as long as they are in one consistent location.

3 Prerequisite

It is assumed that you have the utility fd. It can be found at:

/discover/swdev/mathomp4/local-SLES12/bin/fd

Make sure fd is available in your path.

4 Procedure

4.1 Step 1

For cshell Users

Copy the following 2 files to your own bin/ and home directory:

cp /home/bmauer/bin/geostagx $HOME/bin
cp /home/bmauer/g5env.fd $HOME

Then define an alias in your .tcshrc and make sure geostagx is in your path.

alias your_alias_name 'geostagx \!* ; source ~/.geostag ; source ~/g5env.fd'

For bash Users

For bash users, copy the following two files into your bin/ directory:

cp /gpfsm/dhome/mathomp4/SampleGeostag/g5env.sh $HOME
cp /gpfsm/dhome/mathomp4/SampleGeostag/geostagx.sh $HOME/bin

Then define an alias in your .bashrc:

alias geostag='$HOME/bin/geostagx.sh ; source $HOME/.geostag.sh ; source $HOME/g5env.sh'

4.2 Step 2

In the geostagx or geostag.sh script you set the the location of your model clones by changing the variable MODELDIR in your copy of geostagx. All model clones must be under this directory in distinct folders. In other words, from $MODELDIR, make a directory with a descriptive name then go in there and clone, so if you have 2 copies of the GCM and one ADAS clone it might look like this:

  • $MODELDIR/GCM1/GEOSgcm
  • $MODELDIR/GCM2/GEOSgcm
  • $MODELDIR/ADAS1/GEOSadas

Once you have have your models in one consistent location, run the alias you made which will run geostagx. You should see a numbered list of all the models you have checked out in that location.

It will ask you for a number. Once chosen, it will source the g5_modules script for that model and set a bunch of aliases by sourcing g5env.fd; for example if you type "base" it will take you to the top level directory that contains src. Typing "src" takes you to the src directory. Typing "phys" will take you to the physics gridded component. Just look in the g5env.fd to see all the aliases it defines. In addition you now have the correct modules loaded for that particular model clone and can safely make a build directory, run cmake, and install.