From Documentation
Revision as of 12:27, 28 September 2017 by Syam (Talk | contribs)

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

Graham and Cedar

The information presented below is for our legacy systems (Orca etc). The new Compute Canada national data centers, Graham and Cedar, use a somewhat different setup. Check the following link for details:

https://docs.computecanada.ca/wiki/Utiliser_des_modules/en

Overview

Most supported software at SHARCNET is configured through the use of the module command. This allows one to load and unload different software packages (modules) on the fly, automatically making all of the necessary changes to your shell environment (variables for library and binary search paths, etc.). For example, one can choose between different versions of the same software package, or between different builds of the same library compiled with different compilers, and so on.

Introductory examples

The main module commands are:

module avail              # to list all available modules you can load
module list               # to list your currently loaded modules
module load moduleName    # to load moduleName into your environment
module unload moduleName  # to unload moduleName from your environment

For example, at the time of this edit on brown

which R
/opt/sharcnet/r/2.10.0/bin/R
module list
Currently Loaded Modulefiles:
1) compile/1.2              4) mpfr/2.4.2               7) acml/pathscale/3.6.0
2) sq-tm/2.3                5) gmp/4.3.2                8) r/2.10.0
3) intel/11.0.083           6) openmpi/intel/1.4.2      9) user-environment/1.0.0

shows that R is loaded as a module (r/2.10.0) by default, and there are two versions of R available there

module avail r/
r/2.10.0 r/2.11.0

- you can use whichever version you like. Eventually, most software will be installed as modules on SHARCNET.

Querying your environment

As mentioned above, SHARCNET clusters use the Modules package to set up the user's environment. When you login into any of the SHARCNET clusters certain modules are automatically loaded for your convinience. If your requirements call for a different setup you can make the appropriate changes by using the commands: "module unload <module-name>" and "module load <new-module-name>".


The initially loaded modules and those modules that you load into your environment will set up certain environment variables to the appropriate values.

You can query and/or modify the working environment using the module command which has following form:

module [switches] [sub-command] [sub-command-arguments]

Type the command:

module --help

to see the switches, sub-command and their arguments.


Testing the environment and using the aliases

Here are some examples of the module commands and a description of the resulting action:

module command Description
module help displays the usage format of the module command
module list lists currently loaded modulefiles
module avail lists available modules in the system
module switch <old-module> <new-module> first unloads module <old-module> then loads module <new-module>
module display <module-name> lists the environment variables set up by the module <module-name>
module load <module-to-load> loads module <module-to-load> (if there are no conflicts)
module unload <module-to-unload> unloads module <module-to-unload>

For gcc version 4.3.4 is the stable gcc compiler and this version should be used instead of the latest. If you specify in the "module load" command a modulefile without the version number then the latest version will be used. Here is an example, requesting that the stable version of gcc be loaded:

[nickc@hnd20:/work/nickc/OpenMP_c_Example] module list
Currently Loaded Modulefiles:
 1) moab/5.4.2               7) octave/3.2.4            13) gromacs/4.0.5
 2) torque/2.5.5             8) r/2.10.0                14) vmd/1.8.7
 3) sq-tm/2.4                9) namd/2.7b3              15) util/2.0
 4) intel/11.0.083          10) ansys/12.1.1            16) user-environment/1.0.0
 5) openmpi/intel/1.4.2     11) fftw/intel/2.1.5
 6) compile/1.3             12) lammps/10.08.2010

[nickc@hnd20:/work/nickc/OpenMP_c_Example] module switch intel gcc/4.3.4;module list
Currently Loaded Modulefiles:
 1) moab/5.4.2               7) r/2.10.0                13) vmd/1.8.7
 2) torque/2.5.5             8) namd/2.7b3              14) util/2.0
 3) sq-tm/2.4                9) ansys/12.1.1            15) user-environment/1.0.0
 4) openmpi/intel/1.4.2     10) fftw/intel/2.1.5        16) gcc/4.3.4
 5) compile/1.3             11) lammps/10.08.2010
 6) octave/3.2.4            12) gromacs/4.0.5

Display default environment variables

To see the default environment that you get at login issue the "module list" command. Currently, for most systems the default compiler is intel:

[nickc@hnd20:~] module list
Currently Loaded Modulefiles:
   ...
   4) intel/11.0.083  
   ...

To see the variables that are associated with the default modulefile issue the command:

module show|display <modulefile>

For example here is what you would see on hound:

[nickc@hnd20:~] module show intel/11.0.083
-------------------------------------------------------------------
/opt/sharcnet/modules/intel/11.0.083:

module-whatis    Provides the Intel compiler 11.0.083 environment for x86_64 systems
setenv           INTEL_LICENSE_FILE /opt/sharcnet/intel/11.0.083/license/intel.lic
conflict         intel pathscale pgi gcc open64
setenv           CC icc
setenv           CXX icpc
setenv           FC ifort
setenv           F77 ifort
setenv           F90 ifort
setenv           F95 ifort
setenv           CFLAGS -O2
setenv           FFLAGS -O2
setenv           OFLAGS -O3
setenv           GFLAGS -g -O1
prepend-path     PATH /opt/sharcnet/intel/11.0.083/icc/bin/intel64/:/opt/sharcnet/intel/11.0.083/ifc/bin/intel64/
prepend-path     MANPATH /opt/sharcnet/intel/11.0.083/icc/man:/opt/sharcnet/intel/11.0.083/ifc/man
prepend-path     --delim   CPPFLAGS -I/opt/sharcnet/intel/11.0.083/icc/include - I/opt/sharcnet/intel/11.0.083/ifc/include -I/opt/sharcnet/intel/11.0.083/ifc/mkl/include
prepend-path     --delim   LDFLAGS -L/opt/sharcnet/intel/11.0.083/icc/lib/intel64 -  L/opt/sharcnet/intel/11.0.083/ifc/lib/intel64 -L/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t
prepend-path     LD_RUN_PATH /opt/sharcnet/intel/11.0.083/icc/lib/intel64:/opt/sharcnet/intel/11.0.083/ifc/lib/intel64:/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t
prepend-path     LD_LIBRARY_PATH /opt/sharcnet/intel/11.0.083/icc/lib/intel64:/opt/sharcnet/intel/11.0.083/ifc/lib/in tel64:/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t
-------------------------------------------------------------------

Default program/compilation behavior

If you compile your program using the SHARCNET compiler modules, the compiler will be told to store the library versions used in the program binary via LD_RUN_PATH . As such one should not need to use the LD_LIBRARY_PATH variable, and should actually avoid it. The danger with LD_LIBRARY_PATH is that one could load different modules in the job environment than at the time they compiled the code, resulting in the binary not linking.

Loading modules automatically when you login

If you'd like to load a particular module every time you log into the system you may put module load statements in your shell configuration file. Most SHARCNET users use the bash shell, so these statements should go in their ~/.bashrc file.

For example, to load the default version of gaussian automatically when you log in, you would add the following line to your ~/.bashrc file with a text editor:

 module load gaussian

To load different modules by default on different systems please see the knowledge base entry: How do I load different modules on different clusters?.

Where to find further information

You can issue the command:

man module

or

module --help

to see more detailed information on how to use the module command.

For further information on "Linux modules" see

  http://linux.die.net/man/1/module

or Google with search argument "Linux modules".