Modules

The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles. For example, we can have two o more gcc versions (gcc 4.3.5, gcc.4.6.0, etc). With a single command, we can use the appropriate gcc version.

For instance:

$ module list
Currently Loaded Modulefiles:
  1) /java/sun1.6 

$ module load gcc/4.6.0
$ module list
Currently Loaded Modulefiles:
  1) /java/sun1.6   2) /gcc/4.6.0

$ gcc --version
gcc (GCC) 4.6.0

$ module del gcc
$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)

The last line shows the gcc system version.


How to install?

Modules depends to tcl. If we have an ubuntu system, we need to install tcl8.4-dev (ubuntu package).

$ sudo apt-get install tcl8.4-dev

We download the program and install.

$ wget  http://sourceforge.net/projects/modules/files/Modules/modules-3.2.8/modules-3.2.8a.tar.gz
$ tar xvzf modules-3.2.8a.tar.gz
$ cd  modules-3.2.8a
$ ./configure
$ make
$ sudo make install

Then we have to run add.modules program in /usr/local/Modules/3.2.8/bin/

$ sudo /usr/local/Modules/3.2.8/bin/add.modules

This program will update PATH to module program and will add the information to skel user file.

Then, we have to create a soft link from Modules directory to bin directory.

$ cd /usr/local/Modules
$ sudo ln -s 3.2.8/bin/

Finally, we need to set the MODULEPATH variable in  ~/.bashrc file

For example:

# bashrc file
MODULEPATH=/opt/env/

In this directory, we will have all sofware. For instance, gcc, icc, mathlab, etc.


 Configuration

We need to create a single configuration file. With this file, we indicate to modules the PATH to find the appropiate files. For example, if we have installed the gcc 4.6.0 in our system:

______________________________________________________
#%Module -*- tcl -*-
#
proc ModulesHelp { } {
  puts stderr "\tThis module loads GNU gcc environment variables." 
}

module-whatis   "Loads GNU gcc environment." 
conflict icc
conflict ifort

prepend-path PATH "/opt/envhpc/gcc-4.6.0/bin" 
prepend-path LD_LIBRARY_PATH "/opt/envhpc/gcc-4.6.0/lib" 
prepend-path LD_LIBRARY_PATH "/opt/envhpc/gcc-4.6.0/lib64" 
prepend-path LD_LIBRARY_PATH "/opt/envhpc/mpc/0.9/lib" 
prepend-path LD_LIBRARY_PATH "/opt/envhpc/mpfr/3.0.1/lib" 
prepend-path LD_LIBRARY_PATH "/opt/envhpc/gmp/5.0.2/lib" 
prepend-path MANPATH "/opt/envhpc/gcc-4.6.0/man"

setenv CC gcc
setenv CXX g++
setenv F77 gfortran
setenv F90 gfortran
______________________________________________________

A complete Tcl code reference is in manual 4 of modules. See reference section to  find more information. With module avail command and module add/delete, we can load and unload a particular version.


References

    0 comentarios:

    Publicar un comentario en la entrada

    Por favor, no escriba al estilo SMS y use signos de puntuación en caso necesario