Singularity is a container platform that allows you to create and run containers on high-performance computing (HPC) systems. It is particularly useful for running applications in a consistent environment across different systems.

You can find more details about how to use singularity here.

Pulling images from DockerHub

We have a group docker repository. You can build the Singularity image from the DockerHub repository using the following command:

singularity build --fakeroot IMAGE_NAME.sif docker://DOCKERHUB/REPO:TAG

where IMAGE_NAME is the name of the image you want to create, DOCKERHUB is the name of the DockerHub account, REPO is the name of the repository and TAG is the tag of the image. For example, to pull the mace-0.3.11-cueq image from DockerHub, you can use the following command:

singularity build --fakeroot mace-0.3.11-cueq.sif docker://dengzeyu/pytorch:mace-0.3.11-cueq

Running a command using Singularity container

You can run a Singularity container using the following command:

singularity exec --nv IMAGE_NAME.sif COMMAND

where IMAGE_NAME is the name of the image you want to run. You can remove --nv if you don’t need the NVIDIA GPU support. For example, to run the mace-0.3.11-cueq image, you can use the following command:

singularity exec --nv mace-0.3.11-cueq.sif python run_md.py

Run VASP using Singularity on Hopper

Another example is to run the vasp command in the VASP container on Hopper you can use follwing submission script to run VASP with GPU support using a single GPU:

#!/bin/bash
#PBS -l select=1:ngpus=1 
#PBS -l walltime=24:0:0
#PBS -j oe
#PBS -N vasp_jobs
#PBS -P PROJECT_CODE
 
export vasp=/opt/vasp/bin/vasp_std
export container=PATH_TO_YOUR_VASP_CONTAINER/vasp_nvhpc.sif
export OMPI_MCA_hwloc_base_binding_policy=none
export OMP_STACK_SIZE=4096m
export OMP_NUM_THREADS=4
 
module load singularity
 
cd $PBS_O_WORKDIR
 
# Check if any vasprun.xml* file exists
singularity exec --nv $container mpirun -n 1 $vasp > vasp.out

Make sure that you have set the container variable to the path of your VASP container. You can also use the vasp variable to specify the path to the VASP executable inside the container (vasp_std, vasp_ncl, and vasp_gam). You should also set PROJECT_CODE to your project code.