Modules
From HPC
(→Show available modules) |
|||
(7 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | =Modules= | + | =Environment Modules (module)= |
- | Modules are a tool to allow you to change the working | + | Modules are a tool to allow you to change the working environment to support various application and version of those applications. |
It allows use for example to support three versions of java and 32bit and 64 version of each. This equates to 6 different versions, using modules you can load the one you want to use or unload the ones you don't. | It allows use for example to support three versions of java and 32bit and 64 version of each. This equates to 6 different versions, using modules you can load the one you want to use or unload the ones you don't. | ||
+ | |||
+ | |||
+ | http://modules.sourceforge.net/ | ||
+ | |||
+ | https://en.wikipedia.org/wiki/Environment_Modules_(software) | ||
=Commands= | =Commands= | ||
Line 17: | Line 22: | ||
Example | Example | ||
- | + | # module list | |
Currently Loaded Modulefiles: | Currently Loaded Modulefiles: | ||
- | 1) | + | 1) R/3.6.0 2) samtools/1.9 3) mrbayes/3.2.7a |
- | 2) | + | |
- | + | ||
==Show available modules== | ==Show available modules== | ||
Line 27: | Line 30: | ||
module avail | module avail | ||
- | This would display something similar to this | + | This would display something similar to this |
- | ------------------------------ /usr/ | + | |
- | + | # module avail | |
- | + | ------------------------------- /usr/local/modulefiles -------------------------------------------------------------------------------------------------- | |
- | + | bcftools/1.9 beast/1.10.4 dot gcc/6.5.0 gcc/7.4.0 gdal/2.3.3 module-git module-info modules mrbayes/3.2.7a null R/3.4.1 R/3.4.4 R/3.5.2 R/3.5.3 R/3.6.0 samtools/1.9 use.own | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
==Load a module== | ==Load a module== | ||
- | module load | + | module load <module_name> |
For example | For example | ||
- | module load | + | module load gcc/7.4.0 |
==Unload a module== | ==Unload a module== | ||
- | module unload | + | module unload <module_name> |
For example | For example | ||
- | module unload | + | module unload gcc/7.4.0 |
- | ==Using | + | ==Using module command in your bash scripts== |
To use the module command in you bash scripts you must first intialise it within you script using the following line | To use the module command in you bash scripts you must first intialise it within you script using the following line | ||
- | + | source /etc/profile.d/modules.sh | |
For example | For example | ||
#!/bin/bash | #!/bin/bash | ||
- | + | ||
+ | source /etc/profile.d/modules.sh | ||
+ | |||
module list | module list | ||
- | module load | + | module load gcc/7.4.0 |
module list | module list | ||
+ | |||
+ | ==Using module command in your qsub scripts== | ||
+ | |||
+ | '''Option One''' | ||
+ | |||
+ | Set you qsub script to include all environment variables | ||
+ | |||
+ | #$ -V | ||
+ | |||
+ | For example | ||
+ | |||
+ | #!/bin/bash | ||
+ | #$ -N R_JOB | ||
+ | #$ -M me@lshtm.ac.uk -m be | ||
+ | #$ -q short.q | ||
+ | #$ -l mem_free=1G,h_vmem=1.2G | ||
+ | #$ -V -cwd | ||
+ | |||
+ | module load R/3.4.1 | ||
+ | |||
+ | R CMD BATCH myrscript myrscript.out | ||
+ | |||
+ | '''Option two''' | ||
+ | |||
+ | Load the module environment directly to the qsub script with | ||
+ | |||
+ | source /etc/profile.d/modules.sh | ||
+ | |||
+ | For example | ||
+ | |||
+ | #!/bin/bash | ||
+ | #$ -q short.q | ||
+ | #$ -l mem_free=1G,h_vmem=1.2G | ||
+ | |||
+ | source /etc/profile.d/modules.sh | ||
+ | |||
+ | module load R/3.4.1 | ||
+ | |||
+ | R CMD BATCH myrscript myrscript.out | ||
[[Category:Getting Started]] | [[Category:Getting Started]] |
Current revision as of 09:41, 4 July 2019
Contents |
Environment Modules (module)
Modules are a tool to allow you to change the working environment to support various application and version of those applications.
It allows use for example to support three versions of java and 32bit and 64 version of each. This equates to 6 different versions, using modules you can load the one you want to use or unload the ones you don't.
http://modules.sourceforge.net/
https://en.wikipedia.org/wiki/Environment_Modules_(software)
Commands
Help
module help
Show currently loaded modules
module list
Example
# module list Currently Loaded Modulefiles: 1) R/3.6.0 2) samtools/1.9 3) mrbayes/3.2.7a
Show available modules
module avail
This would display something similar to this
# module avail ------------------------------- /usr/local/modulefiles -------------------------------------------------------------------------------------------------- bcftools/1.9 beast/1.10.4 dot gcc/6.5.0 gcc/7.4.0 gdal/2.3.3 module-git module-info modules mrbayes/3.2.7a null R/3.4.1 R/3.4.4 R/3.5.2 R/3.5.3 R/3.6.0 samtools/1.9 use.own
Load a module
module load <module_name>
For example
module load gcc/7.4.0
Unload a module
module unload <module_name>
For example
module unload gcc/7.4.0
Using module command in your bash scripts
To use the module command in you bash scripts you must first intialise it within you script using the following line
source /etc/profile.d/modules.sh
For example
#!/bin/bash
source /etc/profile.d/modules.sh
module list module load gcc/7.4.0 module list
Using module command in your qsub scripts
Option One
Set you qsub script to include all environment variables
#$ -V
For example
#!/bin/bash #$ -N R_JOB #$ -M me@lshtm.ac.uk -m be #$ -q short.q #$ -l mem_free=1G,h_vmem=1.2G #$ -V -cwd module load R/3.4.1 R CMD BATCH myrscript myrscript.out
Option two
Load the module environment directly to the qsub script with
source /etc/profile.d/modules.sh
For example
#!/bin/bash #$ -q short.q #$ -l mem_free=1G,h_vmem=1.2G
source /etc/profile.d/modules.sh module load R/3.4.1 R CMD BATCH myrscript myrscript.out