cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
698 stars 109 forks source link

Show available variants for modules with `module avail <modname>` #407

Closed zerothi closed 1 year ago

zerothi commented 3 years ago

Is your feature request related to a problem? Please describe.

Currently one cannot easily see the available variants for modules, doing module avail will only list the modules but not the available variants for the module.

$> module avail mpi/4.0.3
...
mpi/4.0.3
...

$> module show mpi/4.0.3
...
variant         --default gcc/9.3.0 compiler gcc/8.4.0 gcc/9.3.0 gcc/10.1.0 intel/2019u5 intel/2020u1
variant         --default i4 isize i4 i8
...

however, users that are not familiar with env-modules don't figure this out.

Describe the solution you'd like

I think there should be two scenarios covered:

  1. module avail --variants which would forcefully show all variants for all modules (very verbose but some users might find it useful).
    In this case it might be better to force all listed modules in a list-like format

    mpi/4.0.3
    compiler = [ 1, 2, 3, <line-break>
                       4, 5 ]

    Just doing module avail should not do this!

  2. When asking for specific modules module avail mpi it should default to show the variants. Since there may be many variants formatting might be problematic, but...

xdelaruelle commented 1 year ago

Adding the variant value to the -o/--output option, will render all variant values of modulefiles along their name/version.

$ module av vrreq1
---------------- /path/to/testsuite/modulefiles.3 ----------------
vrreq1/1.0  vrreq1/2.0  'vrreq1/w s'  

Key:
modulepath
$ module av -o +variant vrreq1
---------------- /path/to/testsuite/modulefiles.3 ----------------
vrreq1/1.0{foo=val1,val2,val3}  vrreq1/2.0{foo=val1,val2,val3}  'vrreq1/w s'  

Key:
modulepath  {variant=value}