@@ -255,6 +255,87 @@ when trying to reload Dependent Reload modules that conflict with other loaded
255255modules. This error may be by-passed with :option: `--force ` command-line
256256option.
257257
258+ Specific modulepath for requirements
259+ ------------------------------------
260+
261+ A ``--modulepath `` option is introduced on the :mfcmd: `always-load `,
262+ :mfcmd: `depends-on `, :mfcmd: `prereq `, :mfcmd: `prereq-all ` and
263+ :mfcmd: `prereq-any ` modulefile commands. This option indicates that
264+ requirement should be specifically searched in the provided list of
265+ modulepaths. Such mechanism helps to ensure loaded requirements are those
266+ expected and they are not coming from an unexpected module tree.
267+
268+ In the following example, ``foo `` module requires ``bar ``. It expects the
269+ ``bar `` module from the same modulepath than ``foo ``. User's environment has
270+ enabled another modulepath that also provides a ``bar `` module. Use of
271+ ``--modulepath `` option guides the requirement load mechanism to the expected
272+ module.
273+
274+ .. parsed-literal ::
275+
276+ :ps: `$ ` module avail
277+ --------------------- :sgrdi: `/path/to/othermfiles ` ---------------------
278+ bar/1
279+
280+ --------------------- :sgrdi: `/path/to/modulefiles ` ---------------------
281+ bar/1 foo/1 foo/2
282+ :ps: `$ ` module show foo/1
283+ -------------------------------------------------------------------
284+ :sgrhi: `/path/to/modulefiles/foo/1 `:
285+
286+ :sgrcm: `prereq ` --modulepath .. bar/1
287+ -------------------------------------------------------------------
288+ :ps: `$ ` module load foo/1
289+ Loading :sgrhi: `foo/1 `
290+ :sgrin: `Loading requirement `: bar/1
291+ :ps: `$ ` echo $_LMFILES_
292+ /path/to/modulefiles/bar/1:/path/to/modulefiles/foo/1
293+
294+ Specific modulepath set may guide to a directory not necessarily enabled
295+ (i.e., not defined in :envvar: `MODULEPATH ` environment variable):
296+
297+ .. parsed-literal ::
298+
299+ :ps: `$ ` module show foo/2
300+ -------------------------------------------------------------------
301+ :sgrhi: `/path/to/modulefiles/foo/2 `:
302+
303+ :sgrcm: `prereq ` --modulepath /path/to/alternatefiles bar/2
304+ -------------------------------------------------------------------
305+ :ps: `$ ` module load foo/2
306+ Loading :sgrhi: `foo/2 `
307+ :sgrin: `Loading requirement `: bar/2
308+ :ps: `$ ` module list
309+ Currently Loaded Modulefiles:
310+ 1) bar/2 2) foo/2
311+ :ps: `$ ` echo $_LMFILES_
312+ /path/to/alternatefiles/bar/2:/path/to/modulefiles/foo/2
313+
314+ If a required module is already loaded from a modulepath that does not
315+ correspond to the requirement definition, an error is obtained. However if
316+ the *Conflict Unload * mechanism described above is enabled, the conflicting
317+ module will automatically be unloaded.
318+
319+ .. parsed-literal ::
320+
321+ :ps: `$ ` module purge
322+ :ps: `$ ` module load bar/1
323+ :ps: `$ ` echo $_LMFILES_
324+ /path/to/othermfiles/mp2/bar/1
325+ :ps: `$ ` module load foo/1
326+ Loading :sgrhi: `bar/1 `
327+ :sgrer: `ERROR `: Module already loaded from a different modulepath
328+
329+ Loading :sgrhi: `foo/1 `
330+ :sgrer: `ERROR `: Load of requirement bar/1 (specific path) failed
331+ :ps: `$ ` module config conflict_unload 1
332+ :ps: `$ ` module load foo/1
333+ Loading :sgrhi: `foo/1 `
334+ :sgrin: `Unloading conflict `: bar/1
335+ :sgrin: `Loading requirement `: bar/1
336+ :ps: `$ ` echo $_LMFILES_
337+ /path/to/modulefiles/bar/1:/path/to/modulefiles/foo/1
338+
258339
259340 v5.4
260341====
0 commit comments