Skip to content

HOOMD-blue on MeluXina

The MeluXina system environment provides the HOOMD-blue scientific software for particle systems simulation.

EasyBuild module description

 HOOMD-blue is a Python package that runs simulations of particle systems on CPUs and GPUs.

It performs hard particle Monte Carlo simulations of a variety of shape classes and molecular dynamics simulations of particles with a range of pair, bond, angle, and other potentials. Many features are targeted at the soft matter research community, though the code is general and capable of many types of particle simulations.

The list of avalaible versions (CPU and GPU) can be found with module avail hoomd-blue command with an output example below:

(compute)$ module avail hoomd-blue
Output
------------------------------------------ /apps/USE/easybuild/release/latest/modules/all -------------------------------------------
   hoomd-blue/2.9.7-foss-2021a-CUDA-11.3.1 (D)  hoomd-blue/2.9.7-foss-2021a

  Where:
   D:  Default Module

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

The modules containing the CUDA tag show HOOMD-blue versions with GPU acceleration.

HOOMD-blue usage

CPU version

HOOMD-blue has a CPU-only version that can be run on the Meluxina CPU partition in Slurm batch jobs. The computational load can be distributed among MPI tasks to reduce simulation time. The script below runs a simple thread MPI HOOMD-blue script on one CPU node allocated for 30 minutes. Please check the hoomd-blue documentation for more information on running multiple simulations in parallel on a single node.

#!/bin/bash -l
#SBATCH -A COMPUTE_ACCOUNT
#SBATCH --job-name="hoomd-blue"
#SBATCH -p cpu
#SBATCH -q short
#SBATCH --time=30:00
#SBATCH -N 1
#SBATCH --ntasks-per-node=128
#SBATCH --cpus-per-task=1
#SBATCH --output=hoomd-blue.out
#SBATCH --error=hoomd-blue.err

#Load HOOMD-blue module
module load hoomd-blue/2.9.7-foss-2021a

#Run the case
srun python example.py

The Slurm batch script above makes a request for one CPU node with 128 tasks and 1 cores per task, thus will run 128 MPI ranks per node and 1 OpenMP threads per MPI rank.

Note

python example.py is an optimized scenario for a specific example case that may not suit your simulation. To use hoomd-blue efficiently, avoid for loops for numerical calculation and try to utilize NumPy broadcasting or existing functions in NumPy or Scipy on the CPU or CuPy on the GPU.

Please check the hoomd-blue documentation for more details on getting good performance.

GPU version

To use the GPU-enabled version of hoomd-blue, you will need to use one of the -CUDA- tagged modules.

#!/bin/bash -l
#SBATCH -A COMPUTE_ACCOUNT
#SBATCH --job-name="hoomd-blue-GPU"
#SBATCH -p gpu
#SBATCH -q short
#SBATCH --time=30:00
#SBATCH -N 1
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=1
#SBATCH --gpus-per-task=1
#SBATCH --output=hoomd-blue.out
#SBATCH --error=hoomd-blue.err

#Load HOOMD-blue module
module load hoomd-blue/2.9.7-foss-2021a-CUDA-11.3.1

#Run the case
srun python example.py