Redimp's Blog

environment module files

Environment module files are a nice way to provide multile versions of different packages for users. In our network, we provide a nfs mounted /opt-Partition which contains every software which isn't supported (either in no way, or in different versions) by our distribution.

We put all packages in /opt/packkages/$packagename-$version/. When compiling packages, we use --prefix=/opt/packkages/$packagename-$version/, which makes it easy to use for example a library like openmpi.

To install environment modules from the scratch, download the tar.gz from

The following at least worked for VERSION=3.2.10.

# Unpack tar xvf modules-$VERSION.tar.gz
# Change directory
cd modules-$VERSION
# Configure (I'm using a network shared /opt partition)
./configure --prefix=/opt/packages/modules/
# Build and install
make && make install
# create default link (i have no idea, why this 
# isn't done by "default"
cd /opt/packages/modules/Modules/
ln -s $VERSION default
# return to the source directory
cd -
# copy profile script to a profile.d directory 
# (in my case again on /opt)
cp etc/global/profile.modules /opt/etc/profile.d/
# edit module configuration
vim /opt/packages/modules/Modules/$VERSION/init/.modulespath
# i just commented out all lines and add /opt/modules where
# i put my module files

The next step is, to create the module files. I suggest to keep them as clean and small as possible. Using Variables makes them easy to copy n paste (for example, if you update a library to a new version and want to keep the old version too).

Beware, there are many strange module files to find in the web. I suggest to write them by yourself and use only commands you know and environment variables from which you know what they are doing.

First example cmake, which i build using:

# Download
# Extract
tar xzf cmake-
# create build directory
mkdir -p cmake-; cd cmake-
# configure
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/packages/cmake-
# make and install 
make -j4 && make install

whichs results in a driectory which looks like this

ls /opt/packages/cmake-
bin  doc  man  share

So i create a module file /opt/modules/cmake/ which makes cmake easy useable:

# CMake Module file
set package "cmake"
set version ""
set dir "/opt/packages/$package-$version"
# Defines String that is displayed when command "module whatis" is invoked
module-whatis "$package/$version - sets the environment variables to use $package in $dir"
if { ! [ file exists $dir ] } {
	puts stderr "$package-$version is not available on this machine. directory $dir not found"
	exit 1
# Set Conflicts: Defines modulefiles that can not be loaded at the same time
conflict $package
prepend-path PATH	$dir/bin
prepend-path MANPATH	$dir/man

What a module does, can be tested by using module show:

module show cmake/ 
module-whatis	 cmake/ - sets the environment variables to use cmake in /opt/packages/cmake- 
conflict	 cmake 
prepend-path	 PATH /opt/packages/cmake- 
prepend-path	 MANPATH /opt/packages/cmake- 

next, load the module, and check if we got the right cmake version:

# load module
$ module load cmake/ 
# check which binary is used
$ which cmake
# check version
$ cmake --version
cmake version

I hope this little howto will help somebody (at least me, if i have to install module files again somewhere else). Commends welcome.

Hint: Useful documentation i've used:

Tagged as: 22 Comments

Vortrag: Subversion

Im Institut wird dieses Semester ein Mini-Seminar veranstaltet, dass den Titel "Technische Numerik" traegt. Hier werde alle moeglichen technischen Mittel erlaeutert, die man in der Numerik braucht und die (meistens) wenig mit Mathe zu tun haben. Unter den Vortragsthemen sind der gdb, valgrind, mpi und noch ein Haufen anderer, spannender Kram.

Ich habe im Rahmen dieses Seminars einen Vortrag mit dem Thema "Versionskontrolle mit Subversion" gehalten. Meine Folien dazu gibt es hier: Versionskontrolle mit SVN.

Da ich das wiederholt gefragt worden bin... Die "Terminals" habe ich mit dem \LaTeX Paket lstlisting gemacht.

% Paket einbinden

% Sprache definieren

% Listings konfigurieren

% Die Umgebung svn erstellen

Das laesst sich im Paket latex-beamer dann wie folgt benutzen:

\begin{frame}[fragile]{Test der svn-Umgebung}
> svn update
At revision 1.

und sieht dann so aus:

Tagged as: , , 1 Comment