Difference between revisions of "Creating local module directory"
(Custom modules directory.) |
(Formatting and output) |
||
Line 8: | Line 8: | ||
You need to decide on the top-level directory in which to store the module files. Let us assume it is <tt>/cluster/project/leonhard/modules</tt>, where <tt>hpc</tt> should be replaced with your group's storage location. This can also be an arbitrary directory to which you have access, e.g., <tt>$HOME/modules</tt>. First create the directory and set proper permissions: | You need to decide on the top-level directory in which to store the module files. Let us assume it is <tt>/cluster/project/leonhard/modules</tt>, where <tt>hpc</tt> should be replaced with your group's storage location. This can also be an arbitrary directory to which you have access, e.g., <tt>$HOME/modules</tt>. First create the directory and set proper permissions: | ||
− | mkdir /cluster/project/leonhard/modules | + | [leonhard@euler00 ~]$ '''mkdir /cluster/project/leonhard/modules''' |
− | chown leonhard:leonhard-group /cluster/project/leonhard/modules | + | [leonhard@euler00 ~]$ '''chown leonhard:leonhard-group /cluster/project/leonhard/modules''' |
==== Using the custom module directory ==== | ==== Using the custom module directory ==== | ||
Line 22: | Line 22: | ||
Next, you need to create a module file for a program. Assume you have version 1.0 of the <tt>basel</tt> program located in <tt>/cluster/project/leonhard/apps/basel_problem/1.0/bin</tt> and it depends on the <tt>gmp</tt> module. Create the program's module directory: | Next, you need to create a module file for a program. Assume you have version 1.0 of the <tt>basel</tt> program located in <tt>/cluster/project/leonhard/apps/basel_problem/1.0/bin</tt> and it depends on the <tt>gmp</tt> module. Create the program's module directory: | ||
− | mkdir /cluster/project/leonhard/modules/basel | + | [leonhard@euler00 ~]$ '''mkdir /cluster/project/leonhard/modules/basel''' |
− | chown leonhard:leonhard-group /cluster/project/leonhard/modules/basel | + | [leonhard@euler00 ~]$ '''chown leonhard:leonhard-group /cluster/project/leonhard/modules/basel''' |
In your favorite editor, edit the <tt>/cluster/project/leonhard/modules/basel/1.0</tt> file to contain the following contents: | In your favorite editor, edit the <tt>/cluster/project/leonhard/modules/basel/1.0</tt> file to contain the following contents: | ||
#%Module1.0 | #%Module1.0 | ||
Line 33: | Line 33: | ||
Test that it works: | Test that it works: | ||
− | module avail basel/1.0 | + | [leonhard@euler00 ~]$ '''module avail basel/1.0''' |
− | module load basel/1.0 | + | [leonhard@euler00 ~]$ '''module load basel/1.0''' |
− | module list | + | [leonhard@euler00 ~]$ '''module list''' |
+ | Currently Loaded Modulefiles: | ||
+ | 1) modules 2) gcc/4.8.2(default:4.8) 3) gmp/5.1.3(default:5) 4) basel/1.0 |
Revision as of 12:25, 5 October 2016
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.
Creating a custom module directory
You need to decide on the top-level directory in which to store the module files. Let us assume it is /cluster/project/leonhard/modules, where hpc should be replaced with your group's storage location. This can also be an arbitrary directory to which you have access, e.g., $HOME/modules. First create the directory and set proper permissions:
[leonhard@euler00 ~]$ mkdir /cluster/project/leonhard/modules [leonhard@euler00 ~]$ chown leonhard:leonhard-group /cluster/project/leonhard/modules
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:
module use /cluster/project/leonhard/modules
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.
Creating a versioned module file
Next, you need to create a module file for a program. Assume you have version 1.0 of the basel program located in /cluster/project/leonhard/apps/basel_problem/1.0/bin and it depends on the gmp module. Create the program's module directory:
[leonhard@euler00 ~]$ mkdir /cluster/project/leonhard/modules/basel [leonhard@euler00 ~]$ chown leonhard:leonhard-group /cluster/project/leonhard/modules/basel
In your favorite editor, edit the /cluster/project/leonhard/modules/basel/1.0 file to contain the following contents:
#%Module1.0 module-whatis "Solve Basel problem" set helpmsg "Solves the Basel problem." module load gmp set topdir "/cluster/project/leonhard/apps/basel_problem/1.0" prepend-path PATH $topdir/bin
Test that it works:
[leonhard@euler00 ~]$ module avail basel/1.0 [leonhard@euler00 ~]$ module load basel/1.0 [leonhard@euler00 ~]$ module list Currently Loaded Modulefiles: 1) modules 2) gcc/4.8.2(default:4.8) 3) gmp/5.1.3(default:5) 4) basel/1.0