Modules: Difference between revisions

From UMIACS
Jump to navigation Jump to search
No edit summary
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=GNU Modules=
=GNU Modules=
 
Many large institutions use the concept of Modules to load software into user environments.  It provides a way to add and remove, if later needed, environmental variables that provide access to UMIACS large set of software we offer on our Red Hat Enterprise Linux ([[RedHat]]) and [[Ubuntu]] platforms.  This works by customizing your shell environment and is done automatically for the two major shell families (bash/sh (default shell) and tcsh/csh). If you use an alternate shell, please look to source the appropriate script for your shell in <tt>/usr/share/Modules/init</tt>
Many large Institutions use the concept of Modules to load software into users environment.  It provides a way to add and later if needed remove environmental variables that provide access to UMIACS large set of software we offer on our Red Hat Enterprise Linux ([[RHEL]]) platform.  This works by customizing your shell environment, this is done automatically for the two major shell families bash/sh (default shell) and tcsh/csh.   If you use a alternate shell please look to source the appropriate script for your shell in <tt>/usr/share/Modules/init</tt>.


Initially your module environment is empty though included in your ModulePath is local operating system specific modules, locally built software modules and binary software modules (Matlab, Intel Compiler, etc...).
Initially your module environment is empty though included in your ModulePath is local operating system specific modules, locally built software modules and binary software modules (Matlab, Intel Compiler, etc...).
Line 9: Line 8:


<pre>
<pre>
[derek@supernova ~]$ module avail matlab
[username@nexusstaff00~]$ module avail matlab


---------------------------------------- /opt/common/.modulefiles -----------------------------------------
---------------------------------------- /opt/common/.modulefiles -----------------------------------------
Line 17: Line 16:


<pre>
<pre>
[derek@supernova ~]$ module avail gcc
[username@nexusstaff00~]$ module avail gcc


-------------------------------------- /opt/local/stow/.modulefiles ---------------------------------------
-------------------------------------- /opt/local/stow/.modulefiles ---------------------------------------
Line 29: Line 28:


<pre>
<pre>
[derek@supernova ~]$ module add matlab
[username@nexusstaff00 ~]$ module add matlab
</pre>
</pre>


Line 35: Line 34:


<pre>
<pre>
[derek@supernova ~]$ module add cuda/5.0.35
[username@nexusstaff00 ~]$ module add cuda/5.0.35
</pre>
 
==Listing Modules==
You can list the currently loaded modules in your environment by using the '''list''' command.
 
<pre>
[username@nexusstaff00 ~] $ module list
Currently Loaded Modulefiles:
  1) R/3.1.2    2) kile/2.1  3) vim/7.4
</pre>
 
==Showing a Module==
You can show what the module is going to add to your environment (and the dependencies that will be added) with the '''show''' command.
 
<pre>
[username@nexusstaff00 ~] $ module show fftw
-------------------------------------------------------------------
/opt/local/stow/.modulefiles/fftw/3.3.4:
 
prepend-path    PATH /opt/local/stow/fftw-3.3.4/bin
prepend-path    CPATH /opt/local/stow/fftw-3.3.4/include
prepend-path    LIBRARY_PATH /opt/local/stow/fftw-3.3.4/lib
prepend-path    LD_RUN_PATH /opt/local/stow/fftw-3.3.4/lib
prepend-path    MANPATH /opt/local/stow/fftw-3.3.4/share/man
prepend-path    PKG_CONFIG_PATH /opt/local/stow/fftw-3.3.4/lib/pkgconfig
-------------------------------------------------------------------
</pre>
</pre>


==Removing Modules in your Environment==
==Removing Modules in your Environment==
If you want to remove a module because it conflicts or you want to clean up your environment you can by using the <tt>module  rm <module></tt> command.
If you want to remove a module because it conflicts or you want to clean up your environment you can by using the <tt>module  rm <module></tt> command.
==Using Modules in Scripts==
To use modules within a shell script or interpreted language you will need to load a file from <tt>/usr/share/Modules/init</tt> into your program.
===Bash===
<pre>
. /usr/share/Modules/init/bash
module add gcc
</pre>
===Tcsh===
<pre>
source /usr/share/Modules/init/tcsh
module add gcc
</pre>
==Modules in Non-Interactive Shell Sessions==
In non-interactive shell sessions (non-login shells), the Modules configuration environment will not automatically load. This will also occur if the OS version of the compute node you are scheduled on is different from the OS version of the submission node you are submitting the job from.
If you will need the use of Modules in non-interactive [[SLURM]] jobs, cross-OS jobs, or other similar sessions, you will need to include the following in your shell init scripts:
===Bash===
<pre>
. /usr/share/Modules/init/bash
. /etc/profile.d/ummodules.sh
</pre>
===Tcsh===
<pre>
source /usr/share/Modules/init/tcsh
source /etc/profile.d/ummodules.csh
</pre>


