On 11/23/2018 10:53 AM, Markus Geimer wrote:> You don't even need an Lmod hook. Just put something like

        hide-version foo/42.0

in a global rc file evaluated by Lmod (I believe it has to be TCL).
This can easily be done after the fact.  I'm using this for quite a
while now and it works like a charm.  See also

https://lmod.readthedocs.io/en/latest/040_FAQ.html?highlight=hide-version

Thanks for suggesting the use of Lmod "hide-version" for hiding unwanted/obsolete/system modules from the "module avail" command! There are also some useful hints in https://github.com/TACC/Lmod/blob/master/Transition_to_Lmod7.txt.

IMHO, this is the best available solution in stead of rebuilding your entire module tree from scratch (which may still be what we want to do in the long term).

I've written the attached script for conveniently generating a ~/.modulerc file from a list of module name patterns which you want to hide. On a CentOS 7 system with the Lmod RPM from EPEL, you can copy the .modulerc file to the Lmod system default file /usr/share/lmod/etc/rc.

For the record, I've also documented this procedure and the script in my EasyBuild Wiki page at https://wiki.fysik.dtu.dk/niflheim/EasyBuild_modules#hiding-modules-with-lmod

/Ole
#!/bin/sh

# Create ~/.modulerc file with module hide-version information
# The hidden modules will not be shown by "module avail".
# List system-wide modulerc file by:
# $ module --config 2>&1 | grep MODULERCFILE
# MODULERCFILE /usr/share/lmod/etc/rc
MODULERC=~/.modulerc

# List available modules
TEMP=/tmp/modulerc.$$
rm -f $TEMP
module --terse --show-hidden avail > $TEMP 2>&1

# Generate a hide list

cat <<EOF > $MODULERC
#%Module
# Documentation of hide-version:
# https://lmod.readthedocs.io/en/latest/040_FAQ.html?highlight=hide-version
# and https://github.com/TACC/Lmod/blob/master/Transition_to_Lmod7.txt
global env
if { [info exists env(LMOD_VERSION_MAJOR)]} {
EOF

# Define patterns for which modules to hide

cat <<EOF | grep -f - $TEMP | awk '{print "\thide-version " $1}' | sort | uniq 
>> $MODULERC
GCCcore-5.4.0
GCCcore-6.1.0
GCCcore/5.4.0
GCCcore/6.1.0
GCC-5.4.0-2.26
GCC-6.3.0-2.27
foss/2016a
foss-2016a
foss/2016b
foss-2016b
Autoconf
Automake
Autotools
Bison
CMake
LibTIFF
LibUUID
M4
Szip
Tcl/
Tk/
Tkinter
XML-Parser
XZ
bzip2
binutils
cURL
expat
flex
fontconfig
freetype
gettext
gompi-2016b
gompi/2016b
gperf
help2man
hwloc
libevent
libffi
libjpeg-turbo
libpng
libreadline
LibTIFF
libtool
LibUUID
libxml2
ncurses
numactl
pkg-config
tmux
util-linux
zlib
EOF

# Terminating bracket
echo "}" >> $MODULERC

echo File $MODULERC has been created

rm -f $TEMP

Reply via email to