-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modules: use depends-on to autoload module with Lmod on Tcl #38347
modules: use depends-on to autoload module with Lmod on Tcl #38347
Conversation
@@ -26,9 +26,15 @@ proc ModulesHelp { } { | |||
{% endblock %} | |||
|
|||
{% block autoloads %} | |||
if {![info exists ::env(LMOD_VERSION_MAJOR)]} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second look, wouldn't this be creating an empty if/else statement if no autoload modules are present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I need to check if there is something to autoload prior adding this if/else statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reworked template to check if there are elements to autoload with {% if autoload|length > 0 %}
condition.
I have also updated tests to add assertion checking if if {![info exists ::env(LMOD_VERSION_MAJOR)]} {
condition is there or not.
Update Tcl modulefile template to use the `depends-on` command to autoload modules if Lmod is the current module tool. Autoloading modules with `module load` command in Tcl modulefile does not work well for Lmod at some extend. An attempt to unload then load designated module is performed each time such command is encountered. It may lead to a load storm that may not end correctly with large number of module dependencies. `depends-on` command should be used for Lmod instead of `module load`, as it checks if module is already loaded, and does not attempt to reload this module. Lua modulefile template already uses `depends_on` command to autoload dependencies. Thus it is already considered that to use Lmod with Spack, it must support `depends_on` command (version 7.6+). Environment Modules copes well with `module load` command to autoload dependencies (version 3.2+). `depends-on` command is supported starting version 5.1 (as an alias of `prereq-all` command) which was relased last year. This change introduces a test to determine if current module tool that evaluates modulefile is Lmod. If so, autoload dependencies are defined with `depends-on` command. Otherwise `module load` command is used. Test is based on `LMOD_VERSION_MAJOR` environment variable, which is set by Lmod starting version 5.1. Fixes spack#36764
f920569
to
1210bb2
Compare
Thanks! |
Update Tcl modulefile template to use the `depends-on` command to autoload modules if Lmod is the current module tool. Autoloading modules with `module load` command in Tcl modulefile does not work well for Lmod at some extend. An attempt to unload then load designated module is performed each time such command is encountered. It may lead to a load storm that may not end correctly with large number of module dependencies. `depends-on` command should be used for Lmod instead of `module load`, as it checks if module is already loaded, and does not attempt to reload this module. Lua modulefile template already uses `depends_on` command to autoload dependencies. Thus it is already considered that to use Lmod with Spack, it must support `depends_on` command (version 7.6+). Environment Modules copes well with `module load` command to autoload dependencies (version 3.2+). `depends-on` command is supported starting version 5.1 (as an alias of `prereq-all` command) which was relased last year. This change introduces a test to determine if current module tool that evaluates modulefile is Lmod. If so, autoload dependencies are defined with `depends-on` command. Otherwise `module load` command is used. Test is based on `LMOD_VERSION_MAJOR` environment variable, which is set by Lmod starting version 5.1. Fixes #36764
Update Tcl modulefile template to use the `depends-on` command to autoload modules if Lmod is the current module tool. Autoloading modules with `module load` command in Tcl modulefile does not work well for Lmod at some extend. An attempt to unload then load designated module is performed each time such command is encountered. It may lead to a load storm that may not end correctly with large number of module dependencies. `depends-on` command should be used for Lmod instead of `module load`, as it checks if module is already loaded, and does not attempt to reload this module. Lua modulefile template already uses `depends_on` command to autoload dependencies. Thus it is already considered that to use Lmod with Spack, it must support `depends_on` command (version 7.6+). Environment Modules copes well with `module load` command to autoload dependencies (version 3.2+). `depends-on` command is supported starting version 5.1 (as an alias of `prereq-all` command) which was relased last year. This change introduces a test to determine if current module tool that evaluates modulefile is Lmod. If so, autoload dependencies are defined with `depends-on` command. Otherwise `module load` command is used. Test is based on `LMOD_VERSION_MAJOR` environment variable, which is set by Lmod starting version 5.1. Fixes #36764
Update Tcl modulefile template to use the
depends-on
command to autoload modules if Lmod is the current module tool.Autoloading modules with
module load
command in Tcl modulefile does not work well for Lmod at some extend. An attempt to unload then load designated module is performed each time such command is encountered. It may lead to a load storm that may not end correctly with large number of module dependencies.depends-on
command should be used for Lmod instead ofmodule load
, as it checks if module is already loaded, and does not attempt to reload this module.Lua modulefile template already uses
depends_on
command to autoload dependencies. Thus it is already considered that to use Lmod with Spack, it must supportdepends_on
command (version 7.6+).Environment Modules copes well with
module load
command to autoload dependencies (version 3.2+).depends-on
command is supported starting version 5.1 (as an alias ofprereq-all
command) which was relased last year.This change introduces a test to determine if current module tool that evaluates modulefile is Lmod. If so, autoload dependencies are defined with
depends-on
command. Otherwisemodule load
command is used.Test is based on
LMOD_VERSION_MAJOR
environment variable, which is set by Lmod starting version 5.1.Fixes #36764