On our Linux systems, most software resources are made available via modules. Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command which interprets modulefiles. Typically modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system and users may have their own collection to supplement or replace the shared modulefiles.
This allows us to offer a large array of software to many users without the packages interfering with each other.
Using built-in modules
We provide many built-in modules for loading software packages and compilers. You can see a list of these by running ls /etc/modulefiles/*
OR module avail
on any Desktop, Hallway, or Classroom workstation.
Let's say, for example, you wish to use MPI. You can use the /etc/modulefiles/mpi/openmpi-x86_64
to make openmpi available to your shell.
To do this, simply run:
$ module load mpi/openmpi-x86_64
To show the current list of loaded modules, run:
$ module list
If you want to unload a module, run:
$ module unload mpi/openmpi-x86_64
Creating custom modules
You may wish to customize the Linux environment for your jobs on your own. You can create your own custom module to accomplish this.
First, create a directory for your modules:
$ mkdir ~/modules
Then, add the module path to the end of your ~/.bashrc
file:
export MODULEPATH=${MODULEPATH}:${HOME}/modules
or add the following to your ~/.cshrc
or ~/.tcshrc
if you use the tcsh shell:
setenv MODULEPATH ${MODULEPATH}:${HOME}/modules
A module can be as simple as setting a few environment variables (such as PATH
and LD_LIBRARY_PATH
) or can be complicated Tcl scripts.
You can refer to any of our existing modules in the /etc/modulefiles
directory as templates for creating your own. For example, the /etc/modulefiles/orca
module includes the following directives:
Provide basic information about what the module does:
#%Module 1.0
#
# Orca module
#
module-whatis "Set path for orca."
Add the ORCA executable directory to the path, so that ORCA runs when the 'orca' command is typed:
prepend-path PATH /panfs/storage.local/opt/orca_3_0_0_linux_x86-64
Set an environment variable necessary for ORCA to run:
setenv RSH_COMMAND ssh
Running module load orca
will make those alterations to the environment. running module unload orca
will remove them.
For a more complex example, refer to /etc/modulefiles/gaussian09
. This module file examines what architecture the module is run and adjusts its paths accordingly.
For a complete reference of module file directives, refer to the modulefile man page (man modulefile
).