Closed nrcfieldsa closed 1 year ago
This is not supported by Lmod. The files .modulerc or .version only support the command things like:
set ModulesVersion 2.3.8
It does not support module commands.
As it turns-out we can maintain a separate tree for Ubuntu 20 Lua modules and simply not use Lmod for older TCL modulefiles tree used in early OS releases. Unless there is anyone that needs this feature, I guess this issue can be resolved.
Just out of curiosity would this be possible with the use of embedded TCL interpreter? As described here: https://easybuild.io/eum21/010_eum21_Lmod.pdf
Embedded TCL interpreter
- Lmod now embeds the TCL interpreter.
- Speeds up avail and load when there are many “.version” or “.modulerc” files.
- It is still faster to use “.modulerc.lua” files over TCL version files.
That is not the issue. All .modulerc and .version files are interpreted by the file src/RC2lua.tcl. That file has to make sense of the commands that there. What does setenv mean in the context of a .version file? What do any of the other commands mean (prepend-path, etc)? All the .modulerc and .version files do is set the default version and do alias stuff. setenv etc don't apply.
There are no clear rules that I know of. It doesn't mean that they can't be defined but they haven't been.
Priot to Lmod: The setenv line is in our site-standard "depot" module, which is sourced at the beginning of a TCL module file, to point to the correct package repository $depot
on the cluster depending on the OS and cluster cell. Thus, a flat app/release namespace in share/modules/modulefiles maps to multiple install prefix paths specific to each compiler, mpi release, OS and architecture, when not held in common.
It may not be intentional to have the .version
file define such an environment variable itself; rather it is being used in .version to switch to the appropriate release of multiple modulefiles for a program. It is also used in the modulefile itself to build the binary and library path prefix.
Our use case presently has been:
$MODULEPATH
;.version
file is located by Lmod, under the picard-tools/
and other module directories where multiple versions of the module file exist;depot/0.1
module is sourced in order to establish the prefix path to find particular installation;setenv
line in depot/0.1 is then setting an environment variable for consumption by further TCL modules and/or programs that might construct a path matching the current environment logged into..version
; but perhaps could be defined outside of .version and just referenced there and from the modulefiles used to load software as a regular env variable not handed by environment-modules.This mechanism is not compatible with the double-interpretation of statements in the TCL file to Lua.. As the variable being set either as regular var, or env var may now be out of scope of the calling module which sources it and when set / setenv commands are not interpreted in RC2lua.tcl.
An approach is to move more toward Lmod hierarchical modules, or have fixed directory structure with OS_REL and ARCH as done with either EB/spack, while .profile
is used to select which $MODULEPATH. Thus, if you have Ubuntu20.04 for AMD Epyc (zen2) and Intel Xeon (cascadelake) nodes one with gcc and one with intel, it would be in separate module path for each and there is no logic used in the modulefiles themselves to switch between program paths. Instead you'd have multiple of the same module files in each respective path.
This issue can be resolved as 'not a bug'. The TCL statements listed are not supported in current Lmod version. Lmod hierarchical modules fill the need I have for this task.
A work-around for any similar issue is to move the logic out of the .version and/or module file, such as into the environment of the shell.
In the future if some-one else needs more in-depth TCL module file compatibility, they could open a feature request.
Describe the bug Lmod in our installation recently has an issue loading certain TCL module files that contain a
setenv
command and makes use of a TCLmodule_name/.version
file.To Reproduce
The contents of the TCL modulefile that causes the issues is as follows:
There is a chance that the module files can be re-written or start using spack generated module files. However, that doesn't address the potential issue with .version file using TCL commands.
Issue can be reproduced when using bug_report_template.sh with contents:
The problematic modules have been placed in:
Error output from bug_report:
Expected behavior Most TCL modules appear to work OK with Lmod. It is expected that the
module avail
command would not fail when examining TCL module files with asetenv
orswitch
line in them.Setenv is said to be supported by Lmod and also appears as a supported command in environment-module documentation.
The environment modules documentation at: https://modules.readthedocs.io/en/latest/modulefile.html shows that the setenv command is valid modulefile syntax.
Desktop (please complete the following information):
Additional context The setenv command is in a module file that is shown working well in the past with environment-modules: Modules Release 4.1.1 (2018-02-17).