Environment modules

Essential module commands | Customized environments

The module utility helps you identify software that is available on the system and then load packages that are compatible. The module utility manages complex combinations of paths, variables, and dependencies so you can compile and run jobs efficiently and make the most of your allocation.

Some modules are loaded by default. Run module list when you first log in to see what they are. Depending on the work you need to do, you can load additional modules or different modules, or you can create and save multiple customized environments.


Essential module commands

Following are descriptions of commonly used module commands.

module av output
Click the image for sample module av output.

module av - Show which modules are available for use with the currently loaded compiler.

module help - List switches, subcommands, and arguments for the module utility; or specify a modulefile by name for help with an individual module.

module help
module help netcdf

module list - List the modules that are loaded.

module load - Load the default version of a software package, or load a specified version.

module load modulefile_name
module load modulefile_name/n.n.n

module purge - Unload all modules. Some users include this command in a batch script, followed by a sequence of module load commands to establish a customized environment for the job being submitted.

module spider - List all modules that exist on the system. This does not give you information on module dependencies or tell you which modules can be loaded without conflicts at that point. 

module swap - Unload one module and load a different one. Example:

module swap netcdf pnetcdf

module unload - Unload the specified software package.

module unload modulefile_name

module whatis - Get a short description of a module.


Customized environments

If you have created your own environment or want to have multiple collections of modules for various tasks, you can save those customized environments for easy re-use.

To save a customized environment as your default environment, load the modules that you want to use, then simply run module save or module s.

module save

If you plan to set up additional custom environments for other needs, give each collection of modules a unique name.

module save environment_name

To see a list of your customized, saved environments, use module savelist.

module savelist

To use one of the custom environments from that list, use module restore, or module r, followed by the name.

module restore environment_name

To remove a customized environment that you have saved:

  • Change to your .lmod.d directory.
  • List the files.
  • Use rm to delete what you no longer need.
cd /glade/u/home/username/.lmod.d
ls -l
rm environment_name

To revise a customized environment:

  • Change to (that is, restore) that environment.
  • Unload, load, or swap modules as needed.
  • Save the environment as a default environment again with the same name.
module restore myenvironment
module load additional_module
module save myenvironment

The previously saved environment will be renamed automatically with the addition of a tilde (~). In the example just above, the previously saved environment would be renamed to myenvironment~.

 

Troubleshooting tips

Situation: You load a custom default module collection (for example, module restore myenvironment). You receive a warning similar to this:

Lmod Warning: The following modules have changed: pgi
Lmod Warning: Please re-save this collection

What to do: “Re-save” the customized module collection by running module save and using the same environment name, as follows.

module save myenvironment