==Additional Help==
==Additional Help==

Revision as of 22:49, 22 April 2022

GNU Modules

Many large institutions use the concept of Modules to load software into user environments. It provides a way to add and remove, if later needed, environmental variables that provide access to UMIACS large set of software we offer on our Red Hat Enterprise Linux (RedHat) and Ubuntu platforms. This works by customizing your shell environment and is done automatically for the two major shell families (bash/sh (default shell) and tcsh/csh). If you use an alternate shell, please look to source the appropriate script for your shell in /usr/share/Modules/init

Initially your module environment is empty though included in your ModulePath is local operating system specific modules, locally built software modules and binary software modules (Matlab, Intel Compiler, etc...).

Available Software

To see if a piece of software is available you use the module avail command. This can be given a trailing prefix on the command line to search a subset of the available software.

[username@nexusstaff00~]$ module avail matlab

---------------------------------------- /opt/common/.modulefiles -----------------------------------------
matlab/2007b matlab/2008b matlab/2010a matlab/2011a matlab/2012a
matlab/2008a matlab/2009b matlab/2010b matlab/2011b matlab/2012b
[username@nexusstaff00~]$ module avail gcc

-------------------------------------- /opt/local/stow/.modulefiles ---------------------------------------
gcc/4.6.0          gcc/4.7.2(default) gcc/boost/1.53.0

There may be a (default) module otherwise the most recent version of software is loaded when specified.

Adding Modules into your Environment

You can simply add a module into your environment by using the module add <module> command.

[username@nexusstaff00 ~]$ module add matlab

You can also specify a specific version of the software when we have multiple ones available.

[username@nexusstaff00 ~]$ module add cuda/5.0.35

Listing Modules

You can list the currently loaded modules in your environment by using the list command.

[username@nexusstaff00 ~] $ module list
Currently Loaded Modulefiles:
  1) R/3.1.2    2) kile/2.1   3) vim/7.4

Showing a Module

You can show what the module is going to add to your environment (and the dependencies that will be added) with the show command.

[username@nexusstaff00 ~] $ module show fftw
-------------------------------------------------------------------
/opt/local/stow/.modulefiles/fftw/3.3.4:

prepend-path     PATH /opt/local/stow/fftw-3.3.4/bin
prepend-path     CPATH /opt/local/stow/fftw-3.3.4/include
prepend-path     LIBRARY_PATH /opt/local/stow/fftw-3.3.4/lib
prepend-path     LD_RUN_PATH /opt/local/stow/fftw-3.3.4/lib
prepend-path     MANPATH /opt/local/stow/fftw-3.3.4/share/man
prepend-path     PKG_CONFIG_PATH /opt/local/stow/fftw-3.3.4/lib/pkgconfig
-------------------------------------------------------------------

Removing Modules in your Environment

If you want to remove a module because it conflicts or you want to clean up your environment you can by using the module rm <module> command.

Using Modules in Scripts

To use modules within a shell script or interpreted language you will need to load a file from /usr/share/Modules/init into your program.

Bash

. /usr/share/Modules/init/bash
module add gcc

Tcsh

source /usr/share/Modules/init/tcsh
module add gcc

Modules in Non-Interactive Shell Sessions

In non-interactive shell sessions (non-login shells), the Modules configuration environment will not automatically load. This will also occur if the OS version of the compute node you are scheduled on is different from the OS version of the submission node you are submitting the job from.

If you will need the use of Modules in non-interactive SLURM jobs, cross-OS jobs, or other similar sessions, you will need to include the following in your shell init scripts:

Bash

. /usr/share/Modules/init/bash
. /etc/profile.d/ummodules.sh

Tcsh

source /usr/share/Modules/init/tcsh
source /etc/profile.d/ummodules.csh

Additional Help

You can type module with no arguments for a full list of commands or man module for further information.

Online Resources