Redimp's Blog
15Apr/1422

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 http://sourceforge.net/projects/modules/.

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/profile.modules.sh
# 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
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
# Extract
tar xzf cmake-2.8.12.2.tar.gz
# create build directory
mkdir -p cmake-2.8.12.2/build; cd cmake-2.8.12.2/build
# configure
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/packages/cmake-2.8.12.2
# make and install 
make -j4 && make install

whichs results in a driectory which looks like this

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

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

#%Module1.0
#####################
# CMake Module file
 
set package "cmake"
set version "2.8.12.2"
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/2.8.12.2 
-------------------------------------------------------------------
/opt/modules/cmake/2.8.12.2:
 
module-whatis	 cmake/2.8.12.2 - sets the environment variables to use cmake in /opt/packages/cmake-2.8.12.2 
conflict	 cmake 
prepend-path	 PATH /opt/packages/cmake-2.8.12.2/bin 
prepend-path	 MANPATH /opt/packages/cmake-2.8.12.2/man 
-------------------------------------------------------------------

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

# load module
$ module load cmake/2.8.12.2 
# check which binary is used
$ which cmake
/opt/packages/cmake-2.8.12.2/bin/cmake
# check version
$ cmake --version
cmake version 2.8.12.2

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:

Comments (22) Trackbacks (0)
  1. I like the helpful info you provide on your articles. I'll
    bookmark your blog and check again here frequently.
    I'm somewhat certain I'll be informed a lot of new stuff right here!
    Best of luck for the next!

  2. You can definitely see your enthusiasm in the work you write.
    The arena hopes for even more passionate writers such as
    you who are not afraid to mention how they believe. Always go after your
    heart.

  3. This is essential as a result of as your pores and skin ages
    , it losrs its ability to supply collagin and elastin.

  4. The outsourced employees is updated with newest payroll strateggies and software, legal guidelines, rues and regulation of tax
    deposits, tax slabs and interest rate.

  5. Search for baskets which could be artistic and wilkl defintely go effectivey with
    the sweet candy theme of your present.

  6. A enterprise card is exclpusive means oof exchanging contact dawta annd
    is often used during sales calls and offer contact
    information to a possible customer.

  7. It's an remarkable paragraph designed for all the online users;
    they will get benefit from it I am sure.

  8. So, he referred to as Trina up while she was aat work.

  9. This results in the third step in the process, whoch
    is the metalwork.

  10. In contrast to the simplicity of a hand sewing needle the machine needle has
    more 'components' too it. The sewing machine needles opedate is tto hold the highest thread by the fabric doqn into tthe underparts of the machine the place the highest thread loops over the bottom/bobbin thread after which bring the top thread up to
    the top once more which forms a stitch.-14-16; commonplasce point
    sizes A starting knitter may be more comfortable with bamboo or wooden needles that are smooth but not as slippery as different substances, thereby making it simpler to maintain the yarn on thhe needles.

  11. I do believe all of the ideas you have introduced on your
    post. They are really convincing and can certainly work.
    Still, the posts are too quick for starters. May you please prolong them a bit from next time?

    Thank you for the post.

  12. As a result of the truth that drivers and passengers
    are protected byy the sterl frame of a truck around them, travel trailers are
    ranked greater in crash safety.

  13. Hi, I think your blog might be having browser compatibility issues.
    When I look at your blog in Chrome, it looks fine but when opening in Internet Explorer, it
    has some overlapping. I just wanted to give you a quick heads up!

    Other then that, excellent blog!cheap nfl jerseys

  14. Only 3 easy steps will be experiencing iNetBet out of
    your mobile system.

  15. Wheen my wommen have been little and we did not have a buysy schedule, we might wander in Huskies deli,
    ordr an icee cream cone and siit exterior and luxuriate in it.
    It was enjoyable, andd I can see them attempting to manage
    the cones and the ice cream in their little arms.

  16. It's not clear iff the current Supreme Court will
    decide in the same method.

  17. As an owner of big industrial complex, you will need tto have noticed how difficult it's to maintain a clear and hygienic environment in your constructing.

  18. You can discover probably massive companies obtainable to documeent insurance coverage coverage masking medical caznnabis retailers.

    As soon as California made medical marijuana legalized in 1996, dispensaries began to make an look.
    Currently, there are actually round 2,000 inside state of California solely.

  19. Definitely consider that that you said. Your favourite reason appeared to be at the web the easiest
    thing to consider of. I say to you, I certainly get irked whilst other
    people think about worries that they just do not realize about.
    You controlled to hit the nail upon the top and outlined out the whole thing without having side-effects ,
    folks could take a signal. Will likely be back to get more.
    Thank you

  20. Ⅰf your lawyer uses terms you do not comprehend, end them ɑnd reԛuest for an explanation.

  21. I like his website very much, Its a rattling nice situation to read and incur info.

  22. Hmm it appears like your website ate my first comment (it
    was extremely long) so I guess I'll just sum it
    up what I had written and say, I'm thoroughly enjoying
    your blog. I as well am an aspiring blog blogger
    but I'm still new to everything. Do you have any helpful hints for newbie blog writers?
    I'd genuinely appreciate it.cheap nfl jerseys


Leave a comment

No trackbacks yet.