Spiedie Modules

Table of Contents

  1. Available Modules
  2. Loading a Module
  3. Unloading a Module
  4. Switch Module Files
  5. View loaded Modules
  6. Reload all Modules
  7. Module Collections
  8. Load Module at log in
  9. Further uses

Spiedie Modules

Spiedie uses a module system to load software into a user’s environment. With the exception of some (i.e. python), software on Spiedie is not accessible by default, and must be loaded through the module system. The reason for this is to accommodate as many users as possible, as specific versions of software may be needed for different users. The module system enables users to easily switch between different software versions depending on individual need.

Available Modules

To see what modules are available to load, type:

module avail 

This command returns a list of modules available to be loaded into the user’s environment. You can use the arrow keys to scroll the list if necessary and you can type q to exit.

Listing Modules

You can check which modules you currently have installed in your environment by typing:

module list

You can see here that there are a few modules loaded by default, it’s best to leave these as they are. Any module you load moving forward will show up here until you end your current session.

Loading and Unloading Modules

Modules can be loaded on login if necessary, however it may be cleaner and more efficient to load modules inside of job scripts or interactive jobs. This compartmentalizing will ensure that your jobs always have the necessary resources to run.

Loading a Module

To load a module to your current environment, type:

module load module_name

# example: "module load python"

or

module add module_name

# example: "module add python"

For modules that have more than one version, you can specify the exact version by appending a / with the version number:

module load module_name/version

# example: "module load python/3.7"

Note: Loaded modules are available on your path for your current session. So jobs queued with srun will have access to them. Jobs queued with sbatch will need to load the modules again in order to have access to them

Loading Modules in a Job Script

Modules loaded in a job script exist only in the environment created by the submission script, meaning that you wont have access to the modules in your normal environment. The modules in a job script can be loaded after your #SBATCH directives and before your actual executable is called. For example, a script that loads the Python module into the environment would look like the following:

#!bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --job-name=python-job
#SBATCH --output=python-job.%j.out

module load python/3.7.0

python3 test-program.py

Unloading a Module

To unload a module from your environment run

module unload module_name

or

module rm module_name

Switch Module files

The switch/swap subcommand is essentially a combination of the module load and module unload commands. You can switch out a module by typing:

module switch  module_file1 module_file2

# example "module switch python/2.7.0 python/3.7.0"

or

module swap  module_file1 module_file2

# example "module swap python/2.7.0 python/3.7.0"

Reload all Modules

To reload the loaded files and reset the PATH run:

module reload 

or

module refresh 

Module Collections

Module collections is a feature which comes in handy when you have a set of modules which are frequently loaded together. Instead of loading them individually, you can create a store which can be loaded at another time. To save the current set of loaded modules to a collection to be used later, run:

module save collection_name

To restore modules from the saved collection, run:

module restore collection_name

To see all available collections, run:

module saveshow

Further Uses

For further options for the module command, run:

module help