# hoomd.communicator¶

Overview

 Communicator MPI communicator

Details

MPI communication interface

Use methods in this module to query the number of MPI ranks, the current rank, etc…

class hoomd.communicator.Communicator(mpi_comm=None, nrank=None)

MPI communicator

Parameters
• mpi_comm – Accepts an mpi4py communicator. Use this argument to perform many independent hoomd simulations where you communicate between those simulations using your own mpi4py code.

• nrank (int) – (MPI) Number of ranks to include in a partition

barrier()

Perform a MPI barrier synchronization across all ranks in the partition.

Note

Does nothing in in non-MPI builds.

barrier_all()

Perform a MPI barrier synchronization across the whole MPI run.

Note

Does nothing in in non-MPI builds.

localize_abort()

Localize MPI_Abort to this partition.

HOOMD calls MPI_Abort to tear down all running MPI processes whenever there is an uncaught exception. By default, this will abort the entire MPI execution. When using partitions (nrank is not None), an uncaught exception on one partition will therefore abort all of them.

Use the return value of localize_abort() as a context manager to tell HOOMD that all operations within the context will use only that MPI communicator so that an uncaught exception in one partition will only abort that partition and leave the others running.

property num_ranks

Get the number of ranks in this partition.

Returns

The number of MPI ranks in this partition.

Note

Returns 1 in non-mpi builds.

property partition

Get the current partition index.

Returns

Index of the current partition.

Note

Always returns 0 in non-mpi builds.

property rank

Get the current rank.

Returns

Index of the current rank in this partition.

Note

Always returns 0 in non-mpi builds.