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:

  1. user modulefiles generated via EasyBuild are easy to enable - less typing, too

  2. $MODULEPATH is managed via modulefiles in itself

  3. technique is compatible with $LMOD_SYSTEM_DEFAULT_MODULES feature

  4. ml save/restore work as desired

Caveats:

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