Working with modules

Introduction#


How to use modules on national systems (like Fir, Nibi, Rorqual and Narval)? As examples, we show how to load gromacs and lammps.

Modules#


Here are the most used commands for manipulating modules:

  • module list
  • module avail
  • module spider soft/version
  • module load soft/version
  • module unload {rm} soft/version
  • module show soft
  • module help soft
  • module whatis soft
  • module purge; module –force purge
  • module use ~/modulefiles; module unuse ~/modulefiles

To see if a given software or program, called foo, is available on the software stach, run the command:

module spider foo

How to load gromacs on national systems?#


First, run the command module spider gromacs to search if gromacs is already available as a module:

module spider gromacs

The above shows that many versions are available:

  • gromacs/2016.6
  • gromacs/2020.4
  • gromacs/2020.6
  • gromacs/2021.2
  • gromacs/2021.4
  • gromacs/2021.6
  • gromacs/2022.2
  • gromacs/2022.3
  • gromacs/2023
  • gromacs/2023.2
  • gromacs/2023.3
  • gromacs/2023.5
  • gromacs/2024.1
  • gromacs/2024.4
  • gromacs/2024.6
  • gromacs/2025.4
  • gromacs/2026.1

Now, try to load a particular version 2025.4:

To see how to load this particular version, run the command:

module spider gromacs/2025.4

and read the instructions.

Two modules are available:

  • StdEnv/2023 gcc/12.3 openmpi/4.1.5
  • StdEnv/2023 gcc/12.3 openmpi/4.1.5 cuda/12.6

Load one of the following modules:

  • For CPU version, use:
module load StdEnv/2023  gcc/12.3  openmpi/4.1.5 gromacs/2025.4
  • for GPU version, use:
module load StdEnv/2023 gcc/12.3 openmpi/4.1.5 cuda/12.6 gromacs/2025.4 

Load one module and experiment with the commands:

module list
module show gromacs
ls ${EBROOTGROMACS}/bin
which gmx_mpi
module rm gromacs
module show gromacs
which gmx_mpi
While running the command module show gromacs, have a look to the environment variables, like EBROOTGROMACS that points to t he installation directory.
Note that gmx_mpi is a binary used to run gromacs. For another program, you should know the binaries to use.

How to load LAMMPS on national clusters?#


First, run the command module spider lammps to search if lammps is already available as a module:

module spider lammps

The above shows that many versions are available:

  • lammps-omp/20201029
  • lammps-omp/20210929
  • lammps-omp/20220623
  • lammps-omp/20230802
  • lammps-omp/20240829
  • lammps-omp/20250722

Now, try to load a particular version 20240829:

To see how to load this particular version, run the command:

module spider lammps-omp/20240829

and read the instructions.

One module is available:

module load StdEnv/2023  intel/2023.2.1  openmpi/4.1.5 lammps-omp/20240829

Load the module and experiment with the commands:

module list  
module show lammps
ls ${EBROOTLAMMPS}/bin
which lmp
module rm lammps
module show lammps
which lmp
While running the command module show lammps, have a look to the environment variables, like EBROOTLAMMPS that points to t he installation directory.
Note that lmp is a binary used to run lammps. For another program, you should know the binaries to use.

Experiment with other programs#


For more examples, experiment with other programs, like boost, netcdf, python, openmm, geant4 or any other program you have in mind.

Quick test using LAMMPS#


Here, we show how to run a quick test of lammps on the login nodes in different modes: serial, OpenMP, MPI and Hybrid.

Here are the instructions to run a quick test using LAMMPS on national system:

Requireements:

  • access to login or compute node via salloc.
  • access to a module (lammps in this case)
  • Input file: lammps-input.in
Example of input file used to run LAMMPS.
# 3d Lennard-Jones melt

units           lj
atom_style      atomic

lattice         fcc 0.8442
region          box block 0 10 0 10 0 10
create_box      1 box
create_atoms    1 box
mass            1 1.0

velocity        all create 3.0 87287

pair_style      lj/cut 2.5
pair_coeff      1 1 1.0 1.0 2.5

neighbor        0.3 bin
neigh_modify    every 20 delay 0 check no

fix             1 all nve

thermo          50

run             10000

#write_data     config.end_melt

# End of the Input file.

First, connect to a cluster {MC or any national cluster you have access to}.

Search for lammps modules:

  • Module “lammps-omp/20240829”.
  • Use module spider to see how to load this module.
module purge
module spider lammps-omp/20240829

Then load the module “lammps-omp/20240829

module load StdEnv/2023 intel/2023.2.1 openmpi/4.1.5 lammps-omp/20240829

Make sure that the module is loaded and available in your environment by running

  • The binary for this program is called lmp
  • See if the binary is in your path by running the command:
module list
which lmp

Now try to run the test interactively by invoking the command:

lmp -in lammps-input.in

Before running any script, use cat command to see the content of the script

cat <your script>

Run the following commands from your terminal

   
sh ./mc-runlmp-1cpu-serial.sh
sh ./mc-runlmp-2cpu-openmp.sh
sh ./mc-runlmp-2cpu-mpi.sh
sh ./mc-runlmp-4cpu-openmp.sh
sh ./mc-runlmp-4cpu-mpi.sh
sh ./mc-runlmp-8cpu-2mpi-4openmp.sh  
sh ./mc-runlmp-8cpu-4mpi-2openmp.sh

The above will run lammps using:

  • 1 CPU ==> Serial program
  • 2 CPUs ==> OpenMP program
  • 2 CPUs ==> MPI program
  • 4 CPUs ==> OpenMP program
  • 4 CPUs ==> MPI program
  • 8 CPUs ==> Hybrid mode (2 MPI + 4 OpenMP)
  • 8 CPUs ==> Hybrid mode (4 MPI + 2 OpenMP)

The above will generate the following output:

  • output_lammps-serial.txt
  • output_lammps-openmp-2cpus.txt
  • output_lammps-mpi-2cpus.txt
  • output_lammps-openmp-4cpus.txt
  • output_lammps-mpi-4cpus.txt
  • output_lammps-8cpu-2mpi-4openmp.txt
  • output_lammps-8cpu-4mpi-2openmp.txt
Note that login nodes are not meant for intensive tests. For any memory or CPU intensive test, please user interactive jobs via salloc.