Blog IndexPosts by TagHome

Fun with Environment Modules

Posted <2017-03-22 Wed 20:07> by Aaron S. Jackson.

I have been setting up a new deep learning machine recently for CVL. One of the biggest annoyances with existing machines we have has been managing multiple versions of the same software. Libraries such as OpenCV come to mind. The HPC service offered by Uni of Nottingham makes use of the modules command. It seemed sensible to me and I investigated further. Turns out, it's a very old project and manages adding and removing bits to environment variables to switch between different versions of software. Great! That's what I've been needing.

I like it quite a bit. The eventual goal will be to mount /software over NFS from our file server. All the machines can then share the exact same software repository, making it much easier to configure and update the hosts. I have tested this a little by exporting the folder temporarily, and for CUDA and Torch it worked fine. MATLAB has some licensing issues, but I should just be able to store all the licenses in one place. I think you specify the license to use with the -c flag, which I can generate by the system hostname.

Here are some of the modulefiles I have setup for CUDA, MATLAB and Torch7.

#%Module1.0
## notavail modulefile
##
proc ModulesHelp {} {

}

module-whatis "loads MATLAB 2017a"

set root /software/MATLAB/R2017a/

append-path PATH $root/bin
append-path PATH $root/bin/glnxa64
append-path LD_LIBRARY_PATH $root/bin/glnxa64
append-path LD_LIBRARY_PATH $root/runtime/glnxa64
#%Module1.0
## notavail modulefile
##
proc ModulesHelp {} {

}

module-whatis "loads NVIDIA CUDA 8.0"

setenv CUDA_HOME /software/cuda/8.0
setenv CUDA_PATH /software/cuda/8.0
prepend-path PATH /software/cuda/8.0/bin
prepend-path LD_LIBRARY_PATH /software/cuda/8.0/lib64
#%Module1.0
## notavail modulefile
##
proc ModulesHelp {} {

}

eval set [ array get env HOME ]

module-whatis "loads Torch 7"

if { ![is-loaded cuda80] } {
   module load cuda80
}
if { ![is-loaded cudnn51] } {
   module load cudnn51
}

setenv LUA_PATH "$HOME/.luarocks/share/lua/5.1/?.lua;$HOME/.luarocks/share/lua/5.1/?/init.lua;/software/torch/install/share/lua/5.1/?.lua;/software/torch/install/share/lua/5.1/?/init.lua;./?.lua;/software/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;"


setenv LUA_CPATH "$HOME/.luarocks/lib/lua/5.1/?.so;/software/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/software/torch/install/lib/?.so;"

append-path PATH /software/torch/install/bin

append-path LD_LIBRARY_PATH /software/torch/install/lib

append-path DYLD_LIBRARY_PATH /software/torch/install/lib

As you can see, I am not very interested in defining the ModulesHelp function.

Wanting to leave a comment?

Comments and feedback are welcome by email (aaron@nospam-aaronsplace.co.uk).

Related posts:

Tags: linux

Blog IndexPosts by TagHome

Copyright 2007-2022 Aaron S. Jackson (compiled: Sun 2 Jan 00:24:10 GMT 2022)