Picking default version of a module based on compatibility with existing loaded modules
I'd like to have the behavior opposite of auto-swap when loading additional modules.
Creating a small example, with a shared Dependency and two software packages that use it:
mkdir modules
mkdir modules/Dependency
mkdir modules/SomeSoftware
mkdir modules/OtherSoftware
echo 'depends_on("Dependency/1.0")' > modules/SomeSoftware/1.2.lua
echo 'depends_on("Dependency/1.0")' > modules/OtherSoftware/2.3.lua
echo 'depends_on("Dependency/2.0")' > modules/OtherSoftware/3.4.lua
echo 'LmodMessage("Processing Dependency/1.0")' > modules/Dependency/1.0.lua
echo 'LmodMessage("Processing Dependency/2.0")' > modules/Dependency/2.0.lua
ml use modules
Here, we can see that SomeSoftware/1.2 is compatible with OtherSoftware/2.3 but not with OtherSoftware/3.4
Usage
module load SomeSoftware/1.2
module load OtherSoftware # I'm not picky about the version
Currently, not specifying the version means Lmod translates this to the default (typically latest) version and only tries that. Here it would translate to OtherSoftware/3.4 which will fail to load as it isn't compatible (which is correct).
I was thinking since Lmod ought to have full dependency graph here (at least when depends_on is used), could it not figure out which versions of OtherSoftware that is compatible, if any, and simply opt to load that instead when it could? Perhaps with a printed warning.
Otherwise, you'll be forced as a user to figure out that OtherSoftware/2.3 is the compatible one, without any hints or indications.
It would mean a change to the behavior, so, a configuration option?
Perhaps this is already possible and I'm not wise enough to figure it out?
I don't know how to implement this. I would welcome a pull request on this issue.
I am closing this issue. If you have more information about this idea, please let me know.