Environment Module: Difference between revisions

From Leo's Notes
This page was last edited on 28 January 2021, at 01:11.
Created page with "Environment modules provides a reversible way to alter a user's environment to make software packages available. == Cheat Sheet == {| class="wikitable" !Action !Command |- |L..."
 
creating modulefiles
Line 1: Line 1:
Environment modules provides a reversible way to alter a user's environment to make software packages available.
Environment modules provides a reversible way to alter a user's environment to make software packages available.


== Cheat Sheet ==
==Cheat Sheet==
{| class="wikitable"
{| class="wikitable"
!Action
!Action
Line 19: Line 19:
|}
|}


== Creating a module ==
==Creating a module==
Create a shared location for your modules so that other users can make use of it. For example <code>/share/modulefiles</code>. Append this path to your module by running:
Create a shared location for your modules so that other users can make use of it. For example <code>/share/modulefiles</code>. Append this path to your module by running:
{{Highlight
{{Highlight
Line 26: Line 26:
}}
}}


== See Also ==
=== Create a modulefile ===
A modulefile defines what paths should be set when loaded. Below is a simple skeleton modulefile:
{{Highlight
| code = #%Module
set vers 1.4.1103
global version
 
proc ModulesHelp { } {
    puts stderr "\tThis module loads something.\n"
}
 
module-whatis "loads something to your environment."
 
# Base directory of your software
set rootdir "/software/modules/software/rstudio-1"
 
# Prepend to paths
prepend-path PATH "${rootdir}/usr/lib/rstudio/bin"
prepend-path LD_LIBRARY_PATH "${rootdir}/usr/lib/rstudio/lib"
# prepend-path MANPATH /path/to/manpages
| lang = text
}}
 
==See Also==


* Documentation: https://modules.readthedocs.io/en/latest/
*Documentation: https://modules.readthedocs.io/en/latest/

Revision as of 01:11, 28 January 2021

Environment modules provides a reversible way to alter a user's environment to make software packages available.

Cheat Sheet

Action Command
Load a module module load gcc/6.1.1
Unload a module module unload gcc
Show what's available module avail
List what's loaded module list

Creating a module

Create a shared location for your modules so that other users can make use of it. For example /share/modulefiles. Append this path to your module by running:

module use --append /share/modulefiles

Create a modulefile

A modulefile defines what paths should be set when loaded. Below is a simple skeleton modulefile:

#%Module
set vers 1.4.1103
global version

proc ModulesHelp { } {
    puts stderr "\tThis module loads something.\n"
}

module-whatis "loads something to your environment."

# Base directory of your software
set rootdir "/software/modules/software/rstudio-1"

# Prepend to paths
prepend-path PATH "${rootdir}/usr/lib/rstudio/bin"
prepend-path LD_LIBRARY_PATH "${rootdir}/usr/lib/rstudio/lib"
# prepend-path MANPATH /path/to/manpages

See Also