1. Home
  2. Docs
  3. General Computing Environ...
  4. Lmod Software Environment

Lmod Software Environment

In the legacy MCS environment, users would add NFS-mounted software/libraries to their PATH environment variable with SoftEnv. In the GCE, you’ll be using Lmod, which is a Lua-based module system that works similarly to SoftEnv.

To ensure that Lmod is available anytime you have a shell, add the following line to the bottom of your .bashrc or .zshrc file:
# Source module definitions
if [ -f /etc/profile.d/z00_lmod.sh ]; then

. /etc/profile.d/z00_lmod.sh
fi

If you use tcsh, add the following to .cshrc:
# Source module definitions
if ( -f /etc/csh/login.d/z00_lmod.csh ) then
source /etc/csh/login.d/z00_lmod.csh
endif

To immediately apply the changes in your current session, run the following command:
If you’re using bash
$ source ~/.bashrc

If you’re using zsh
$ source ~/.zshrc

If you’re using tsch
$ source ~/.cshrc

You should now be able to call the module command. You can view the list of available software by:
$ module avail

Lmod provides some advanced features that allow users to load their own modules every time they login to the system.  You can do:

$ module load <module 1> <module 2> etc.
$ module save

This creates a file called ~/.lmod.d/default which has the list of desired modules. Once this is set-up a user can issue:

$ module restore

Our login scripts will automatically run “module restore” so your saved modules will be loaded when you login.

Avoiding automatic reloading of modules

The list of modules available on our Ubuntu 18 machines is different from the modules on Ubuntu 20 machines.  This would cause a warning if you save your modules in one environment and then login to a different environment.  If you need to avoid automatically running “module restore” by our login script, please create an empty file in your home directory as follows:

$ touch ~/.NoLoadDefaultModules

For more information on how to use Lmod, please check the following documentation.