File: 190_Integration_of_EasyBuild_and_Lmod.rst

package info (click to toggle)
lmod 8.7.60-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 63,000 kB
  • sloc: sh: 6,266; makefile: 2,837; ansic: 1,513; tcl: 1,382; python: 1,050; csh: 112
file content (114 lines) | stat: -rw-r--r-- 4,097 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Integration of EasyBuild and Lmod
=================================

EB & Lmod work great together.

There are variables you should look into for tuning your system optimally, such as ``EASYBUILD_MODULES_TOOL=Lmod``, ``LMOD_PACKAGE_PATH`` (keep track of loads), ``LMOD_SYSTEM_DEFAULT_MODULES`` (choose buildsets/stages etc)

Here is an example of how to ensure that your users can choose to have (or not) the default directory of EasyBuild under home (``$HOME/.local/easybuild/modules/all``) in their ``$MODULEPATH``. Conveniently, by going this way users can save/restore environments via Lmod, at will.

Features obtained:

#. user modulefiles generated via EasyBuild are easy to enable - less typing, too
#. ``$MODULEPATH`` is managed via modulefiles in itself
#. technique is compatible with ``$LMOD_SYSTEM_DEFAULT_MODULES`` feature
#. ``ml save/restore`` work as desired

Caveats:

* This feature is super-picky on broken module environments, fi: https://bugzilla.redhat.com/show_bug.cgi?id=1326075 (testable via https://github.com/hpcugent/easybuild-framework/issues/1756) . Fix that asap, or your modulefiles experience may not be as good as it can!

How to put into use
-------------------

The two examples are visible below and are ready to be copied in respective filenames ``use.own.eb/append`` & ``use.own.eb/prepend``. Simply place both files in a directory of the existing ``$MODULEPATH`` and decide if you with to *append* or *prepend*: ::

  $ ml av use.own

  --------------------- /etc/site/modules ---------------------
     use.own.eb/append    use.own.eb/prepend (D)

  ------------------- /cm/local/modulefiles -------------------
     use.own

    Where:
     D:  Default Module

  Use "module spider" to find all possible modules and extensions.
  Use "module keyword key1 key2 ..." to search for all
  possible modules matching any of the "keys".

  $ ml use.own.eb/append
  $ echo $MODULEPATH
  /etc/site/modules:/cm/local/modulefiles:/home/user/.local/easybuild/modules/all


Example use.own.eb/append
-------------------------

::

  $ cat /etc/site/modules/use.own.eb/append
  #%Module1.0#####################################################################
  ##
  ## use.own.eb modulefile
  ##
  ## modulefiles/use.own.eb.  Generated by fgeorgatos
  ##
  proc ModulesHelp { } {

        puts stderr "\tThis module file will add \$HOME/.local/easybuild/modules/all to the"
        puts stderr "\tlist of directories that the module command will search"
        puts stderr "\tfor modules.  EasyBuild places your own modulefiles here."
        puts stderr "\tThis module, when loaded, will create this directory if necessary."
        puts stderr "\n\n"
  }

  module-whatis   "adds your EasyBuild modulefiles directory to MODULEPATH"

  eval set  [ array get env HOME ]
  set     ownmoddir       $HOME/.local/easybuild/modules/all

  # create directory if necessary
  if [ module-info mode load ] {
        if { ! [ file exists $ownmoddir ] } {
                file mkdir $ownmoddir
        }
  }

  module use --append $ownmoddir


Example use.own.eb/prepend
--------------------------

::

  $ cat /etc/site/modules/use.own.eb/prepend
  #%Module1.0#####################################################################
  ##
  ## use.own.eb modulefile
  ##
  ## modulefiles/use.own.eb.  Generated by fgeorgatos
  ##
  proc ModulesHelp { } {

        puts stderr "\tThis module file will add \$HOME/.local/easybuild/modules/all to the"
        puts stderr "\tlist of directories that the module command will search"
        puts stderr "\tfor modules.  EasyBuild places your own modulefiles here."
        puts stderr "\tThis module, when loaded, will create this directory if necessary."
  }

  module-whatis   "adds your EasyBuild modulefiles directory to MODULEPATH"

  eval set  [ array get env HOME ]
  set     ownmoddir       $HOME/.local/easybuild/modules/all

  # create directory if necessary
  if [ module-info mode load ] {
        if { ! [ file exists $ownmoddir ] } {
                file mkdir $ownmoddir
        }
  }

  module use --prepend $ownmoddir