Using Modules: Considerations and Defaults

Goal: Highlight the modules have defaults, and good practices such as purging and defining module versions.


Defaults: Why Consider?

Modules change and are updated.

The defaults will change and update – you might not realize.

Please define the version of a module you’re using.

Helps to replicate and triage.


What are the Defaults?

Performing a module avail, anything with a (D) will indicate it will act as the default. Anything labelled with a (L) indicates it is already loaded.

[]$ module avail ... --------------- /apps/s/lmod/mf/opt/linux-rhel9-x86_64/compilers --------------- gcc/13.2.0 gcc/14.2.0 (D) nvhpc-sdk/24.3 oneapi/2024.1.0 []$ module load gcc/14.2.0 []$ module avail ... [salexan5@mblog2 ~]$ module load gcc/14.2.0 [salexan5@mblog2 ~]$ module avail ... ------------- /apps/s/lmod/mf/spack/linux-rhel9-x86_64/gcc/14.2.0 -------------- ... boost/1.83.0__filesystem_False boost/1.83.0__filesystem_True (D) ... flex/2.6.3 flex/2.6.4 (D) ... gmp/6.2.1_x86_64 (L) ... --------------- /apps/s/lmod/mf/opt/linux-rhel9-x86_64/compilers --------------- gcc/13.2.0 gcc/14.2.0 (L,D) nvhpc-sdk/24.3 oneapi/2024.1.0 ...

Good Practice: Module Purging

Over the course of a session, over many hours, you might be loading a number of different modules/software, you might be trying to install Python/R packages, you might be compiling source code…

We’d suggest when you switch context to a different application to perform a module purge and only load what is explicitly required.

This will avoid dependency hell.


Why do versions matter?

Consider Python Packages installed using pip:

  • You install a package with respect to the version of python you are using.

  • A packages is not automatically available/installed across different versions.

  • If you start using python/3.9 and then swap to python/3.10 you will need to re-install any packages.

# Example: [lib]$ pwd /home/<username>/.local/lib []$ ls python2.7 python3.9 python3.10 python3.12 # These folders will only be created if you use that version. # Each child folder has its own site-packages folder.

Can I Automatically Load Modules at the Start of a Session?

[~] vim .bashrc ... module load gcc/14.2.0 r/4.4.0 ...

Updates to Modules