How are Environment Modules used in the CLSE for Linux?

  • Environment modules enable users to modify their Linux environment dynamically
  • Modules can be loaded or unloaded using command-line programs
  • The CAEN Lab Software Environment  (CLSE) for Linux uses modules to specify which version of a software application one wishes to run
    • For example one can use the module avail command to display all available modules, or
    • Use the module load modulefile command to load a module
 

 

The Linux Environment Modules package is available on all computers running the CAEN Lab Software Environment (CLSE) for Linux. This enables students to change settings in their shell dynamically using the software modulefile that is pre-configured by CAEN. When one loads a modulefile, the shell will be configured with all variables needed by the application (e.g. PATH, CLASSPATH, MANPATH, or LD_LIBRARY_PATH).

To determine which software versions are available, use the module avail command. If additional arguments are not specified, the command will display a listing of all available modules:

$ module avail

--------------------------------- /usr/share/Modules/modulefiles ----------------------------------
dot         module-git  module-info modules     null        use.own

---------------------------------------- /etc/modulefiles -----------------------------------------
mpi/openmpi3-x86_64 mpi/openmpi-x86_64

------------------------------------- /usr/caen/misc/modules --------------------------------------
abaqus/2019(default)                    milkyway/2018.06(default)
adams/2019.2(default)                  milkyway/2019.12-SP4
ads/2016u1.3                                 minicom/2.7(default)
ads/2017u1.0(default)                   mmsim/14.10.664
ads/2021u1.0                                 mmsim/15.10.498
altera/15.0.1.150(default)              mmsim/17.10.307(default)
...

The list of all modules available on a CAEN computer may be long. To refine a search, one may add an additional argument to specify the modules available for a specific application. For example, the command module avail gcc might produce this output:

$ module avail gcc

------------------------------------- /usr/caen/misc/modules --------------------------------------
gcc/4.8.5(default) gcc/6.2.0          gcc/7.1.0          gcc/9.1.0

If a module has multiple versions, one of them will be marked (default), as can be seen in the example above for gcc/4.8.5. The default module version is what will be loaded without specifying any version number when running an application.

To load a specific module version, use the module load modulefile command. Your shell will be modified to use the specified modulefile version. For example, prior to loading the modulefile for gcc.7.1.0, typing the gcc command would have run the default version in /usr/bin. After loading the module, the user's PATH environment variable is modified such that the version of gcc in /usr/um/gcc-7.1.0 is run instead.

Before loading the CAEN gcc modulefile:

$ printenv PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/um/bin
$ which gcc
/usr/bin/gcc
$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

After loading the modulefile:

$ module load gcc/7.1.0
$ printenv PATH
/usr/um/gcc-7.1.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/um/bin
$ which gcc
/usr/um/gcc-7.1.0/bin/gcc
$ gcc --version
gcc (GCC) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

To restore your environment to its previous state, use the module unload modulefile command, or simply log out:

$ module unload gcc
$ printenv PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/um/bin
$ which gcc
/usr/bin/gcc

Read More About Environment Modules

For more information about the environment modules, commands, and usage, visit the Environment Modules open source project page or type man module or module --help at a command line.

Details

Article ID: 5058
Created
Mon 5/3/21 4:34 PM
Modified
Fri 5/7/21 6:30 AM