Hi Xavier,
Thank you for your quick response.
Indeed, it works. I thought I had already tried that, but my case was slightly different, unfortunately.
What about an "asked variant"? Perhaps an equivalent of "is-loading"?
If goat/2.0 is a prerequisite for ziege/1.0, the "is-loaded" approach cannot work.
Example:
File: /usr/share/modulefiles/ziege/1.0
#%Module
set name "ziege"
set version "1.0"
variant compiler
prereq goat/2.0
File: /usr/share/modulefiles/goat/2.0
#%Module
set name "goat"
set version "2.0"
if { [is-loaded ziege compiler=gcc] } {
// does not work
}
The only solution I've found is to propagate variants across my modules.
Updated Example:
File: /usr/share/modulefiles/ziege/1.0
#%Module
set name "ziege"
set version "1.0"
variant compiler
prereq goat/2.0 compiler=[getvariant compiler]
File: /usr/share/modulefiles/goat/2.0
#%Module
set name "goat"
set version "2.0"
variant compiler
if { [getvariant compiler] == gcc } {
// code
}
Let me know if you see any better way to handle this.
Best regards,
Adrien
________________________________
De : Xavier Delaruelle <xav...@gm...>
Envoyé : mardi 24 décembre 2024 09:52
À : Environment Modules usage and discussion. <mod...@li...>
Objet : Re: [Modules] Get variant of another module
Hi Adrien,
As far as I remind, there is no function that currently gives you the
variants of a loaded module from another module, but you may try using
the "is-loaded" command:
if {[is-loaded ziege compiler=gcc]} {
// code
} elseif {[is-loaded ziege compiler=llvm]}
..
}
Best,
Xavier
Le mar. 24 déc. 2024 à 09:44, Adrien COTTE <adr...@as...> a écrit :
>
> Hi,
>
> Is it possible to get the variant of another module?
>
> A dummy example.
>
> $ module load ziege/1.0 compiler=gcc
> $ module load goat/2.0
>
> In the goat/2.0 modulefile, I would like to check the ziege/1.0 compiler variant.
>
> Best,
> Adrien Cotte
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
_______________________________________________
Modules-interest mailing list
Mod...@li...
https://lists.sourceforge.net/lists/listinfo/modules-interest
|