WorkingOnServers/ModulePackage

From mn/geo/geoit
Revision as of 16:43, 30 January 2015 by Basal@uio.no (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Linux User Environment


 

Home Directories, Shells and Modules

Home directories ($HOME) are accessible from any of the Geosciences servers except onHPC. An environment variable called $HOME is defined and contains the absolute path of a user home directory: use this environment variable whenever possible.

The default shell at the Department of Geosciences is bash.  

Using Modules to Manage Access to Software

On sverdrup, users should not have to modify their path directly.  Instead, the module utility is used to set environment variables for software and libraries, including a lot of software that is loaded by default.  Simply ``loadand ``unload modules to control your environment.

Modules environment management package provides support for dynamic modification of the user environment via modulefiles. Each modulefile contains all the information needed to configure the shell for a particular application. Typically, a modulefile modifies environment variables like PATH, MANPATH, LD_LIBRARY_PATH and XXXX_HOME (where XXX is the name of a software/library in capital letter) to give access to an application or library.

Command Description
module list Lists modules currently loaded in a user’s environment
module avail Lists all available modules on a system in condensed format
module avail -l Lists all available modules on a system in long format
module display Shows environment changes that will be made by loading a given module
module load Loads a module
module unload Unloads a module
module help Shows help for a module
module swap Swaps a currently loaded module for an unloaded module

What is loaded now?

[sverdrup ~]$  '''module list'''

Currently Loaded Modulefiles:
  1) geosciences   2) use.own

 

What is available?

To see which modulefiles are available on your system, enter this command:

 

[sverdrup ~]$ ''' module avail''' [string]

 

The module avail command produces an alphabetical listing of every modulefile in your module use path and has no option for "grepping." Therefore, it is usually more useful to use the command with an string argument:

 

[sverdrup ~]$ ''' module avail python'''

----------------------------------------------------------------- /site/opt/Modules/modulefiles/software ------------------------------------------------------------------
python/anaconda(default) python/canopy

 

Loading and Unloading Modules

If a modulefile is not already loaded, use the module load command to load:

 

[sverdrup ~]$ ''' module load netcdf'''

 

This command loads the currently defined default version of the module, unless you specify otherwise:

 

[sverdrup ~]$ ''' module load netcdf/4.2.0_intel'''

 

This will load the netcdf library compiled with intel compilers.

 

If you want to remove a software/library from your user environment you may unload it:

 

sverdrup ~]$ ''' module unload netcdf/4.2.0_intel'''

 

You need to unload the same version you previously loaded.

 

Module Swapping

Alternatively, you can use the module swap or module switch command to unload one module and load the comparable module:

sverdrup ~]$ ''' module load netcdf'''
sverdrup ~]$ ''' module list'''

Currently Loaded Modulefiles:

1) geosciences 2) use.own 3) netcdf/4.2.0_gnu
sverdrup ~]$ ''' module switch netcdf netcdf/4.2.0_intel'''
sverdrup ~]$ ''' module list'''

Currently Loaded Modulefiles: 1) geosciences 2) use.own 3) netcdf/4.2.0_intel  

Loading modules automatically

By default, one module is loaded at login (geosciences). However, you may want to customize your environment and load modules that you use often at login. It is recommended that you do this by creating a ~/.modulerc file. This file must contain the special modulefile token "#%Module1.0" on the first line followed by one or more module commands:

#%Module1.0

set version 1.0
module load netcdf

 

This will cause the default version of netcdf to be automatically loaded when you log in.

 

Adding your our modulefile

Create a directory called privatemodules in your home directory. Then type the command:

module load use.own

and any personal module files in this directory will become available for you to list, load or unload. As previously explained, you can add it to ~/.modulerc to load it automatically at login.

Our modulefiles are in/site/opt/Modules/modulefiles and they can be copied to use as templates.

 

 

For more information see Modules Software Environment.


Troubleshooting

No UIO modulefiles available

module avail should list all available modulefiles in the current MODULEPATH but if MODULEPATH is not set properly in your environment it may only display a few modulefiles. If it happens:

  module use --append /site/opt/Modules/modulefiles/compilers
  module use --append /site/opt/Modules/modulefiles/environment 
  module use --append /site/opt/Modules/modulefiles/software 
  module use --append /site/opt/Modules/modulefiles/libraries

 

Cannot find the module command

If you get the message

module: command not found