After installing an application, variables such as PATH
and LD_LIBRARY_PATH
must be set in order to call the application from any directory.
The preferred method of setting the environment is to use the module load
command. Typing module avail
shows the modules installed by staff that are available system wide.
Users may also create their own custom modules.
mkdir /usr/local/usrapps/$GROUP/modulefiles
mkdir /usr/local/usrapps/$GROUP/modulefiles/appname
#%Modulefollowed by definitions for the environment variables. To see examples of how to define the environment variables, see the contents of various staff created modules here: /usr/local/apps/modulefiles. For an example of a more complex module file, see one of the Intel modules, e.g., /opt/intel/modulefiles/intel/2017.1.132.
#%Module set ModulesVersion [app version number]-[name and version of compiler]
To load the module, the whole path may be specified
module load /usr/local/usrapps/$GROUP/modulefiles/appname/[app version number]-[name and version of compiler]
Alternatively, the path to the modulefiles can be added by doing the following. (Do not add a slash '/' after modulefiles.)
module use --append /usr/local/usrapps/$GROUP/modulefilesAfter doing
module use --append
, the custom modules should be visible when typing module avail
, and then modules may be loaded as usual:
module load appname
Here is a full example of creating a module. This was done to install and create a module for SPAdes in the software group bioinfo. (Only members of bioinfo can access this module.)
The following was done to install SPAdes:
mkdir /usr/local/usrapps/bioinfo/spades cd /usr/local/usrapps/bioinfo/spades wget http://cab.spbu.ru/files/release3.14.0/SPAdes-3.14.0-Linux.tar.gz tar -xzf SPAdes-3.14.0-Linux.tar.gz rm SPAdes-3.14.0-Linux.tar.gz
This results in a directory called SPAdes-3.14.0-Linux, containing the directories
bin #contains the executables share #often contains documentation
To create the module, first create the modulefiles and appname directories:
mkdir /usr/local/usrapps/bioinfo/modulefiles cd /usr/local/usrapps/bioinfo/modulefiles mkdir spades cd spadesSPAdes was downloaded as a binary executable rather than being compiled; therefore, the naming convention is appname/[app version number]. The version number was 3.14.0.
From the directory /usr/local/usrapps/bioinfo/modulefiles/spades, create a text file called 3.14.0 containing
#%Module prepend-path PATH {/usr/local/usrapps/bioinfo/spades/SPAdes-3.14.0-Linux/bin};
In case there are or will be other versions of SPAdes installed, set 3.14.0 as default by creating a file /usr/local/usrapps/bioinfo/modulefiles/spades/.version containing
#%Module set ModulesVersion 3.14.0
The module for SPAdes may be called from the command line or from an LSF batch script by doing
module load /usr/local/usrapps/bioinfo/modulefiles/spades/3.14.0or by doing
module use --append /usr/local/usrapps/bioinfo/modulefiles module load spades
To make the modules available upon logging in, without having to specify the full path or doing module use
, add the following to the ~/.tcsh or ~/.bashrc file:
#User defined modules module use --append /usr/local/usrapps/bioinfo/modulefiles
Usually modifications to the login files (.tcsh, .bashrc., .login) are discouraged, but this an appropriate use case for modifying those files.