How to use the NDM Apptainer image ?

Prerequisites

For more information on Apptainer containers, please look at this page or refer to this tutorial to have a quick look at Apptainer’s main commands.

Create a directory containing the ndm.sif image and the archive of the input files. Move into this directory and extract the archive as follows:

tar -xzf ndm-tutorial-inputs.tar.gz # Extracts the contents of the archive.

One-line command

To launch a simulation with NDM using N processes, simply run the following command in a folder containing input files:

apptainer exec ndm.sif mpirun -np <N> rundm90_ndm_mpi

Introduction

NDM is a distributed Fortran code for empirical potential molecular dynamics computations built around the MPI standard, allowing the computational workload to be distributed across multiple processes. There are two ways to run the containerized code in parallel:

  • MPI embedded in the container => guaranteed to work, but limited to a single machine (a single node)
  • Hybrid MPI using the host machine’s MPI => works across multiple nodes but may introduce compatibility issues.

Local simulation (embedded MPI)

apptainer exec ndm.sif mpirun rundm90_ndm_mpi

Note that the command first launches apptainer, which then executes mpirun rundm90_ndm_mpi inside the container.

Cluster simulation (hybrid MPI)

Example of a minimal launch script job.sh:

#!/bin/bash

#SBATCH --job-name=test_ndm
#SBATCH --output=slurm-%j.out
#SBATCH --error=slurm-%j.err
#SBATCH --ntasks=12
#SBATCH --time=00:05:00

srun apptainer run ndm.sif

For reference, apptainer run ndm.sif is a shortcut for apptainer exec ndm.sif rundm90_ndm_mpi.

The computation can then be launched with the command:

sbatch job.sh

Launch without a scheduler

mpirun -np <N> apptainer run ndm.sif

The mpirun command must come from OpenMPI 4 for this to work.