Parallel Simulation With MPI¶
This tutorial explains how to run simulations in parallel using MPI.
Prerequisites:
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
isTrue
:
[1]:
import hoomd
hoomd.version.mpi_enabled
[1]:
True
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 detail in the next section).
[2]:
import hoomd
simulation = hoomd.Simulation(device=hoomd.device.CPU())
simulation.create_state_from_gsd(
filename="../01-Introducing-Molecular-Dynamics/random.gsd"
)
simulation.state.replicate(3, 3, 3)
hoomd.write.GSD.write(filename="random.gsd", state=simulation.state, mode="wb")
Outline
This tutorial is written with jupyter. You can download the source from the hoomd-examples repository.