Creating local module directory
You can use your own custom modules to setup your environment to run programs that you have installed yourself.
This tutorial will guide you through creating a custom module directory, adding versioned modules for programs, and automatically having these modules available to you upon login. The tutorial will assume you will be managing a set of modules for a whole group, though it is equally applicable to managing a personal set of modules.
Creating a custom module directory
You need to decide on the top-level directory in which to store the module files. Let us assume it is /cluster/project/leonhard/modules, where hpc should be replaced with your group's storage location. This can also be an arbitrary directory to which you have access, e.g., $HOME/modules. First create the directory and set proper permissions:
[leonhard@euler00 ~]$ mkdir /cluster/project/leonhard/modules [leonhard@euler00 ~]$ chown leonhard:leonhard-group /cluster/project/leonhard/modules
Using the custom module directory
Now you need to let the module command know about your custom directory. Add the following line to your $HOME/.bash_profile file:
module use /cluster/project/leonhard/modules
The module command will now see your custom modules the next time you log in. You can also type this command into your current shell to have immediate access.
Every group members will need to do this setup step to see the modules.
Creating a versioned module file
Next, you need to create a module file for a program. Assume you have version 1.0 of the basel program located in /cluster/project/leonhard/apps/basel_problem/1.0/bin and it depends on the gmp module. Create the program's module directory:
[leonhard@euler00 ~]$ mkdir /cluster/project/leonhard/modules/basel [leonhard@euler00 ~]$ chown leonhard:leonhard-group /cluster/project/leonhard/modules/basel
In your favorite editor, edit the /cluster/project/leonhard/modules/basel/1.0 file to contain the following contents:
#%Module1.0 module-whatis "Solve Basel problem" set helpmsg "Solves the Basel problem." module load gmp set topdir "/cluster/project/leonhard/apps/basel_problem/1.0" prepend-path PATH $topdir/bin
Test that it works:
[leonhard@euler00 ~]$ module avail basel/1.0 [leonhard@euler00 ~]$ module load basel/1.0 [leonhard@euler00 ~]$ module list Currently Loaded Modulefiles: 1) modules 2) gcc/4.8.2(default:4.8) 3) gmp/5.1.3(default:5) 4) basel/1.0