- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -
- Information contained in the HLRS Wiki is not legally binding and HLRS is not responsible for any damages that might result from its use -

Module environment(Hawk): Difference between revisions

From HLRS Platforms
Jump to navigationJump to search
Line 71: Line 71:


=== Further nice features ===
=== Further nice features ===
* Extensions: It’s possible to define “extensions”, i.e. some kind of pseudo-modules for stuff like numpy or scipy included in Python (but also e.g. FFTW included in AOCL, stuff included in Cray’s libsci, etc.). Those extensions will be listed by module avail and module spider in (almost) the same way as regular modules are listed. Extensions can’t be loaded in the same way as regular modules, but Lmod tells the user how to do so after module load <extension-name> fails. With respect to details cf. https://lmod.readthedocs.io/en/latest/330_extensions.html.
* Nag message: It’s possible to print messages when loading modules, e.g. to announce deprecation (cf. https://lmod.readthedocs.io/en/latest/140_deprecating_modules.html and https://lmod.readthedocs.io/en/latest/090_configuring_lmod.html#environment-variables-only).
* Brief description of module: If adding whatis("Description: foobar"), the string “foobar” will be shown in the output of module spider below the module name / versions (cf. https://lmod.readthedocs.io/en/latest/135_module_spider.html#level-0-module-spider).
* It’s possible to hide modulefiles and entire directories in the output of module avail and module spider by means of a leading dot in the file-/directory-name (cf. https://lmod.readthedocs.io/en/latest/055_module_names.html#special-names-for-modulefiles).
* Hierarchy labels: In case you add a compiler or MPI implementation, take care to add the respective path to SitePackage.lua in order to prettily label the group of modules build with that compiler / MPI (cf. https://lmod.readthedocs.io/en/latest/200_avail_custom.html).
* Debugging: Actions triggered by Lmod can be shown via module --trace <subcommand> (cf. https://lmod.readthedocs.io/en/latest/220_tracing.html#tracing-lmod).

Revision as of 14:56, 14 January 2020

Hints for users

A module environment is used on Hawk in order to allow for flexibly choosing software to be used out of a large set. In order to use a particular software, you first have to load the respective module. A set of default modules is already loaded after login.


A new implementation of the module command is used on Hawk in order to allow for improved user experience. However, the same sub-commands are available as known from former systems. The layout of outputs yet slightly differs. Furthermore, not all available modules are shown right after login (cf. below).


Basic commands:

  • show available modules: module avail or module avail <substring to be searched for>
  • show brief description for a given module: module whatis <modulename>
  • (un)load a module: module (un)load <modulename>
  • swap modules: module swap <old module> <new module>
  • show loaded modules: module list
  • show help for a specific module: module help <modulename>
  • search for keywords (e.g. “compiler”, “debugger”, etc.) in module descriptions: module keyword <keyword>


Please have a look on here w.r.t. further functionality.


In order to work properly, applications built with a given compiler and MPI need to be linked with libraries built with the very same compiler and MPI. The module mechanism deployed on Hawk supports you in doing so by providing only those modules built with the currently loaded compiler and MPI. In case of swapping the compiler and/or MPI, available and loaded modules are also swapped in order to match with the new compiler/MPI.


Right after login, you can load so-called system and core modules only. After loading a compiler, module avail shows also the modules depending on that compiler. In this set, you can - in particular - find MPI implementations. After loading one of those, module avail also shows the modules depending on the loaded compiler as well as MPI.
In order to list all available modules without considering their dependencies, use module spider. By passing a specific module to the module spider command, the system tells you which modules have to be loaded first in order to load the respective module.


Details

  • It’s not allowed to have more than one version of a module loaded at a time. In particular, it’s not possible to have more than one compiler loaded at once. In case you need multiple compilers, please inspect the respective module files and set the required environment variables by your own.
  • If no version is specified, the module command picks the one with the highest version. If there are multiple modules with the same version, it picks the one found first while searching “from top to bottom” (w.r.t. to the output of module avail). In fact, the rule is more complicated. Please refer to here with respect to details.
  • All Bash scripts should start with #!/bin/bash, not #!/bin/sh, otherwise the module command will not be available in the script!
  • We provide support for Bash only. In case of the module command not being defined (correctly), cf. here and here.
  • Do an export LMOD_PAGER=None to turn off displaying multi-page outputs with a pager (e.g. less).




Hints for modulefile providers

  • Instead of the traditional one (Link, to be called Tmod hereinafter) Hawk uses a new implementation of the module command called Lmod (Link). While Tmod uses modulefiles written in TCL, Lmod uses modulefiles written in Lua.
  • Lmod can however also read and use TCL modulefiles. It does this by evaluating the TCL statements as far as possible, fill the results into equivalent Lua statements and execute the resulting Lua script. This might lead to problems in special cases (cf. here and here)!
  • If writing a new modulefile, you should nevertheless prefer Lua over TCL. Compare for the following resources with respect to the syntax to be used:
  • It’s also possible to convert traditional TCL modulefiles to their Lua equivalents by calling $(dirname ${LMOD_CMD})/tcl2lua.tcl.
  • Spack is configured to automatically generate modulefiles in TCL as well as Lua format. You hence don’t have to care about modulefiles when installing via Spack.


Details

  • Spider cache: If there is a system spider cache, please recreate it in case you added / modified a modulefile! You can do this by calling $(dirname ${LMOD_CMD})/update_lmod_system_cache_files (cf. here).
  • PATH-like variables: It is important how duplicates in the PATH-like variables are handled. At the moment, LMOD_TMOD_PATH_RULE is set to yes in order to have the same behavior as the traditional module command (cf. here). Please have in mind that duplicates might be generated by:
    • Explicit loads of modules
    • Implicit loads due to modules loading further modules as prerequisites
    • Different modules inserting the same path
  • 2-digit-rule: Lmod developers suggest to assume compatibility in between compilers and MPI stacks which differ in the third digit of the version number only.
  • Shared home: Some care has to be taken if running Lmod on multiple clusters with shared home filesystems (as is e.g. w.r.t. Hawk and Vulcan), cf. here.
  • In case of problems, contact Björn Dick <dick@hlrs.de>.


Further nice features

  • Extensions: It’s possible to define “extensions”, i.e. some kind of pseudo-modules for stuff like numpy or scipy included in Python (but also e.g. FFTW included in AOCL, stuff included in Cray’s libsci, etc.). Those extensions will be listed by module avail and module spider in (almost) the same way as regular modules are listed. Extensions can’t be loaded in the same way as regular modules, but Lmod tells the user how to do so after module load <extension-name> fails. With respect to details cf. https://lmod.readthedocs.io/en/latest/330_extensions.html.