Skip to content

Environment Modules

Exercises

  1. Find and load a module

Use module avail to browse the software installed on your cluster. Pick a tool (e.g., BLAST, Python, GROMACS), load it, and verify the correct binary is active. Then unload it and confirm it is gone.

Hint / Solution
# Browse available modules
module avail

# Search for a specific tool
module avail blast

# Load it
module load blast/2.15

# Verify the binary is on your PATH
which blastn
blastn -version

# Unload and confirm
module unload blast
which blastn    # should return "not found" or point elsewhere
Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ module avail testapp 2>&1

----------------------------- /shared/modulefiles ------------------------------
   testapp/1.0    testapp/2.0 (D)

----------------------------- /shared/modulefiles ------------------------------
   testapp/1.0    testapp/2.0 (D)

  Where:
   D:  Default Module

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching
any of the "keys".

$ module load testapp/1.0 && module list 2>&1

Currently Loaded Modules:
  1) testapp/1.0



$ module unload testapp && module list 2>&1
No modules loaded
  1. Compare module versions

Find a tool that has multiple versions installed. Load one version, check its version output, then swap to a different version and check again. This demonstrates why being explicit about versions matters in job scripts.

Hint / Solution
# See what versions are available
module avail python

# Load one version
module load python/3.10
python3 --version    # Python 3.10.x

# Swap to another version
module swap python/3.10 python/3.12
python3 --version    # Python 3.12.x

# Show what you have loaded
module list
Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ module purge && module load testapp/1.0 && module list 2>&1 && echo '---' && module swap testapp/1.0 testapp/2.0 && module list 2>&1

Currently Loaded Modules:
  1) testapp/1.0



---

The following have been reloaded with a version change:
  1) testapp/1.0 => testapp/2.0


Currently Loaded Modules:
  1) testapp/2.0
  1. Save a module collection

Load the set of modules you would use for a typical analysis session, save them as a named collection, then restore them in a clean environment. This is useful for reproducible job scripts.

Hint / Solution
# Start clean
module purge

# Load your working set
module load python/3.12
module load blast/2.15
module load samtools/1.19

# Save as a named collection
module save my_analysis

# Verify the collection
module savelist

# Purge and restore
module purge
module list              # nothing loaded
module restore my_analysis
module list              # all three modules back
In a job script, you can put `module restore my_analysis` at the top instead of multiple `module load` lines. Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ module purge && module load testapp/2.0 && module save val_em3_collection 2>&1
Saved current collection of modules to: "val_em3_collection"

$ module purge && module list 2>&1
No modules loaded

$ module restore val_em3_collection && module list 2>&1
Restoring modules from user's val_em3_collection

Currently Loaded Modules:
  1) testapp/2.0

References