Modules - a tool for switching between environments

Modules package provides for the dynamic modification of environment settings that are required for using compilers, libraries, and applications by using module commands.
The module command allows you to easily change environment settings for each different versions of compilers, libraries, and applications.

Command Purpose
module list Displaying all loaded modulefiles.
module avail Displaying all available modulefiles.
module show [module_file_name] Displaying the modulefile settings.
module load [module_file_name] Loading the modulefiles.
module unload [module_file_name] Unloading the modulefiles.
module switch [module_file_name1] [module_file_name2] Change the modulefiles. (module_file_name1 > module_file_name2)

  • Checking the loaded modulefiles.

    $ module list
    Currently Loaded Modulefiles:
      1) XXX 

The comprehensive sets of modulefile for each programming environment are the followings:

  • Cray programming environment: PrgEnv-cray
  • Intel programming environment: PrgEnv-intel
  • PGI programming environment: PrgEnv-pgi
  • GNU programming environment: PrgEnv-gnu

A programming environment is set as a system’s main compiler environment when logging in.

  • Example: switching the Cray’s environment to Intel’s environment.

    $  module  switch  PrgEnv-cray  PrgEnv-intel

    The above example can be abbreviated as the follwing:

    $  module  switch  PrgEnv/intel

The compiler version can be switched if some versions are available.

  • Example: switching the Cray’s compiler version.

    $  module  switch  cce/X.X.X  cce/Y.Y.Y
    • For Intel’s compiler intel/X.X.X
    • For PGI’s compiler pgi/X.X.X

    The above example can be abbreviated as the follwing:

    $  module  switch  cce/Y.Y.Y

  • Checking the loaded modulefiles.

    $ module list
    Currently Loaded Modulefiles:
      1) XXX 

The comprehensive sets of modulefile for each programming environment are the followings:

  • Intel programming environment: PrgEnv-intel
  • PGI programming environment: PrgEnv-pgi
  • GNU programming environment: PrgEnv-gnu

A programming environment is set as a system’s main compiler environment when logging in.

  • Example: switching the Intel’s environment to PGI’s environment.

    $  module  switch  PrgEnv-intel  PrgEnv-pgi

    The above example can be abbreviated as the follwing:

    $  module  switch  PrgEnv/pgi

The compiler version can be switched if some versions are available.

  • Example: switching the Intel’s compiler version.

    $  module  switch  intel/X.X.X  intel/Y.Y.Y
    • For Intel’s compiler intel/X.X.X
    • For PGI’s compiler pgi/X.X.X

    The above example can be abbreviated as the follwing:

    $  module  switch  intel/Y.Y.Y

  • Example: switching the system B environment(default) to the system C environment.

    $  module  switch  lsf/SystemB lsf/SystemC

Execute the module command to make a environment settings. (Load the modulefiles of any version you want.)

$ module load matlab/R2012a

Execute the startup command of MATLAB.

$ matlab

Execute the module command to change a environment settings.

$ module unload matlab/R2012a
$ module load matlab/R2011b

Execute the startup command of MATLAB, the R2011b version is started up.

$ matlab

For how to use the modules with other applications, see each page of application software.

You can create and add your own modulefiles for your convenience. For details on how to create a modulefile, see man page. To enable use of your own customized modulefile, execute the “module use” command by specifying the directory where your customized modulefile is stored. To remove the previously-added path, use the “module unused” command. You can check the path of modulefiles using the MODULEPATH environment variable.

  • Example: Checking the path of modulefiles
## Enabling use of your customized modulefiles
$ module use /home/x/x12345/mymodule
## Checking the path of the modulefiles
$ echo $MODULEPATH
/home/x/x12345/mymodule:/opt/app/modulefiles/common:
/opt/app/modulefiles/app_ISV:
/opt/app/modulefiles/app_FREE:/opt/app/modulefiles/obsolete
## Removing the previously-added path
$ module unuse /home/x/x12345/mymodule
## Enabling use of your customized modulefiles by reducing its use priority of 
the original path than that of the path to your customized modulefiles
$ module use -a /home/x/x12345/mymodule
## Checking the path of the modulefiles
$ echo $MODULEPATH
/opt/app/modulefiles/common:/opt/app/modulefiles/app_ISV:
/opt/app/modulefiles/app_FREE:
/opt/app/modulefiles/obsolete:/home/x/x12345/mymodule
  • Example: Adding/enabling use of the modulefiles
## Checking your customized modulefiles
$ ls -F /home/x/x12345/mymodule
ruby/
$ ls -F /home/x/x12345/mymodule/ruby
1.8.7  1.9.3  2.1.2
## Enabling use of your customized modulefiles
$ module use /home/x/x12345/mymodule
## Checking if your customized modulefiles are properly available
$ module avail
--------------------------- /home/x/x12345/mymodule/ ---------------------------
ruby/1.8.7 ruby/1.9.3 ruby/2.1.2
------------------------- /opt/app/modulefiles/common --------------------------
PrgEnv-gnu/1.0(default)          lsf/SystemB(default)
 (omitted)
## Loading your customized modulefiles
$ module load ruby/2.1.2


Copyright © Academic Center for Computing and Media Studies, Kyoto University, All Rights Reserved.