Difference between revisions of "Modules Guide"

From Storrs HPC Wiki
Jump to: navigation, search
(Created page with "===What is Modules?=== Modules creates an environment to load and unload programs. This allows for a user to select different versions of applications that they would like t...")
 
(What is Modules?)
Line 1: Line 1:
 
===What is Modules?===
 
===What is Modules?===
  
Modules creates an environment to load and unload programs.  This allows for a user to select different versions of applications that they would like to use. For instance, if you use the GNU Java Compiler, but the default is Sun, then you would be able to quickly load the GNU version and compile your code. When using the cluster, you have to load the module for an application you wish to use in order to run the application.
+
'''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. Instead of typing the full path every time, Modules adds software paths to your environment PATH variable.
  
 
===Viewing Modules===
 
===Viewing Modules===

Revision as of 19:29, 20 June 2012

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. Instead of typing the full path every time, Modules adds 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.

Some modules have conflicts. For example. gcc 4.6.1 and gcc 4.1.2 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 when you log in, add them to your .bashrc file. To do this run:

module initadd {module name}

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:

"{HOME}/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.

#%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