Difference between revisions of "Creating local module directory"
(→Creating a custom module directory) |
|||
Line 1: | Line 1: | ||
== Introduction == | == 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 == | == 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 <tt>sfux</tt> and <tt>sfux-group</tt> with your account name and personal group (or any other IAM group that is suitable for this purpose). | |
− | |||
===Leonhard=== | ===Leonhard=== | ||
+ | |||
+ | [sfux@lo-login-01 ~]$ '''cd __TLD__''' | ||
+ | [sfux@lo-login-01-ng __TLD__]$ '''chown sfux:sfux-group modules''' | ||
+ | |||
+ | Here you would need to replace <tt>sfux</tt> and <tt>sfux-group</tt> with your account name and personal group (or any other IAM group that is suitable for this purpose). | ||
== Using the custom module directory == | == Using the custom module directory == | ||
− | Now you need to let the <tt>module</tt> command know about your custom directory. Add the following line to your <tt>$HOME/.bash_profile</tt> file. | + | Now you need to let the <tt>module</tt> command know about your custom directory. Add the following line to your <tt>$HOME/.bash_profile</tt> 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: | For the Euler cluster: | ||
− | module use | + | module use __TLD__/leonhard/modules |
For the Leonhard cluster: | For the Leonhard cluster: | ||
− | export MODULEPATH= | + | export MODULEPATH=__TLD__/modules:$MODULEPATH |
The <tt>module</tt> 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. | The <tt>module</tt> 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. | ||
Line 33: | Line 38: | ||
Every group members will need to do this setup step to see the modules. | Every group members will need to do this setup step to see the modules. | ||
− | == | + | ==Example module files== |
+ | |||
+ | ===Environment modules=== | ||
− | |||
− | |||
− | |||
− | |||
#%Module1.0 | #%Module1.0 | ||
− | module-whatis " | + | module-whatis "This is my software PROGRAM version 1.0" |
− | set helpmsg " | + | set helpmsg "PROGRAM is used used to achieve the following task ..." |
− | + | set topdir "__TLD__/apps/PROGRAM/1.0" | |
− | set topdir " | + | setenv IMPORTANT_VARIABLE "Some string" |
prepend-path PATH $topdir/bin | prepend-path PATH $topdir/bin | ||
+ | prepend-path LD_LIBRARY_PATH $topdir/lib64 | ||
+ | prepend-path C_INCLUDE_PATH $topdir/include | ||
+ | |||
+ | ===LMOD modules=== | ||
− | + | -- -*- 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") |
Revision as of 13:27, 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
#%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
-- -*- 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")