|
|
Line 1: |
Line 1: |
| = Environment Modules =
| | Please see the |
| [[File:IAC_Building_Medium_(wallyg).jpg | right | 400px | Photo by Flickr user wallyg used under a Creative Commons license]] | | [[HPC]] |
| | | page for the latest information on this topic. |
| Several software packages on the cluster require correct definition of certain environment variables. These variables establish the package's configuration and influence its behavior. For example, PATH and LD_LIBRARY_PATH specify the location of package binary files.
| |
| | |
| [http://modules.sourceforge.net Environment Modules] is a tool to manage package environment variables.
| |
| | |
| With simple command line options, you can prepare the environment for any package available on the cluster. In the case of packages with multiple versions, there are options to switch between one version and another - defining and undefining variables as needed. If there is a conflict between two packages, module will alert you.
| |
| | |
| == Cheat Sheet ==
| |
| | |
| {|
| |
| ! align=left width=250 | Command
| |
| ! align=left | Description
| |
| |-
| |
| | <tt>module avail</tt>
| |
| | List available modules
| |
| |-
| |
| | <tt>module load <module-name></tt>
| |
| | Load module named <module-name>
| |
| |-
| |
| | <tt>module unload <module-name></tt>
| |
| | Unload module named <module-name>
| |
| |-
| |
| | <tt>module whatis <module-name></tt>
| |
| | Give description of module <module-name>
| |
| |-
| |
| | <tt>module list</tt>
| |
| | List modules that are loaded in your environment
| |
| |-
| |
| | <tt>module purge</tt>
| |
| | Unload all currently loaded modules from your environment
| |
| |-
| |
| | <tt>module display <module-name></tt>
| |
| | Give the rules for module <module-name>
| |
| |}
| |
| | |
| For a more complete description, see the [http://modules.sourceforge.net/man/module.html module man page] or type
| |
| <syntaxhighlight lang=bash>
| |
| > man module
| |
| </syntaxhighlight>
| |
| | |
| == Set Up Environment Modules ==
| |
| | |
| To use Environment Modules you will have to add a couple of things to your startup RC file. The module command is initialized by sourcing a shell-specific initialization file. You will find the initialization files /usr/local/modules/init. To initialize modules,
| |
| <syntaxhighlight lang=bash>
| |
| source /usr/local/modules/init/<shell>
| |
| </syntaxhighlight>
| |
| Where <code><shell></code> is the name of your shell. To have this done automatically when you login, add this command to the end of your startup RC file. You should now be able to use the [http://modules.sourceforge.net/man/module.html module command].
| |
| | |
| == Examples ==
| |
| | |
| The following examples assume that you have executed (either interactively or in a login RC file) the previous two commands.
| |
| | |
| List all available modules,
| |
| <syntaxhighlight lang=bash>
| |
| > module avail
| |
| --------------------------- /data/progs/localmodules ---------------------------
| |
| cca/eric libxml2 python/2.5
| |
| cca/stable(default) matlab/2008b python/2.6(default)
| |
| cca/yanb mpich2/1.1 scons
| |
| cmake mvapich2/1.2 sedflux/intel
| |
| gcc/4.1 netcdf sedflux/mars
| |
| gcc/4.3(default) null sedflux/nightly
| |
| glib2 openmi/1.4 sedflux/stable(default)
| |
| gnu openmpi/1.3 subversion
| |
| hdf5 petsc torque
| |
| intel/11.0 python/2.4 udunits
| |
| | |
| ------------------ /usr/local/modules-3.2.6/Modules/versions -------------------
| |
| 3.2.6
| |
| | |
| -------------- /usr/local/modules-3.2.6/Modules/3.2.6/modulefiles --------------
| |
| dot module-cvs module-info modules null use.own
| |
| </syntaxhighlight>
| |
| | |
| Load python 2.6,
| |
| <syntaxhighlight lang=bash>
| |
| > which python
| |
| /usr/bin/python
| |
| > module load python/2.6
| |
| > which python
| |
| /usr/local/bin/python/bin/python
| |
| </syntaxhighlight>
| |
| | |
| == Get the name of your shell ==
| |
| | |
| If you're not sure what shell you are running, try running the following command,
| |
| <syntaxhighlight lang=bash>
| |
| > grep <username> /etc/passwd | cut -d: -f7
| |
| </syntaxhighlight>
| |
| Substitute your username for <code><username></code>.
| |
| | |
| == Get the name of your startup RC file ==
| |
| | |
| The following table lists user RC files for shells available on the cluster.
| |
| | |
| {| class="sortable" {{Prettytable}}
| |
| !{{H13}}|
| |
| !{{H13}}| sh
| |
| !{{H13}}| ksh
| |
| !{{H13}}| csh
| |
| !{{H13}}| tcsh
| |
| !{{H13}}| bash
| |
| |-
| |
| |<code>~/.tcshrc</code> || || || || always ||
| |
| |-
| |
| | <code>~/.cshrc</code>|| || || always || always ||
| |
| |-
| |
| |<code>~/.login</code> || || || login || login ||
| |
| |-
| |
| | <code>~/.logout</code> || || || login || login ||
| |
| |-
| |
| |<code>~/.profile</code> || login || login || || || login
| |
| |-
| |
| |<code>~/.bash_profile</code> || || || || || login
| |
| |-
| |
| |<code>~/.bash_login</code> || || || || || login
| |
| |-
| |
| |<code>~/.bash_logout</code> || || || || || login
| |
| |-
| |
| |<code>~/.bashrc</code> || || || || || ! login
| |
| |}
| |
| | |
| Explanation:
| |
| * Blank means the file is not read by the shell at all.
| |
| * '''always''' means the file is always read by the shell upon startup.
| |
| * '''login''' means the file is read if the shell is a login shell.
| |
| * '''! login''' means the file is read if the shell is ''not'' a login shell.
| |
Please see the
HPC
page for the latest information on this topic.