Difference between revisions of "Setting up your environment"

From ScientificComputing
Jump to: navigation, search
Line 74: Line 74:
  
 
<noinclude>===Module list===</noinclude><includeonly>====Module list====</includeonly>
 
<noinclude>===Module list===</noinclude><includeonly>====Module list====</includeonly>
 +
The <tt>module list</tt> command displays the currently loaded modules files.
 +
 +
[leonhard@euler04 ~]$ '''module list'''
 +
Currently Loaded Modulefiles:
 +
  1) modules
 +
[leonhard@euler04 ~]$ '''module load gcc/4.8.2 python/2.7.6'''
 +
Autoloading openblas/0.2.13_seq
 +
[leonhard@euler04 ~]$ '''module list'''
 +
Currently Loaded Modulefiles:
 +
  1) modules                            3) openblas/0.2.13_seq(default:seq)
 +
  2) gcc/4.8.2(default:4.8)            4) python/2.7.6(2.7)
 +
 
<noinclude>===Module purge===</noinclude><includeonly>====Module purge====</includeonly>
 
<noinclude>===Module purge===</noinclude><includeonly>====Module purge====</includeonly>
<noinclude>===Module show===</noinclude><includeonly>====Module show====</includeonly>
+
The <tt>module purge</tt> command unload all currently loaded modules and cleans up the environment of your shell. In some cases, it might be better to log out and log in again, in order to get a really clean shell.
 +
 
 +
[leonhard@euler04 ~]$ '''module list'''
 +
Currently Loaded Modulefiles:
 +
  1) modules                            3) openblas/0.2.13_seq(default:seq)
 +
  2) gcc/4.8.2(default:4.8)            4) python/2.7.6(2.7)
 +
[leonhard@euler04 ~]$ '''module purge'''
 +
[leonhard@euler04 ~]$ '''module list'''
 +
No Modulefiles Currently Loaded.
 +
 
  
 
<noinclude>==Naming scheme==</noinclude><includeonly>===Naming scheme===</includeonly>
 
<noinclude>==Naming scheme==</noinclude><includeonly>===Naming scheme===</includeonly>

Revision as of 08:07, 23 August 2016

Introduction

Most applications, compilers and libraries rely on environment variables to function properly. These variables are usually set by the operating system, the administrator, or by the user. Typical examples include:

  • PATH — location of system commands and user programs
  • LD_LIBRARY_PATH — location of the dynamic (=shared) libraries needed by these commands and programs
  • MANPATH — location of man (=manual) pages for these commands
  • Program specific environment variables

The majority of problems encountered by users are caused by incorrect or missing environment variables. People often copy initialization scripts — .profile, .bashrc, .cshrc — from one machine to the next, without verifying that the variables defined in these scripts are correct (or even meaningful!) on the target system.

If setting environment variables is difficult, modifying them at run-time is even more complex and error-prone. Changing the contents of PATH to use a different compiler than the one set by default, for example, is not for the casual user. The situation can quickly become a nightmare when one has to deal with multiple compilers and libraries (e.g. MPI) at the same time.

Environment modules — modules in short — offer an elegant and user-friendly solution to all these problems. Modules allow a user to load all the settings needed by a particular application on demand, and to unload them when they are no longer needed. Switching from one compiler to the other; or between different releases of the same application; or from one MPI library to another can be done in a snap, using just one command — module.

Module commands

Module avail

The module avail command lists all available modules of the supported module category. If you load the new or the legacy module, it will also list all modules of these categories. It can be used to get a quick overview of all centrally installed software. If you are interested in a particular software and would like to know which versions are available, then you can specify the name of the software as a parameter for the module avail command

[leonhard@euler01 ~]$ module avail gcc

--------------- /cluster/apps/modules/modulefiles ---------------
gcc/4.4.7(4.4)     gcc/4.8.2(default) gcc/4.9.2
[leonhard@euler01 ~]$ module load legacy new
[leonhard@euler01 ~]$ module avail gcc 

--------------- /cluster/apps/modules/modulefiles ---------------
gcc/4.4.7(4.4)     gcc/4.8.2(default) gcc/4.9.2

----------------- /cluster/apps/modules/legacy ------------------
gcc/4.7.4

------------------- /cluster/apps/modules/new -------------------
gcc/4.8.4 gcc/5.2.0

Module show

The module show command provides you some information on what environment variables are changed and set by the module file. Further more it also contains a short string with information about the name and the version of the application or library.

[leonhard@euler01 ~]$ module show python/2.7.6
-------------------------------------------------------------------
/cluster/apps/modules/modulefiles/python/2.7.6:

module-whatis    Python version 2.7.6 (x86_64) 
prepend-path     PATH /cluster/apps/python/2.7.6/x86_64/bin 
prepend-path     LD_LIBRARY_PATH /cluster/apps/python/2.7.6/x86_64/lib64 
prepend-path     PKG_CONFIG_PATH /cluster/apps/python/2.7.6/x86_64/lib64/pkgconfig 
setenv           PYTHON_ROOT /cluster/apps/python/2.7.6/x86_64 
-------------------------------------------------------------------

Module load

The module load command load the corresponding and prepares the environment for using this application or library, by applying the instructions, which can be shown by running the module show command.

[leonhard@euler01 ~]$ module load gcc/4.8.2 python/2.7.6
Autoloading openblas/0.2.13_seq
[leonhard@euler01 ~]$ which python
/cluster/apps/python/2.7.6/x86_64/bin/python

Module list

The module list command displays the currently loaded modules files.

[leonhard@euler04 ~]$ module list
Currently Loaded Modulefiles:
  1) modules
[leonhard@euler04 ~]$ module load gcc/4.8.2 python/2.7.6
Autoloading openblas/0.2.13_seq
[leonhard@euler04 ~]$ module list
Currently Loaded Modulefiles:
  1) modules                            3) openblas/0.2.13_seq(default:seq)
  2) gcc/4.8.2(default:4.8)             4) python/2.7.6(2.7)

Module purge

The module purge command unload all currently loaded modules and cleans up the environment of your shell. In some cases, it might be better to log out and log in again, in order to get a really clean shell.

[leonhard@euler04 ~]$ module list
Currently Loaded Modulefiles:
  1) modules                            3) openblas/0.2.13_seq(default:seq)
  2) gcc/4.8.2(default:4.8)             4) python/2.7.6(2.7)
[leonhard@euler04 ~]$ module purge
[leonhard@euler04 ~]$ module list
No Modulefiles Currently Loaded.


Naming scheme