Administrative aspects of the LRZ module setup

Packaging and Configuration

Packages

The LRZ version of modules is slightly modified with respect to the original, especially with respect to the initialization functionality. There a two parts to the modules package:

Modules source repository at LRZ

The complete source package is kept under SVN in the LRZ HPC repository. LRZ staff can check out the source tree by issuing the command

svn checkout https://svn.lrz-muenchen.de/repos/hlr/trunk/modules

Changing to the root directory and typing make hint will give you an overview over all available targets. Available platform-dependent subdirectories are

i386_Linux (frozen)
ia64_Linux
powerpc_AIX (is obsolete and will soon be discarded)
x86_64_Linux
deisa_specific

while the platform-independent configuration stuff is placed in init. The source tree can also serve as a testing facility. To do this, please source the setup.* corresponding to your shell.
Please do not forget to perform a SVN update / SVN commit cycle if you perform any corrections/updates to the package. To get an overview of installation options, please type make in the base module source directory.

Remarks on LRZ setup

Conceptual and Implementational Problems

List of default versions

With the new "/" convention the default version is provided via the modulename/.version file. This is then also indicated when performing a module avail command, and the correct default version is automatically loaded if no version information is provided.

Changes and extensions to the modulescmd.tcl file

The following changes have been applied:
  1. The procedures prepend-path and append-path have been extended to allow to deal with database-like variables with arbitrary separators. Within a module file it is now possible to do e.g.,
             prepend-path VAR value " "
             
    to expand the content of the whitespace separated variable VAR. This especially obviates the necessity of using the extra DEISA_*_INTERNAL variables. Note: This is work in progress since for consistency with the C version the --delimit switch should be added (newer modulecmd.tcl needed).
  2. module switch reloads all modules which appear to have been loaded later than the module to be replaced. This is a nuisance for the reloading mechanism required for the deisa and lrz modules. Hence, a provision (presently a LRZ specific hack) has been added to have an exception list of modules which will always be considered as independent and hence will not be processed. This change has been accepted by the code maintainer.

Additional utilities

Reference Files

This section contains reference files which can be used as templates for writing new module files. Note that these reference files also take into account some LRZ specific settings. Also, editing Module files should be performed not in the production environment, but within the CVS sandbox. Hence the default $MODULESHOME etc. settings need to be changed by running the setup as described above.

Module file

The first example is a module file for version 1.3 of software package pac. Please edit the file <arch_specific>/files/<class>/pac/1.3 in the appropriate module class subtree to contain the following text:
#%Module

# LRZ HPC user environment
# DEISA Common Production Environment
#
# Author                : wrzlprmft@lrz.de
# Created               : Wed Jul 11 2012
#

set DIRECTORY "/lrz/sys/<class>/pac"
set VERSION   1.3_build2

# version and architecture independent part in common include file
source $env(MODULE_INCLUDE)/whatever/pac.tcl
# the following line only if DEISA enablement required.
source $env(MODULE_INCLUDE)/whatever/deisa_pac.tcl



Architecture and version independent includes

The include/<class>/pac.tcl file might then contain entries of the following form
# LRZ HPC user environment
# DEISA Common Production Environment
#
# Author                : wrzlprmft@lrz.de
# created               : Wed Jul 11 2012
#
# needs Tcl internal variables
#  DIRECTORY  base directory
#  VERSION    version subdirectory
#  WWWDoc     LRZ WWW server documentation

set WWWDoc "http://www.lrz-muenchen.de/services/software/whatever/pac"
module-whatis "Enable usage of PAC application software"

# TMPDIR needed for scratch files
prereq tempdir
# Only one version at a time
conflict pac
# Note: can also have prereq and conflict lines in module file if necessary

# need to be member of group "pac" to use
set groups [ exec groups $env(USER) ]
if { [ lsearch -exact $groups pac ] == -1 && [module-info mode] == "load" } {
  puts stderr "Your account is not in the UNIX group pac.
Please contact LRZ support to have it entered. Aborting module load."
  break
}
# Tcl internal settings of e.g. PAC_SHLIB required for DEISA setup
set          DIR         "${DIRECTORY}/${VERSION}"
setenv       PAC_BASE    "$DIR"
setenv       PAC_LIBDIR  "${DIR}/lib"
setenv       PAC_INC     "-I${DIR}/include"
set          PAC_LIB     "${DIR}/lib/libpac.a"
setenv       PAC_LIB     "$PAC_LIB"
set          PAC_SHLIB   "-L${DIR}/lib/ -lpac"
setenv       PAC_SHLIB   "$PAC_SHLIB"
setenv       PAC_DOC     "${DIR}/docs"
setenv       PAC_WWW     "$WWWDoc"
setenv       PAC_SRC     "/lrz/noarch/src/PAC"
setenv       PAC_INSTALL_DOC "/lrz/noarch/src/PAC/REAMDE_lrz"
prepend-path LD_LIBRARY_PATH "${DIR}/lib"
prepend-path PATH        "${DIR}/bin"
prepend-path MANPATH     "${DIR}/man"
prepend-path INFOPATH    "${DIR}/info"

# make application usage profile entry
# (do not use for very heavily used stuff like compilers)
if { [module-info mode] == "load" } {
  exec /usr/bin/application-control pac $VERSION $env(HOSTNAME)
}
proc ModulesHelp {} {
  global WWWDoc
  puts stderr "
Enable the usage of PAC application software.
Documentation on LRZ Web Server at
$WWWDoc."

  return 0
}

Note that some application use their own naming scheme for environment variables. This should of course take precedence to the LRZ naming scheme indicated above. The include/<class>/deisa_pac.tcl file might be of the form


#
# enable DEISA settings for pac
# requires the PAC_SHLIB internal Tcl variable
#
if { "[ lindex [ array get env DEISA_ENV ] end ]" == "yes" } {
  if { $env(DEISA_NOCOMPILER_WRAPPERS) == 1 } {
    setenv DEISA_PAC_LDFLAGS "$PAC_SHLIB"
  }
  prepend-path DEISA_LDFLAGS  "$PAC_SHLIB" " "
}


Notes:

Version file

Finally, a version file <arch_specific>/files/<class>/pac/.version must be created:
#%Module
# LRZ HPC user environment
# DEISA Common Production Environment
##
##  default version
##
set ModulesVersion "1.3"



Additional notes

Internet sources of original package

The source of the original modules package can be obtained from sourceforge using CVS:
   cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/modules login
   (empty password)
   cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/modules co modules
   (first checkout, after this updates in base directory should be OK).
   
All sources below subdirectory src; according to DEISA requirements, the new Tcl version should be used (see subdirectory tcl) if possible. But the module files essentially are compatible (the C version is linked with libtcl).