What are Environment Modules
Modules provide a great way to easily customize your shell environment, especially on the fly. The module command syntax is the same no matter which command shell which you are using.
How to use Environment Modules - Interactive Use
To find the list of software for which your environment may be set up for you via the module command, enter module availmodule load xxx will load the environment settings required by the xxx software package. For example, module load dot will add the current directory to your command search path.
module unload xxx may then be used to remove extras added to the environment for the xxx software package. This is extremely useful in situations where different package settings clash.
To automate environment customisation at each login tcsh users can add module load commands to their $HOME/.login file whilst bash users can add module load commands to their $HOME/.profile file. However users should beware! The whole point of module files is to setup the enviroment for the execution of applications. Since different applications can have incompatible environment requirements, loading multiple application modules in your shell's dot file is likely to lead to problems. As it is so easy to enter module load xxx at the time xxx is required, we suggest that users load a minimal set of modules in their dot files.
If you wish to define your own modules to set up your environment, you will need to module load use.own and then define the personalised module files under $HOME/privatemodules. Follow the example null module file provided in $HOME/privatemodules after you have entered module load use.own ; module load modules, and read man modulefile.
You can access any 'info' documentation that is available for the software you have enabled by using xemacs and selecting Help, Manuals, and Info from the menu.
How to use Environment Modules - Batch Jobs
To use software package xxx in a csh, sh or bash batch job script it is a simple matter of specifyingmodule load xxxNotes
- csh and tcsh batch scripts will have the module command available without any special care to be taken on your part.
- for bash batch scripts to work with module commands, the BASH_ENV environment variable needs to be set to $HOME/.bashrc. $HOME/.bashrc currently sources the appropriate /etc/bashrc file. Your default environment is set up so that this will work. Don't change it!
- sh is not recommended as contrary to the man page description of the invocation of a sh script, even with the ENV variable set to $HOME/.bashrc, it does not get sourced at the start of the script execution. This results in module command not found type errors. If you really must use sh instead of bash you will need to source $HOME/.bashrc at the beginning of the script before any attempts to use module load commands.
We encourage the use of the PBS -lsoftware= flag to avoid any issues with licensing on nodes, or during upgrade of software packages. See the appropriate packages entry in the software page for details of the expected package name for this flag.
Module Sub-Commands
The following table is a subset of the module sub-commands.To see all sub-commands, enter
module load modules man module
Command Notes module help [modulefile...] Print the usage of each sub-command. If an argument is given, print the Module specific help information for the modulefile. module load modulefile [modulefile...] Load modulefile into the shell environment. module unload modulefile [modulefile...] Remove modulefile from the shell environment. module list List loaded modules. module avail [path...] List all available modulefiles in the current MODULEPATH. All directories in the MODULEPATH are recursively searched for files containing the modulefile magic cookie. If an argument is given, then each directory in the MODULEPATH is searched for modulefiles whose pathname match the argument. Multiple versions of an application can be supported by creating a subdirectory for the application containing modulefiles for each version. module whatis [modulefile [modulefile...]] Display the modulefile information set up by the module-whatis commands inside the specified modulefiles. If no modulefiles are specified all whatis information lines will be shown. module keyword string Seeks through the whatis informations of all modulefiles for the specified string. All module whatis informations matching the string search will be displayed.
Define your own Modules
Apart from the environment modules available in the system area, you can define your own modules.module load use.ownThis will set up the $HOME/privatemodules directory with an initial module file called null. It will also change your MODULEPATH environment variable to ensure that the module command looks for the modules in your own area. Usemodule load modules man modulefilefor further information on writing your own modules.