Parallel Simulation With MPI

This tutorial explains how to run simulations in parallel using MPI.


  • This tutorial assumes you are familiar with terms relating to high performance computing clusters, specifically job and scheduler.

  • This tutorial uses molecular dynamics simulations to demonstrate parallel jobs. The tutorial Introducing Molecular Dynamics teaches these concepts.

  • To execute these notebooks locally, you need an MPI enabled version of HOOMD-blue. You can check this by checking that hoomd.version.mpi_enabled is True:

import hoomd


The HOOMD-blue binaries on conda-forge do not enable MPI due to technical limitations.

The system used in Introducing Molecular Dynamics is small. Replicate the state of that system, as MPI parallel simulations require a minimum system size (this requirement is explained in more details in the next section).

import hoomd

sim = hoomd.Simulation(device=hoomd.device.CPU())
sim.state.replicate(3, 3, 3)
hoomd.write.GSD.write(filename="random.gsd", state=sim.state, mode='wb')

This tutorial is written with jupyter. You can download the source from the hoomd-examples repository.