In this exercise we will set up some simple customizations and try some examples with modules. At this point, log in to Frontera. If you have already set up some customizations, you may want to back them up before proceeding, and then restore them afterwards.

To customize the environment on Frontera, we will edit the .bashrc file in your $HOME directory. This file should be sourced by .profile. To verify this, open it with your text editor or choice, and verify that it has the following lines (if not, then add them):


if [ -f $HOME/.bashrc ]; then
  source $HOME/.bashrc
fi

Now, open your .bashrc file and notice the structure. TACC has already added some customizations by default for your convenience. If you have the default script, you will see a section beginning on line 40 where you can load modules, for example. Let's prepare to add a module there.

Say you have written your own code that you would like to run on Frontera, and you have a Singularity container with your code in it. Then you will want to load Singularity into your environment before you can use your container. You can view which modules have been loaded into your environment by default with module list and verify that no Singularity module was loaded. So, let's search for it:


$ module spider singularity

----------------------------------------------------------------------------
tacc-singularity: tacc-singularity/3.7.5
----------------------------------------------------------------------------
Description:
Application and environment virtualization

...

We can see that TACC uses a module called tacc-singularity. We can load the specific version shown by module spider by entering ml tacc-singularity/3.7.5. Since only one version is available, it isn't necessary to supply a version number. (Furthermore, without a version number, the default version is automatically selected, when several are available.) Going back into your .bashrc with a text editor, add module load tacc-singularity in Section 1, after the example comment line: # module load git. You can verify that this does what you expect by logging out and back in, and executing module list to see that it now includes tacc-singularity/3.7.5.

Say instead you installed some software in the bin directory of your home directory, or you simply copied a binary there, and you want to make it available through the path environment variable so that it can be executed by name on a command line. If you open up your .bashrc, you will see that in Section 2 of the default script supplied by TACC, there is an example for adding the $HOME/bin directory to the head of your path:


###################################################################
# **** PLACE Environment Variables including PATH here.        ****
###################################################################

# export PATH=$HOME/bin:$PATH

You can simply uncomment this example and place your binaries there, or you can specify a custom directory. Remember to log out and log back in to see the changes, or you can source the file to see them immediately.

One last example of a handy customization is to add aliases. Aliases can be used for many things, but they are convenient for simplifying your workflow. For example, say you often mistype ls for listing as sl but do not want this to hinder your workflow. A solution is to alias the mistyped command to execute the correct one. Before you do this, it is important to verify that you are not going to obscure a command of the same name by accident. For this we are safe because trying sl yields:


$ sl
-bash: sl: command not found

So now open .bashrc and in Section 2 after the "Place anything else below" comment, add:


alias sl=ls

Now source the file or log off and on again to test it out. If you type sl within your shell, it will list files and directories as if you had typed ls correctly. The possibilities of customization are quite endless. Try out what makes your workflow comfortable and convenient.

To return to the default setup and erase all customizations that we've made today, as well as those you may have set up before this exercise, execute:


$ /usr/local/startup_scripts/install_default_scripts
 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement