Environment Modules

From CS Support Wiki
Revision as of 20:10, 11 October 2017 by Ktm5j (Talk | contribs) (Created page with "=Environment Modules= [http://modules.sourceforge.net Environment Modules] are designed to manage custom package installations. Software in our department is all installed t...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Using Modules

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 using module load. Now the software is ready to use.

ktm5j@applecake ~ $ module load python3
ktm5j@applecake ~ $ which python

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

Things to keep in mind

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.