Help:HPCC Env Modules: Difference between revisions

From CSDMS
m (Add examples, trim table, get shell)
m (Links to module man page)
Line 34: Line 34:
| Give the rules for module <module-name>
| 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 ==
== Set Up Environment Modules ==
Line 41: Line 46:
source /usr/local/modules/init/<shell>
source /usr/local/modules/init/<shell>
</syntaxhighlight>
</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 module command.
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].


== Use beach-Specific Modules ==
== Use beach-Specific Modules ==
Line 58: Line 63:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
> module avail
> module avail
---------------------------------------------------------- /data/progs/localmodules -----------------------------------------------------------
--------------------------- /data/progs/localmodules ---------------------------
cca/eric                glib2                  mpich2/1.1              petsc                  sedflux/mars
cca/eric                libxml2                python/2.5
cca/stable(default)    gnu                    mvapich2/1.2           python/2.4              sedflux/nightly
cca/stable(default)    matlab/2008b           python/2.6(default)
cca/yanb                hdf5                    netcdf                  python/2.5             sedflux/stable(default)
cca/yanb                mpich2/1.1             scons
cmake                  intel/11.0              null                    python/2.6(default)    subversion
cmake                  mvapich2/1.2            sedflux/intel
gcc/4.1                libxml2                openmi/1.4              scons                  torque
gcc/4.1                netcdf                  sedflux/mars
gcc/4.3(default)        matlab/2008b            openmpi/1.3            sedflux/intel          udunits
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 --------------------------------------------------
------------------ /usr/local/modules-3.2.6/Modules/versions -------------------
3.2.6
3.2.6


--------------------------------------------- /usr/local/modules-3.2.6/Modules/3.2.6/modulefiles ----------------------------------------------
-------------- /usr/local/modules-3.2.6/Modules/3.2.6/modulefiles --------------
dot        module-cvs  module-info modules    null        use.own
dot        module-cvs  module-info modules    null        use.own
</syntaxhighlight>
</syntaxhighlight>

Revision as of 16:16, 11 August 2009

Environment Modules

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.

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

Command Description
module avail List available modules
module load <module-name> Load module named <module-name>
module unload <module-name> Unload module named <module-name>
module whatis <module-name> Give description of module <module-name>
module list List modules that are loaded in your environment
module purge Unload all currently loaded modules from your environment
module display <module-name> Give the rules for module <module-name>

For a more complete description, see the module man page or type

> man module

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,

source /usr/local/modules/init/<shell>

Where <shell> 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 module command.

Use beach-Specific Modules

For module to recognize the modules install on the cluster, you must tell module to use the local modulefiles,

module use /data/progs/localmodules

You can also add this to your RC file after the previous initialization 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,

> 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

Load python 2.6,

> which python
/usr/bin/python
> module load python/2.6
> which python
/usr/local/bin/python/bin/python

Get the name of your shell

If you're not sure what shell you are running, try running the following command,

> grep <username> /etc/passwd | cut -d: -f7

Substitute your username for <username>.

Get the name of your startup RC file

The following table lists user RC files for shells available on the cluster.

sh ksh csh tcsh bash
~/.tcshrc always
~/.cshrc always always
~/.login login login
~/.logout login login
~/.profile login login login
~/.bash_profile login
~/.bash_login login
~/.bash_logout login
~/.bashrc ! 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.