This page explains how users can install softwares (modules) that are not installed cluster-wide in their project directories and create a modulefile so the softwares can be easily loaded using the ‘module load’ command on the cluster. Common reasons for creating a module include:
- Multiple users in your project group need the same software
- Multiple versions of the same software must coexist
Module installation Example
Step 1: Choose Destination Directories
Install software in a directory accessible to your group, for example:
/projects/your_lab_directory/
A typical structure looks like:
/projects/your_lab_directory/
├── modules
│ └── software_name
│ └── version_(like_1.01)
│ └── subdirectories_for_config_files/
│ └── .../
└── modulefiles
└── software_name
└── modulefile_(good_if_same_as_version_name_like_1.01)
- modules folder contains installed applications
- modulefiles folder contains the script (modulefile) to configure a user’s shell environment for a specific software package
If you have not build the directory structure, use mkdir to create the empty folders:
mkdir /projects/your_lab_directory/modules
mkdir /projects/your_lab_directory/modulefiles
Step 2: Install the Module
Below we use Cowsay as an example. Download and build Cowsay:
cd /projects/your_lab_directory/modules
git clone --recurse-submodules https://github.com/cowsay-org/cowsay
After installation, the main executable will be located at:
/projects/your_lab_directory/modules/cowsay
Step 3: Create a Modulefile
Create a directory for the modulefile:
mkdir /projects/your_lab_directory/modulefiles
mkdir cowsay
Create the modulefile:
touch 3.04
vi 3.04
Type the following (if it is not responding type ‘i’ to enter the insert mode):
#%Module1.0
##
## cowsay modulefile
##
module-whatis "Cowsay 3.04 – configurable talking cow"
set cowdir /projects/gas/modules/cowsay
prepend-path PATH $cowdir/bin
prepend-path MANPATH $cowdir/man
Save and exit by typing ‘:x’ (if you are in the insert mode use ‘esc’ key to finish editing first).
Step 4: Make the Module Available
Start an interactive session:
interactive
Add the module path and load the module:
module use /projects/your_lab_directory/modulefiles
module load cowsay
Verify that the module is working normally:
cowsay "Hello!"
The output should be the following:
________
< Hello! >
--------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
If you exit the current interactive session, you will need to add the module path again to load the module. If you wish to have the module available each time entering an interactive session, you may add the above two lines starting with ‘module use’ and ‘module load’ to your .bashrc file to automatize the process.
Best Practices for creating Modules
- Install one version per directory
- Maintain an organized directory structure
- Both open software and commercial software with proper licenses can be installed in the project folder
Getting Help
If you need help creating or debugging a module, please feel free to contact us.