Installing your own modules

From IBERS Bioinformatics and HPC Wiki
Jump to: navigation, search

A module is essentially a way of controlling which programs or tools are loaded in your environment at any one time, allowing for version control. The IBERS HPC has some universally available modules to load, and polite requests to admins can see new modules added to this. However this can take time and effort, so an alternative is to make modules available for just yourself or for a group.

These are some key commands:

module avail - lists the modules available

module list - lists the modules currently loaded

module load <module name> - loads named module

module unload <module name> - unloads named module

To set up a module, you need two things - first the executables which are generally placed in one directory called apps, but really could be anywhere as long as you know where they are. The second is a modulefile, which are kept together in one location in a directory suitably called modulefiles. The path to the module files then is added to your $MODULEPATH, which can be done in the .bashrc file.

1. Install the program:

Download and install the program according to instructions provided in its own appropriately named directory. This would best be done in a directory called apps, which can be placed somewhere sensible such as your home directory or in a shared directory if the modules are to be group accessible. Any already installed programs can be copied into apps, but note that some programs make have to be recompiled if certain paths have to be specified for it to function properly. These may require reinstalling from source.

2. Make the modulefile

All of the modulefiles are kept in the modulefiles directory, which can either be local to you or in a shared directory if other people are to load modules. If you plan on installing multiple versions of the same program it is good to create a directory named after the program, then have one modulefile for each version in that directory. Then make the following modulefile, changing the <text> as necessary (If other modules are required, load them here too, otherwise this part can be removed).

#%Module -*- tcl -*-
## modulefile
proc ModulesHelp { } {
    puts stderr "\t<Text about the program>." 

<module load <pre-requisite module>>

module-whatis "<Text about the program>"

prepend-path      PATH              /path/to/apps/program

3. Append modulefile path to $MODULEPATH (one time occurrence):

You will now need to append the path to the module files to your $MODULEPATH variable, which tells the module command where to look for modulefiles, which in turn say where to look for the executables. One way to do this is in your .bashrc file in your home directory, add this line:

#add local modules to module path:
export MODULEPATH="$MODULEPATH:/path/to/modulefiles" 

Then do source .bashrc to activate this.

Repeat this for anyone in the group who wants to be able to load these modules.

Now when you type module avail, the program(s) you have installed should be listed under the dashed section with the header that matches your modulefiles path. To load a module, use module load and to unload use module unload.