Environment modules allow for dynamically modifying ones shell environment to provide access to required packages. Managing your environment manually can be cumbersome, using modules is highly recommended and is standard practice on gStar.
To get started, you’ll first need to add the modules commands to your environment. To do so, add
to your “.bashrc” file in your home directory. This will automatically load environment modules each time you log in. If you are using a shell other than “bash”, replace the reference to “bash” in the above code snippet with the name of the shell in use (ksh, csh, etc.) and add the line to your shell’s login script (.kshrc, .cshrc, etc.). For clarity:
- Add “source /usr/local/modules/init/csh” to “.cshrc”.
- Add “source /usr/local/modules/init/bash” to “.bashrc”.
- Add “source /usr/local/modules/init/ksh” to “.kshrc”.
- Add “source /usr/local/modules/init/zsh” to “.zshrc”.
To immediately begin using modules you will need to reload your startup script by executing
from the command prompt in your home directory (assuming you’re using “bash”, replace with the appropriate script depending on your shell).
The structure of a module command is:
module <command> [arguments]
There are many available commands, to see a list simply run:
To get you started, you will first need to be able to see which software packages are available. To do so, run:
This will display a list of all installed software packages. To load a package, preparing your environment for its use, run:
module load <package name>
For example, if I wanted to use a 64bit version of OpenMPI compiled with the GNU tool chain, I could use:
module load openmpi/x86_64/gnu/1.4.4
You’ll notice that, after running “module avail”, some of the package names have “(default)” written next to them. This indicates that you don’t need to type the whole name to enable that package. Using the previous OpenMPI example, I could achieve the same results by running:
module load openmpi