Module System

Lmod

We install our software as modules and we manage them using Lmod.

"Lmod is a Lua based module system that easily handles the MODULEPATH Hierarchical problem. Environment Modules provide a convenient way to dynamically change the users' environment through modulefiles. This includes easily adding or removing directories to the PATH environment variable. Modulefiles for Library packages provide environment variables that specify where the library and header files can be found."  Source: TACC Lmod 

Module Load and Unload

Simply stated, a module is a packaging of definitions of environment variables into a script. In general, there is a module defined for each application, and that module defines the environment appropriately for that application. To use the application, you need to load the module first using the module command:

module load <software-module>

For an example, if the software-module is "matlab", it becomes "module load matlab".

If there are more versions, let's say matlab/R2019b, then it becomes:

module load matlab/R2019b

To load the sotware-module, use the command:

module load <software-module>

To unload it, use:

module unload <software-module>

Module List

To see which modules you have loaded, use:

module list

Viewing Modules That Can Be Loaded

Modules are organized into a hierarchy so that some modules can only be loaded after other modules have been loaded. To see the modules that can be loaded in the current environment use the command:

module avail

If you want to check the versions of a particular software such as matlab, then type:

module avail matlab

output:

...

matlab/R2018b          matlab/R2019b(default)

Searching All Modules

To search all modules and determine what additional modules are required to use a specific software, you can use the "module spider <name>" command.  For example, R has dependency modules that must be loaded before R itself. First list available versions:

module spider R

Output:

-------------------------------------------------------------------------

  R:

-------------------------------------------------------------------------

    Description:

      R is a free software environment for statistical computing and graphics.


     Versions:

        R/3.2.5

        R/3.3.3

        R/3.4.2

        R/3.5.0

        R/3.5.3

        R/3.6.2

        R/4.0.2

Then select a specific version and use the command on the specific version:

module spider R/4.0.2

Output:

-----------------------------------------------------------------------------

  R: R/4.0.2

-----------------------------------------------------------------------------

    Description:

      R is a free software environment for statistical computing and graphics.


    You will need to load all module(s) on any one of the lines below before the "R/4.0.2" module is available to load.


      gcc/6.3.0  openmpi/2.0.1

Now, you need to load the R/4.0.2 module as:

module load gcc/6.3.0 openmpi/2.0.1

module load R/4.0.2

Module Display

To get the version, path of executable and libraries, and other information about the software-module (e.g. matlab):

module display <software-module>

For matlab, the output looks like:

-------------------------------------------------------------------

execute{cmd="source /usr/local/matlab/matlab-prefdir.sh", modeA={"load"}}

whatis("Name: matlab")

whatis("Version R2019b")

whatis("Category: library")

whatis("Description: Matlab R2019b")

pushenv("MATLAB","/usr/local/matlab/R2019b")

pushenv("MATLAB_COMM","native")

prepend_path("PATH","/usr/local/matlab/R2019b/bin")

prepend_path("LD_LIBRARY_PATH","/usr/local/matlab/R2019b/runtime/glnxa64")

...

-------------------------------------------------------------------

Here, the binary path for Matlab version 2019B is /usr/local/matlab/R2019b/bin