This is an old revision of the document!

Environment Modules

Environment Modules are designed to manage custom package installations. Software in our department is all installed to a network filesystem mounted over NFS where each package available is installed to it's own directory. This allows us to manage a wide range of software across different Linux distributions without users having to deal with any configuration. We can include different versions of software, letting users choose which they want to use.

Please see Available Modules for a listing of available software.

On any Linux system in our department, you can run module avail from your shell to get a list of available software.

ktm5j@applecake ~ $ module avail

------------------------ /sw/centos/Modules/modulefiles ------------------------
altera_pro       modelsim_ae      php7             python3.6.2
cuda-toolkit-9.0 modelsim_ase     php7.1.10        qsys
emacs            nios2eds         python           quartus
matlab           php              python3

After deciding what software you want to use, load the package usingmodule load. Now the software is ready to use.

ktm5j@applecake ~ $ module load python3              # Load the module for use in your current session
ktm5j@applecake ~ $ which python
ktm5j@applecake ~ $ python                           # When you run `python` you get the version that has been loaded
Python 3.6.2 (default, Oct  6 2017, 13:03:05) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.

After loading several modules in your session, module list will show what modules have been loaded.

ktm5j@applecake ~ $ module load matlab
ktm5j@applecake ~ $ module load php
ktm5j@applecake ~ $ module list
Currently Loaded Modulefiles:
  1) matlab    2) python3   3) php

module display will show specific information about the environment variables that will be modified by a module.

ktm5j@applecake ~ $ module display python
module-whatis	 Python current 
prepend-path	 PATH /sw/centos/python/current/bin 
prepend-path	 LD_LIBRARY_PATH /sw/centos/python/current/lib 
prepend-path	 LD_INCLUDE_PATH /sw/centos/python/current/include 
prepend-path	 MANPATH /sw/centos/python/current/share/man 
ktm5j@applecake ~ $ echo $LD_LIBRARY_PATH 

You can switch, changing one version of software for another, or unload modules when you are done or no longer want this software.

ktm5j@applecake ~ $ module switch python3 python2
ktm5j@applecake ~ $ module unload php

Shell Scripting/Slurm Batch

If you write shell scripts or slurm batch files that make use of these software packages, remember that you must still load modules from inside of your script. For example, your script must contain the line module load python3 before you can use python from inside of your script.

Before modules will work from inside SLURM or scripts, you must including the following line in your script before loading any modules:

source /etc/profile.d/
  • linux_environment_modules.1570634084.txt.gz
  • Last modified: 2019/10/09 15:14
  • by ktm5j