Skip to content

Getting Started as a Simulation Developer

If you are expecting to do software development (or even “try this tag” testing), you’ll want to have a coherent environment and setup scripts for yourself, to override the default production environment.

Personal SuperSim Build

If you are developing the CDMS simulation code, you can set up a work environment to support that, and still have access to most of the production
packages.

First create a bin directory in your home. 
Then you can start with my own setup script, which you’ll edit later:

$ mkdir -p ~/bin
$ cp ~kelsey/bin/supersim-setup ~/bin

You should now have a supersim-setup file located in the ~/bin directory. We will modify this later. 

This script assumes you’ve set up a /scratch/user/<usernname>/software area. If you don’t have one, create it using mkdir (similar to above). In that space, check out the SuperSim package:

$ cd ~/software
$ git clone git@gitlab.com:SuperCDMS/Simulations/supersim
$ cd supersim
$ export G4WORKDIR=`pwd -P'

Manually set up the CDMS development environment:

$ source cdms-dev_setup

Then set up your SuperSim clone and build it:

$ CDMSbuild/setup --nodeps
$ source CDMSbuild/g4setup.sh
$ make all

You should have gotten directories named ‘lib’ and ‘bin’ created for you, and those diretories should contain the SuperSim libraries and executables,
respectively. If you type `which CDMS_GGSim`, it should show you the executable in your clone’s “bin” directory path.

Customizing the Setup Script


Now that you have successfully built SuperSim, your clone is in a state where you can use the setup script I mentioned at the beginning. Bring up
your local ~/bin/supersim-setup in your editor (Emacs or VIM or whatever). This is one of the first things you copied from above.

The second line of the script needs the path to your clone. It currently has my personal path in there. Edit the line to point to your SuperSim
clone directory (which you can get by typing:

$ echo $CDMS_SUPERSIM

in the terminal session where you did the build above).

Since you did not make your own clone of G4CMP, you want to make use of the centrally built version. Find the two lines that say,

module unload G4CMP
unset G4CMPINSTALL

This will keep the original G4CMP module loaded, which is what you want. 

To test whether this works, you’ll need to open a fresh terminal session. In the new terminal, type the commands,

$ source supersim-setup
$ which CDMS_GGSim

If you did everything properly, it should tell you that the CDMS_GGSim executable is in your clone’s “bin” directory path, just as in the previous
session above.

Verifying Operations

With this built, you can go to the SuperSim documentation in Confluence. 

You can also try the beginning tutorials in the Simulations Working Group area.

Modifying the SuperSim Code

From now on, you can edit the code in your clone area, you can switch branches, create new branches and submit code to GitLab, etc. Any time you
modify what you have in your clone area, you should rebuild, so that the libraries and executables match the source code. Generally,

$ cd $CDMS_SUPERSIM
$ make all

should be sufficient, and should typically take just a couple of minutes.

Sometimes, especially if you change which tag you have active, you will need to do a “clean build,” to get rid of obsolete things in the libraries:

$ cd $CDMS_SUPERSIM
$ make clean all

The full clean build takes as long as the original build you did at the beginning (anywhere from 15 to 30 minutes, in my experience), because it’s
recompiling everything.

Notes for Experienced Developers

For experienced developers, you may decide you need multiple clones of SuperSim to work on different feature branches. In that case, you’ll probably want separate setup scripts, or you’ll want to modify the setup script to take a directory name argument to switch to the clone you want.