Closed wpoely86 closed 8 years ago
ml -D -D
output of both loading only vsc-base/2.1.2
and loading CP2K/2.6.0-intel-2015a vsc-base/2.1.2
can be found at:
https://gist.github.com/wpoely86/f362f99cc233a0ab3571cd0e38db8455
wow, that's weird... and worrying
Ignore, this is our internal mess.
Well, hold on, I think it's worth clarifying what's going on here...
Our definition of ml
and module
does this, in an attempt to avoid breaking lua
because of changes to $LD_LIBRARY_PATH
:
eval $(LD_LIBRARY_PATH="" $LMOD_CMD bash "$@");
However, that causes Lmod to see the wrong value of $LD_LIBRARY_PATH
, breaking updates to that variable.
@rtmclay: thoughts?
@rtmclay can Lmod restore the LD_LIBRARY_PATH
on every load based on it's internal state? Or can we pass the correct value as an option to $LMOD_CMD
?
My recommendation is to have Lmod a new hook. One that gets called at the start Lmod execution. Then a site like your can do what you want.
I don't have time to work on it now but I would take a pull request.
@rtmclay Do you mean like a 'startup hook', i.e. one that will be triggered every time Lmod runs (as opposed to other hooks that only get triggered on particular subcommands)?
Any pointers on how that could be implemented, which files/functions to look at, anything that comes close (load hook, something better)?
I'm happy to have a look at it.
But just out of curiosity: can the library path be reconstructed from the 'saved' internal state?
Well, you could do something like:
module () { eval $( MY_LD_LIB_PATH=$LD_LIBRARY_PATH LD_LIBRARY_PATH="" $LMOD_CMD bash "$@");}
Then inside the startup_hook (to use Kenneth's idea for a name) set
LD_LIBRARY_PATH=$MY_LD_LIB_PATH
I'd look at the load hook or any other and call it just after the SitePackage is loaded in lmod.in.lua. That is what the lmod script is called in the source directory.
Actually, isn't the load hook good enough?
Only there is the value for $LD_LIBRARY_PATH
relevant w.r.t. changing it, right?
Well, also unload
& purge
(same thing?), I guess.
It's much cleaner to do it as early on as possible.
The load hook may be sufficient. It is certainly an easy thing to test. But I agree with @wpoely86 that it is much cleaner to do it early.
Using 6.1.7:
Am I missing something here? The contents of the
vsc-base/2.1.2
module is