HenrikBengtsson / CBI-software

A Scientific Software Stack for HPC (CentOS oriented)
https://wynton.ucsf.edu/hpc/software/software-repositories.html
5 stars 2 forks source link

Question regarding scl-devtoolset conversion to module #33

Closed hgputnam closed 2 years ago

hgputnam commented 2 years ago

@HenrikBengtsson I am trying to go through your procedure exactly using devtoolset-9 as the example. I get WAY different output than you did with the script converter:

[hputnam@c4-dev3 9]$ "${LMOD_DIR}/sh_to_modulefile" /opt/rh/devtoolset-9/enable
setenv("INFOPATH","/opt/rh/devtoolset-9/root/usr/share/info")
setenv("LD_LIBRARY_PATH","/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib")
prepend_path("MANPATH","/opt/rh/devtoolset-9/root/usr/share/man")
prepend_path("PATH","/opt/rh/devtoolset-9/root/usr/bin")
setenv("PCP_DIR","/opt/rh/devtoolset-9/root")
setenv("PKG_CONFIG_PATH","/opt/rh/devtoolset-9/root/usr/lib64/pkgconfig")

I get about half as many lines as https://github.com/HenrikBengtsson/CBI-software/tree/master/CBI/scl-devtoolset#readme

HenrikBengtsson commented 2 years ago

You're right, my mistake: The example I show in the README includes LD_LIBRARY_PATH elements that I had set up when I created the example. That has now been fixed, cf. https://github.com/HenrikBengtsson/CBI-software/commit/dfa169ddc52a9d3c5f67d2138248414993c32f72

HenrikBengtsson commented 2 years ago

Hold on: I need to troubleshoot more; there's something more going on here. We definitely do not want to end up with setenv() which would overwrite any other modules settings; instead we want it to end up producing prepend_path().

hgputnam commented 2 years ago

Ok - I was researching this here: https://www.softwarecollections.org/en/docs/guide/#sect-Converting_Software_Collection_Scriptlets_into_Environment_Modules There is another command that is supposed to create a functional modulefile:

$ /usr/share/Modules/bin/createmodule.sh /opt/rh/rh-python36/enable
#%Module 1.0
prepend-path    LD_LIBRARY_PATH /opt/rh/rh-python36/root/usr/lib64
prepend-path    MANPATH /opt/rh/rh-python36/root/usr/share/man
prepend-path    PATH    /opt/rh/rh-python36/root/usr/bin
prepend-path    PKG_CONFIG_PATH /opt/rh/rh-python36/root/usr/lib64/pkgconfig
prepend-path    XDG_DATA_DIRS   /opt/rh/rh-python36/root/usr/share:/usr/local/share:/usr/share

Is that any better?

hgputnam commented 2 years ago

For the devtoolset example:

$ /usr/share/Modules/bin/createmodule.sh /opt/rh/devtoolset-9/enable
#%Module 1.0
prepend-path    INFOPATH    /opt/rh/devtoolset-9/root/usr/share/info
prepend-path    LD_LIBRARY_PATH /opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib
prepend-path    MANPATH /opt/rh/devtoolset-9/root/usr/share/man
prepend-path    PATH    /opt/rh/devtoolset-9/root/usr/bin
prepend-path    PKG_CONFIG_PATH /opt/rh/devtoolset-9/root/usr/lib64/pkgconfig
setenv      PCP_DIR /opt/rh/devtoolset-9/root
HenrikBengtsson commented 2 years ago

That produced Tmod syntax (Tcl) instead of Lmod (Lua). The Lmod system understands Tmod, but then the whole module has to be written as Tmod, which is more limited.

We're on:

$ module --version

Modules based on Lua: Version 8.2.7  2019-11-30 09:41 -06:00
    by Robert McLay mclay@tacc.utexas.edu

Maybe ${LMOD_DIR}/sh_to_modulefile has been improved since.

hgputnam commented 2 years ago

So, the ones in /etc/modulefiles are Tmod? They look similar...

hgputnam commented 2 years ago

Just did a quick test on dev3. The Tmod file for the python scl works fine if I just put that modulefile under /etc/modulefiles. Working on the LUA files now...

HenrikBengtsson commented 2 years ago

I've dug into it a bit more and here's a "workaround" to force prepend_path() for specific env vars:

$ (module purge; INFOPATH=DUMMY LD_LIBRARY_PATH=DUMMY PKG_CONFIG_PATH=DUMMY "${LMOD_DIR}/sh_to_modulefile" /opt/rh/devtoolset-9/enable | grep -vF DUMMY)

I've updated https://github.com/HenrikBengtsson/CBI-software/tree/master/CBI/scl-devtoolset#readme accordingly.

hgputnam commented 2 years ago

lol - earlier I just replaced the setenv with prepend_path and got the exact same thing for the python module. Obviously wouldn't work all of the time...