Commit e97dc85 Robert McLay
committed
1 parent b929b44 commit e97dc85 Copy full SHA for e97dc85
File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ unset during unloading.
82
82
**try_load ** ("pkgA", "pkgB", "pkgC"):
83
83
load all modules. No errors reported if unable to load.
84
84
85
+ **mgrload ** (required, active_object):
86
+ load a single module file. If required is true then error out if
87
+ not found. If false then no message is generated. Returns true
88
+ if successful. See :ref: `site_package_mgrload ` for details.
89
+
90
+
85
91
**always_load ** ("pkgA", "pkgB", "pkgC"):
86
92
load all modules. However when this command is reversed it does nothing.
87
93
Original file line number Diff line number Diff line change @@ -87,4 +87,34 @@ into any new version of Lmod.
87
87
88
88
There is no need to modify tcl2lua.tcl if you only add hook functions.
89
89
90
-
90
+ .. _site_package_mgrload :
91
+
92
+ Using **mgrload ** function
93
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
94
+
95
+ Suppose your site has an archecture state which controls the how the
96
+ modules work. So you would like to unload all the current modules and
97
+ then set an environment variable and reload. Here you want to use the
98
+ **mgrload ** function and not the **load ** function. If you use the
99
+ load function you loose the **depends_on ** () state and whether a
100
+ module was loaded by a user or was loaded by another module. The way
101
+ this works is that you ask for the currently loaded modules with the
102
+ **loaded_modules ** function to get an array of "active" objects. So
103
+ the following is the "AVX" architecture module::
104
+
105
+ if (mode() == "load") then
106
+ local required = false
107
+ local activeA = loaded_modules()
108
+
109
+ for i = 1,#activeA do
110
+ io.stderr:write("Unloading: ",activeA[i].userName,"\n")
111
+ unload(activeA[i].userName)
112
+ end
113
+ setenv("SITE_CURRENT_ARCH","avx")
114
+ for i = 1,#activeA do
115
+ io.stderr:write("loading: ",activeA[i].userName,"\n")
116
+ mgrload(required, activeA[i])
117
+ end
118
+ end
119
+
120
+
You can’t perform that action at this time.
0 commit comments