Table of Contents

Software Modules

Software modules make it easy for you to use software installed on CS servers. We provide a wide range of software across all our servers so that you don't have to install software on your own. We also offer different versions of software, letting users choose which they want to use.

How Software Modules Work

Software modules modify Environment Variables unique to your shell. Environment variables include for example the variable PATH, which are directory path(s) to executables to use when typing a command in your terminal. For example, when you log in via SSH, variables such as the PATH variable are set or updated to contain the location(s) of various executable commands such as vim, sinfo, and others.

Each time you load a module, this variable and others are updated to make additional commands or libraries available to your shell.

Software Module Requests

If software is required but is not listed, please send an email to cshelpdesk@virginia.edu with the following information:

  1. In the subject line, write: Software Module Request: <software name and version>
  2. In the body of the email, include information about the requested software
    1. Links to software documentation page(s) if available
    2. Version(s) required

Backend Module Software Transition (2025)

In January of 2025, the CS department is transitioning the backend software used for interacting with modules from Environment Modules to LMOD (LMOD Homepage), and implementing EasyBuild (EasyBuild Homepage) for maintaining modules.

Reasons for using LMOD

Reasons for using EasyBuild

Under this new system, there will be three primary types of modulefiles and available software

  1. Common/Core
    • These are software modules compiled and maintained using EasyBuild
  2. Custom
    • These are software modules that were manually compiled that are not available within EasyBuild or have another reason for manual compilation
  3. Licensed
    • These are software modules that require some form of license to use (for example, matlab, gurobi, etc.)

Important Notes & Changes

Module FAQ


Using Software Modules

Modules are compiled using a toolchain such as gcc, the system default (i.e. what the server has available), or others. This means that modules compiled using a toolchain will not be available (i.e. won't be shown with module avail) until the toolchain has been loaded.

For example, openmpi will not show up in the module avail output until the appropriate GCC toolchain is loaded. Required modules can be found by using the module spider <module name & version> as shown below.

In-depth information about module usage and interaction can be found (here).

To list available modules

module avail

To load a default module (no version specified)

module load <module name>

To load a specific version, include the version suffix

module load <module name>/1.2.3

To search for modules and list required dependency modules to load certain modules

module spider <module name & version>

For example, to load python, first search for what python versions are available

module spider python
----------------------------
  python:
----------------------------
    Description:
      Python is a programming language that lets you work more quickly and integrate your systems more effectively.

     Versions:
        python/2.7.18
        python/3.10.8
        python/3.11.3
        python/3.12.3

Then, search for required modules to load first before loading a specific version of python

module spider python/3.12.3
----------------------------
  python: python/3.12.3
----------------------------
    ... output omitted ...
    You will need to load all module(s) on any one of the lines below before the "python/3.12.3" module is available to load.
      gcccore/13.3.0

Thus, gcccore/13.3.0 is required to load python/3.12.3

module load gcccore/13.3.0
module load python/3.12.3

Alternatively, you can load the required module and the module itself on one line

module load gcccore/13.3.0 python/3.12.3

To load the default version, simply omit the version

module load gcccore python

To show all currently loaded modules

module list

To show information about a module

module whatis <module name & version>

To unload a module

module unload <module name & version>

To purge (unload all) loaded modules

module purge

Software Modules & SLURM

Before submitting a job, it is recommended to unload all loaded modules using module purge before and during the job launch, and then load them in the job script or at the command line for an interactive job.

This ensures that no unexpected modules are carried forward into your job from your shell's environment variables.

SBATCH Example

#!/bin/bash

#SBATCH --gres=gpu:1
#SBATCH --mem=16000
#SBATCH -t 04:00:00
#SBATCH -p gpu
#SBATCH --mail-type=begin,end
#SBATCH --mail-user=<computingID>@virginia.edu

module purge
module load gcc
module load python

python3 myprogram

Virtual Environments

For most Python related packages (i.e. pip install …), it is often more applicable to utilize a virtual environment. This can be done with Conda or venv. The former requires loading an miniforge module, and the latter requires the python3 module.

Example Conda Creation

After loading and using this module, your ~/.bashrc file will be updated to source the base environment each time you log in.

After logging into portal, load the module and configure your login shell (altering the file ~/.bashrc) to source the base environment to allow for conda activate commands

abc1de@portal01:~$ module load miniforge
abc1de@portal01:~$ conda init bash

// after logging out and back in
(base) abc1de@portal01:~$ conda create -n mynewenvironment

This will by default create an environment named mynewenvironment in ~/abc1de/.conda/envs/.

You can also specify a path where an environment should be created

(base) abc1de@portal01:~$ conda create -n mynewenvironment --prefix /p/myprojectdirectory/condaenvs

Packages can be specifed when creating an environment

(base) abc1de@portal01:~$ conda create -n mynewenvironment matplotlib=3.5 numpy=1.21

Environments can be created using a .yml file as well

(base) abc1de@portal01:~$ conda env create -f /<path>/env.yml

To list available environments

(base) abc1de@portal01:~$ conda env list

OR

(base) abc1de@portal01:~$ conda info --envs

To activate an environment (if the name is shown with conda env list)

(base) abc1de@portal01:~$ conda activate mynewenvironment

To activate an environment by path

(base) abc1de@portal01:~$ conda activate /<path>/mycustompathenv

Example VENV Creation

After logging into portal, load the python module

abc1de@portal01:~$ module load python

To create a python3 venv envrionment

abc1de@portal01:~$ python3 -m venv /<path>/myvenv

To activate a python3 venv environment

abc1de@portal01:~$ source /<path>/myvenv/bin/activate

Commands such as pip3 can now be used within the envrionment

abc1de@portal01:~$ which pip3
/<path>/myenv/bin/pip3

abc1de@portal01:~$ pip3 install <package name>

Jupyter Notebook

A Jupyter Notebook interface can be loaded using a virtual environment (as described above). This is best done using a NX virtual desktop. Once you've logged into your NX virtual desktop, load python3 or miniforge as a software module:

abc1de@labsrv03~:$ module load miniforge

Then, load Jupyter Notebook:

abc1de@labsrv03~:$ Jupyter Notebook

Follow the link given to you by the Notebook Server to access the interface:

[W 12:52:23.489 NotebookApp] Loading JupyterLab as a classic notebook (v6) extension.
[I 12:52:23.492 NotebookApp] Serving notebooks from local directory: /u/abc1de
[I 12:52:23.492 NotebookApp] Jupyter Notebook 6.5.4 is running at:
[I 12:52:23.492 NotebookApp] http://localhost:8888/?token=eb9345040d71bbeb1eddc75fb88504f98e25beb207907f6d
[I 12:52:23.492 NotebookApp]  or http://127.0.0.1:8888/?token=eb9345040d71bbeb1eddc75fb88504f98e25beb207907f6d
[I 12:52:23.492 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:52:23.634 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///u/<youruserid>/.local/share/jupyter/runtime/nbserver-20880-open.html
    for example...
        file:///u/abc1de/.local/share/jupyter/runtime/nbserver-20880-open.html

Containers

Apptainer is the supported software for using containers throughout the CS environment. See our page on (Apptainer) for more information.