Difference between revisions of "Creating local module directory"
(→LMOD modules) |
(→LMOD modules) |
||
Line 53: | Line 53: | ||
===LMOD modules=== | ===LMOD modules=== | ||
+ | For each software that you would like to create a module for, create a directory in the <tt>modules</tt> directory. This directory then contains the file whose name is the version number followed by the ending <tt>.lua</tt>. In this example, we use PROGRAM as placeholder and 1.0 as version. The module file would therefore be stored in <tt>__TLD__/modules/PROGRAM</tt> and have the name <tt>1.0.lua</tt> | ||
+ | |||
<nowiki> | <nowiki> |
Revision as of 14:34, 28 June 2019
Contents
Introduction
You can use your own custom modules to setup your environment to run programs that you have installed yourself. This tutorial will guide you through creating a custom module directory, adding versioned modules for programs, and automatically having these modules available to you upon login. The tutorial will assume you will be managing a set of modules for a whole group, though it is equally applicable to managing a personal set of modules.
Please note that on Euler, we are using environment modules, whereas on Leonhard we are using LMOD modules. When extending the centrally provided modules, please make sure that you use the correct module type for your own modules.
Creating a custom module directory
You need to decide on the top-level directory (we will use the placeholder __TLD__ for the examples) in which to store the module files. You need to create the directory and set the user and group ownership:
Euler
[sfux@eu-login-01-ng ~]$ cd __TLD__ [sfux@eu-login-01-ng __TLD__]$ chown sfux:sfux-group modules
Here you would need to replace sfux and sfux-group with your account name and personal group (or any other IAM group that is suitable for this purpose).
Leonhard
[sfux@lo-login-01 ~]$ cd __TLD__ [sfux@lo-login-01-ng __TLD__]$ chown sfux:sfux-group modules
Here you would need to replace sfux and sfux-group with your account name and personal group (or any other IAM group that is suitable for this purpose).
Using the custom module directory
Now you need to let the module command know about your custom directory. Add the following line to your $HOME/.bash_profile file in case you are the only person using the additional modules. Or you can create a script that can be sourced in case multiple people use the additional modules.
For the Euler cluster:
module use __TLD__/leonhard/modules
For the Leonhard cluster:
export MODULEPATH=__TLD__/modules:$MODULEPATH
The module command will now see your custom modules the next time you log in. You can also type this command into your current shell to have immediate access.
Every group members will need to do this setup step to see the modules.
Example module files
Environment modules
For each software that you would like to create a module for, create a directory in the modules directory. This directory then contains the file whose name is the version number. In this example, we use PROGRAM as placeholder and 1.0 as version. The module file would therefore be stored in __TLD__/modules/PROGRAM and have the name 1.0
#%Module1.0 module-whatis "This is my software PROGRAM version 1.0" set helpmsg "PROGRAM is used used to achieve the following task ..." set topdir "__TLD__/apps/PROGRAM/1.0" setenv IMPORTANT_VARIABLE "Some string" prepend-path PATH $topdir/bin prepend-path LD_LIBRARY_PATH $topdir/lib64 prepend-path C_INCLUDE_PATH $topdir/include
LMOD modules
For each software that you would like to create a module for, create a directory in the modules directory. This directory then contains the file whose name is the version number followed by the ending .lua. In this example, we use PROGRAM as placeholder and 1.0 as version. The module file would therefore be stored in __TLD__/modules/PROGRAM and have the name 1.0.lua
-- -*- lua -*- -- -- Any sort of comment can be put here -- -- whatis([[Name : This is my software PROGRAM version 1.0]]) help([[PROGRAM is used to achieve the following task ...]]) setenv("IMPORTANT_VARIABLE", "Some string") prepend_path("PATH", "__TLD__/apps/PROGRAM/1.0/bin") prepend_path("LD_LIBRARY_PATH", "__TLD__/apps/PROGRAM/1.0/lib64") prepend_path("C_INCLUDE_PATH", "__TLD__/apps/PROGRAM/1.0/include")