If you have used modules before, the experience should feel very familiar. Most commands are the same as in the Traditional TCL modules, although their new behaviour should feel more natural. There are also a few new commands. For a comprehensive list, please run
module -h
Commands available
Loading and Unloading modules
module load
Load a module into the current environment of the session or job.
$ module load git
Note that Lmod knows if it is already loaded, and will actually swap unload the old one and load the new one (swapping them)
$ module load git/new The following have been reloaded with a version change: 1) git/2.20.1 => git/2.25.1
module swap
Replace one module by another one. This command still works, but load can take care of it as well in the majority of cases.
$ module swap git/new The following have been reloaded with a version change: 1) git/2.20.1 => git/2.25.1
module unload
$ module unload git
module reset
Restore the system default modules. It effectively resets the environment to the system default for a fresh session.
$ module list Currently Loaded Modules: 1) gcc/8.3.1 2) prgenv/gnu 3) git/2.26.0 4) cmake/3.16.5 $ module reset Resetting modules to system default. Reseting $MODULEPATH back to system default. All extra directories will be removed from $MODULEPATH. $ module list Currently Loaded Modules: 1) gcc/8.3.1 2) prgenv/gnu
module purge
Unload all modules.
This will also unload default modules such as prgenv, and you may need to load them again to see a more complete module tree. Use of module reset
is normally preferred.
$ module list Currently Loaded Modules: 1) git/2.20.1 2) cmake/3.16.5 $ module purge $ module list No modules loaded
Listing and Searching
module list
See what modules are loaded at any point.
$ module list Currently Loaded Modules: 1) git/2.20.1
Note that Lmod will also mark what modules are loaded when running module avail (with an L next to them)
Module list can take an argument to list only those module that match an argument
$ module list Currently Loaded Modules: 1) git/2.20.1 2) cmake/3.16.5 $ module list git Currently Loaded Modules Matching: git 1) git/2.20.1
module avail
List all modules that can be loaded at any point.
module avail will not show all the possible modules, but only those that can be loaded in the current environment. To see all possible modules and their versions, use module spider
$ module avail -------------------------------------------------------------------------------------- Global Aliases --------------------------------------------------------------------------------------- pa -> prgenv/amd pe -> prgenv/expert pg -> prgenv/gnu pi -> prgenv/intel pp -> prgenv/pgi ------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/prgenvs -------------------------------------------------------------------------- prgenv/amd (a) prgenv/expert (E,e) prgenv/gnu (D:g) prgenv/intel (i) prgenv/pgi ------------------------------------------------------------------------ /usr/local/apps/modulefiles/lmod/compilers ------------------------------------------------------------------------- aocc/2.1.0 gcc/4.8.5 gcc/8.4.0 (D) gcc/9.3.0 (new) intel/18.0.4 intel/19.0.5 (D) pgi/19.10 --------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/core --------------------------------------------------------------------------- aec/1.0.3 eigen/3.3.7 git/2.20.1 (L,D) intel-mkl/18.0.4 lua/5.3.5 nco/4.7.8 proj/6.1.1 valgrind/3.14.0 antlr/2.7.7 fcm/2019.05.0 git/2.25.1 (new) intel-mkl/19.0.5 (D) maven/3.6.3 ninja/1.10.0 proj4/5.2.0 cmake/3.13.4 ferret/7.5.0 gnuparallel/20190122 jasper/2.0.14 modulemgr/2.0 openjpeg/2.3.0 python3/3.6.8-01 cmake/3.16.5 (D) geos/3.7.1 gsl/2.5 java/11.0.6 nccmp/1.8.2.1 patchelf/0.10 udunits/2.2.26 Where: L: Module is loaded E: Experimental Aliases: Aliases exist: foo/1.2.3 (1.2) means that "module load foo/1.2" will load foo/1.2.3 D: Default Module Use "module spider" to find all possible modules and extensions. Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
You may filter the output by providing a search pattern
$ module avail git -------------------------------------------------------------------------------------- Global Aliases --------------------------------------------------------------------------------------- pa -> prgenv/amd pe -> prgenv/expert pg -> prgenv/gnu pi -> prgenv/intel pp -> prgenv/pgi --------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/core --------------------------------------------------------------------------- git/2.20.1 (L,D) git/2.25.1 (new) Where: L: Module is loaded Aliases: Aliases exist: foo/1.2.3 (1.2) means that "module load foo/1.2" will load foo/1.2.3 D: Default Module Use "module spider" to find all possible modules and extensions. Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
You may use the -d option to only list the default version for each module
$ module -d avail -------------------------------------------------------------------------------------- Global Aliases --------------------------------------------------------------------------------------- pa -> prgenv/amd pe -> prgenv/expert pg -> prgenv/gnu pi -> prgenv/intel pp -> prgenv/pgi ------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/prgenvs -------------------------------------------------------------------------- prgenv/gnu (g) ------------------------------------------------------------------------ /usr/local/apps/modulefiles/lmod/compilers ------------------------------------------------------------------------- aocc/2.1.0 gcc/8.4.0 intel/19.0.5 pgi/19.10 --------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/core --------------------------------------------------------------------------- aec/1.0.3 eigen/3.3.7 geos/3.7.1 gsl/2.5 java/11.0.6 modulemgr/2.0 ninja/1.10.0 proj/6.1.1 udunits/2.2.26 antlr/2.7.7 fcm/2019.05.0 git/2.20.1 (L) intel-mkl/19.0.5 lua/5.3.5 nccmp/1.8.2.1 openjpeg/2.3.0 proj4/5.2.0 valgrind/3.14.0 cmake/3.16.5 (L) ferret/7.5.0 gnuparallel/20190122 jasper/2.0.14 maven/3.6.3 nco/4.7.8 patchelf/0.10 python3/3.6.8-01 Where: L: Module is loaded Aliases: Aliases exist: foo/1.2.3 (1.2) means that "module load foo/1.2" will load foo/1.2.3 Use "module spider" to find all possible modules and extensions. Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
module spider (new)
List all possible modules, including those that are not visible because they belong to other environments.
$ module spider ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The following is a list of the modules and extensions currently available: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- aec: aec/1.0.3 antlr: antlr/2.7.7 aocc: aocc/2.1.0 boost: boost/1.61.0:gnu:4.8.5, boost/1.61.0:gnu:8.4, boost/1.61.0:gnu:9.3, boost/1.61.0:intel:19.0, boost/1.61.0 ...
You may also enquire for a particular module to see all the versions:
$ module spider fftw ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- fftw: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Versions: fftw/3.3.8:gnu:4.8 fftw/3.3.8:gnu:8.4 fftw/3.3.8:gnu:9.3 fftw/3.3.8:intel:19.0 fftw/3.3.8 ...
And even more detailed information about a package version in particular:
$ module spider fftw/3.3.8 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- fftw: fftw/3.3.8 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- You will need to load all module(s) on any one of the lines below before the "fftw/3.3.8" module is available to load. gcc/4.8.5 gcc/8.4.0 gcc/9.3.0 intel/19.0.5 Help: A fast, free C FFT library; includes real-complex, multidimensional, and parallel transforms. For more information visit http://www.fftw.org/
Discovery
module whatis
Show a short description of the module
$ module whatis git git/2.20.1 : Git is a free and open source distributed version control system.
module help
Show a longer description and useful information of the module.
$ module help git --------------------------------------------------------------------------- Module Specific Help for "git/2.20.1" --------------------------------------------------------------------------- Git is a free and open source distributed version control system. It is designed to handle everything from small to very large projects with speed and efficiency. For more information on all the available commands run git --help or visit https://git-scm.com/
module show
Run this to see what a module would do without loading it. It is very useful to discover what environment variables will be defined so you can use them later on.
$ module show git ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/core/git/2.20.1.lua: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- setenv("git_DIR","/usr/local/apps/git/2.20.1") setenv("git_VERSION","2.20.1") setenv("GIT_VERSION","2.20.1") prepend_path("PATH","/usr/local/apps/git/2.20.1/bin") LmodMessage("show git 2.20.1 (git_DIR, GIT_VERSION, PATH)") whatis("Git is a free and open source distributed version control system.") help([[Git is a free and open source distributed version control system. It is designed to handle everything from small to very large projects with speed and efficiency. For more information on all the available commands run git --help or visit https://git-scm.com/ ]])
Collections
The default collection is great to define your default modules you want loaded when you start your session or job.
Lmod introduces the concept of collections. A user can define groups of modules that can be saved and easily restored by name. If no name is specified when saving or restoring a collection, it will use a default collection.
module save
If you want to save not only modules but their specific versions or tags, you must load those modules with their full name or tag.
Save the current list of modules as a collection.
If you want to create a new collection, make sure you start from a clean set with module purge and load only those modules you require before you save them.
$ module purge $ module load git cmake $ module save Saved current collection of modules to: "default", for system: "tems"
Those modules will be loaded automatically for any new session or job.
And to create a named collection:
$ module load git $ module save mycollection Saved current collection of modules to: "mycollection", for system: "tems"
module restore
You can restore a collection at any point. It will unload the necessary modules and load the ones in the collection. If no argument is specified, it will reload your default collection.
$ module restore mycollection Restoring modules from user's mycollection, for system: "tems"
module savelist
See all the collections that are available for the user on this system
$ module savelist Named collection list (For LMOD_SYSTEM_NAME = "tems"): 1) default 2) mycollection
module describe
Show the contents of a collection
$ module describe Collection "default" contains: 1) git 2) cmake $ module describe mycollection Collection "mycollection" contains: 1) git
module disable
Disable a collection.
$ module disable mycollection Disabling mycollection collection by renaming with a "~" $ module savelist Named collection list (For LMOD_SYSTEM_NAME = "tems"): 1) default
The ml shortcut
Lmod provides a convenience shortcut command called ml that doubles up as module list or any other mode:
$ ml Currently Loaded Modules: 1) git/2.20.1 $ ml git/new The following have been reloaded with a version change: 1) git/2.20.1 => git/2.25.1 $ ml Currently Loaded Modules: 1) git/2.25.1 $ ml -git $ $ ml whatis git git/2.25.1 : Git is a free and open source distributed version control system.
It also provides shorter subcommands such as "av" for "avail". See the modules --help for more details.