Supercomputing Networking Research Education Ohio Supercomputer Center Site Map Staff Directory Support
Supercomputing image

Modules

Introduction

The Modules package provides for the dynamic modification of your programming environment.

The shell-defined module is an interface to the Modules package.

Beginning with Programming Environment 2.0, Cray Research, Inc. has adopted the Modules package as a means of providing access to particular release levels of compilers, libraries, tools, and associated files.

Usage

Module is defined in the system startup files, /etc/profile and /etc/cshrc. Thus this function is available at login.

Additionally, the command:

module load modules

has been inserted in the system startup files. This enables immediate use of the man page for module.

Some of the uses of module look like:

module list
module avail
module load PrgEnv
module switch cf90 cf90.2.0.0.0
module help PrgEnv

Programming

For C-shell users, module is defined as an alias. For POSIX-shell users, module is defined as a function. This means that without further action on your part, module will not be defined in child shells executed by name from the current session. The same is true of C-shell subshells.

Module operates by modifying or setting a number of environment variables, including your execution path, MANPATH, and NLSPATH. This is done using setenv or export. These changes do persist as a new shell is executed, so if you do not try to use module in a shell script, you don't have to do what we are about to suggest.

The modules package has commands that let you specify your own startup situation. For example, you could always start up with the module set called "PrgEnv" enabled. The commands are:

module initadd programming-environment
module initrm programming-environment
module initswitch programming-component programming-component

These commands operate by manipulating your .cshrc file or your .profile file. The assumtion is that there is a module command in the proper file; the module init... command changes it.

POSIX

We suggest that you create a $HOME/.profile file if you don't have one and after all paths have been set, add:

module()
{ eval `/opt/modules/modules/bin/modulecmd sh $*`; }
typeset -xf module
module load modules

Furthermore we suggest that in your .profile file, you put:

export ENV=~/.env

and that you create a file named .env ($HOME/.env) that contains:

module()
{ eval `/opt/modules/modules/bin/modulecmd sh $*`; }
typeset -xf module

These moves will allow the use of the "init" subcommands mentioned above and will give you the greatest flexibility in using module from scripts or grouped commands within a script.

csh

We suggest that you create a $HOME/.cshrc file if you don't have one and after all paths have been set, add:

source /opt/modules/modules/init/csh
module load modules

This will not allow use of module in shell scripts, but it will allow the use of the "init" subcommands mentioned above.

Documentation

A short indication of the subcommands of module is produced by:

module help

The use of the module function is documented by a man page that is accessible via man when the modules package has been loaded via the module function.