Difference between revisions of "Modules Guide"

From Storrs HPC Wiki
Jump to: navigation, search
m (Fix typo.)
Line 1: Line 1:
===What is Modules?===
+
=What is Modules?=
  
 
'''Environment Modules''' (referred to as just ''Modules'') is the system the cluster uses to select which software to use. It also allows you to choose which version if multiple versions of a given software exist. Modules does this by adding software paths to your environment PATH variable.
 
'''Environment Modules''' (referred to as just ''Modules'') is the system the cluster uses to select which software to use. It also allows you to choose which version if multiple versions of a given software exist. Modules does this by adding software paths to your environment PATH variable.
  
===Viewing Modules===
+
=Viewing Modules=
 
To view all available modules run the command:
 
To view all available modules run the command:
 
  module avail
 
  module avail
Line 12: Line 12:
 
  module list
 
  module list
  
===Loading Your Environment===
+
=Loading Your Environment=
  
 
To load a module run:
 
To load a module run:
Line 24: Line 24:
 
You can then load the required module
 
You can then load the required module
  
===Loading Modules on Log-in===
+
=Loading Modules on Log-in=
 
If you wish for certain modules to be loaded every time you log in, To do this run:
 
If you wish for certain modules to be loaded every time you log in, To do this run:
 
  module initadd {module name}
 
  module initadd {module name}
 
If you decide that you no longer want a specific module to be loaded every time, simply remove that line from your ~/.bashrc under the  "'''<tt># Load saved modules</tt>'''" heading.
 
If you decide that you no longer want a specific module to be loaded every time, simply remove that line from your ~/.bashrc under the  "'''<tt># Load saved modules</tt>'''" heading.
  
===Making Your Own Module Files===
+
=Making Your Own Module Files=
 
A user can create their own module files, to load environment variables and paths.  Create a directory in your home directory called <tt>'''privatemodules'''</tt>.  This is where you will store your module files.  The convention for creating module files is making a directory with the name of the application and a text file with the version number.  For example, if you wanted a module file for gcc version 4.1.2, the directory would be:
 
A user can create their own module files, to load environment variables and paths.  Create a directory in your home directory called <tt>'''privatemodules'''</tt>.  This is where you will store your module files.  The convention for creating module files is making a directory with the name of the application and a text file with the version number.  For example, if you wanted a module file for gcc version 4.1.2, the directory would be:
 
  ~/privatemodules/gcc
 
  ~/privatemodules/gcc
Line 57: Line 57:
  
 
After saving this file, you may load it the same as with the cluster module files.  Make sure you do not create a module with the same name as one already created.  For example, if <tt>gcc/4.1.2</tt> is taken, but you would like a user version of this, create <tt>gcc/4.1.2-1</tt>
 
After saving this file, you may load it the same as with the cluster module files.  Make sure you do not create a module with the same name as one already created.  For example, if <tt>gcc/4.1.2</tt> is taken, but you would like a user version of this, create <tt>gcc/4.1.2-1</tt>
===Trouble Shooting===
+
=Troubleshooting=
 
+
For any errors, please read [[FAQ]] first.
If the 'module load' command returns the following errors:
 
 
 
$ module load <Module1>
 
<Module1>(4):ERROR:150: Module '<Module1>' conflicts with the currently loaded module(s) '<Module2>'
 
<Module1>(4):ERROR:102: Tcl command execution failed: conflict <Module_Group>
 
 
 
This means that the module you want to load conflicts with the currently loaded module, <Module2>. To fix it, please unload <Module2> and then load <Module1> again:
 
 
 
$ module unload <Module2>
 
$ module load <Module1>
 
 
 
Or
 
 
 
$ module switch <Module2> <Module1>
 
  
 
[[Category:Core]]
 
[[Category:Core]]

Revision as of 21:36, 7 September 2015

What is Modules?

Environment Modules (referred to as just Modules) is the system the cluster uses to select which software to use. It also allows you to choose which version if multiple versions of a given software exist. Modules does this by adding software paths to your environment PATH variable.

Viewing Modules

To view all available modules run the command:

module avail

This will list out the applications that you can load into your environment.

To view already loaded programs, run the command:

module list

Loading Your Environment

To load a module run:

module load {MODULE_NAME}

Where your module name is one from the list of available modules. Note that tab completion works for the names of modules.

Some modules have conflicts, because different versions of the same program cannot be loaded at the same time. To check for conflicts view your modules list that is loaded. If something conflicts run the command:

module unload {MODULE_NAME}

You can then load the required module

Loading Modules on Log-in

If you wish for certain modules to be loaded every time you log in, To do this run:

module initadd {module name}

If you decide that you no longer want a specific module to be loaded every time, simply remove that line from your ~/.bashrc under the "# Load saved modules" heading.

Making Your Own Module Files

A user can create their own module files, to load environment variables and paths. Create a directory in your home directory called privatemodules. This is where you will store your module files. The convention for creating module files is making a directory with the name of the application and a text file with the version number. For example, if you wanted a module file for gcc version 4.1.2, the directory would be:

~/privatemodules/gcc

and the file name would be 4.1.2 Below is a sample module file for GCC version 4.1.2 . You can use this as a basic template.


File content:

#%Module1.0#####################################################################
##
##gcc 4.1.2  modulefile
##
##Module to set up GCC 4.1.2
##
module-whatis "GCC 4.1.2"

conflict gcc
 
prepend-path    PATH                    /usr/local/pkg/gcc/4.3.6
prepend-path    LD_LIBRARY_PATH         /usr/lib/gcc/x86_64-redhat-linux/4.1.2
prepend-path    MANPATH                 /usr/share/man/


Notice a conflict is defined, so only one version of GCC can be loaded at a time. The environment variables are defined with the path they were installed to. Specific programs may require other environment variables. In this case the basic template is:

prepend-path   {VARIABLE NAME}         {PATH}

After saving this file, you may load it the same as with the cluster module files. Make sure you do not create a module with the same name as one already created. For example, if gcc/4.1.2 is taken, but you would like a user version of this, create gcc/4.1.2-1

Troubleshooting

For any errors, please read FAQ first.