Environment Modules
Environment modules are bundles that hold a program and all the shell environment information that the program needs to run. When these modules are loaded by a user, that user's shell environment will be modified to include the environment in the module. When the module is unloaded, the module's environment is cleanly removed and no changes are made to the user's original environment.
You can see what modules are available on Luria by running:
You'll notice we have modules for common scientific programs, such as bwa
or R. You'll also notice that there are multiple versions of each of these programs.
Since the modules are completely separate from one another, there can be modules for different versions of the same software without any conflict between the two versions. This way, the needs of multiple users can be satisfied.
To load a module, you'd run:
So to load R v3.4.3:
Now that the module is loaded, any programs in the module should be available on the command line. So after loading the R module, you can run R.
Once you no longer need to use the module, you unload it by running:
So:
R will no longer be available on the command line.
Modules in Slurm
If you have a script, for example, an RScript that you want to submit to sbatch
for processing, you'll have to make sure to write a script that first loads in the appropriate module, then runs the program or script you wanted to run.
For example, write a script named myRjob.sh
:
This script makes sure that the R module is loaded before running the R script. Now, when you submit the job to Slurm with sbatch myRjob.sh
, it will run correctly.
Example script 1:
Example script 2:
Example script 3:
Last updated