hoomd.device

Overview

hoomd.device.CPU

Run simulations on a CPU

hoomd.device.GPU

Run simulations on a GPU

hoomd.device.Auto

Allow simulation hardware to be chosen automatically by HOOMD-blue

Details

Devices available to run simulations

A device object represents the hardware (whether CPU, GPU, or Auto) the simulation will run on. Creating a device object will automatically add it to the simulation context. A device in mode Auto is chosen by default for the user, but they can chose a new one before starting the simulation. Devices in mode Auto will choose GPU at runtime if available, otherwise simulations will run on the CPU.

Note

Device objects have the following properties:

hoomd.device.mode

gpu or cpu

Type

str

hoomd.device.comm

communicator object held by this device

Type

hoomd.comm.Communicator

hoomd.device.num_threads

the number of CPU threads to be used in simulation, settable

Type

int

hoomd.device.gpu_ids

list of names of the gpus, if in gpu mode

Type

list(int)

hoomd.device.num_ranks

the number of ranks

Type

int

hoomd.device.notice_level

minimum level of notice messages to print, settable

Type

int

hoomd.device.memory_tracback

If true, enable memory allocation tracking (only for debugging/profiling purposes)

Type

bool

hoomd.device.gpu_error_checking

Whether or not CUDA error checking is enabled, settable.

Type

bool

hoomd.device.msg_file

The name of the file to write messages. Set this property to None to write to stdout/stderr.

Type

str

class hoomd.device.Auto(nthreads=None, communicator=None, msg_file=None, shared_msg_file=None, notice_level=2)

Allow simulation hardware to be chosen automatically by HOOMD-blue

Parameters
  • nthreads (int) – number of TBB threads

  • communicator (hoomd.comm.Communicator) – MPI communicator object. Can be left None if using a default MPI communicator

  • msg_file (str) – Name of file to write messages to

  • shared_msg_file (str) – (MPI only) Name of shared file to write message to (append partition #)

  • notice_level (int) – Minimum level of notice messages to print

property comm

Get the MPI Communicator

class hoomd.device.CPU(nthreads=None, communicator=None, msg_file=None, shared_msg_file=None, notice_level=2)

Run simulations on a CPU

Parameters
  • nthreads (int) – number of TBB threads

  • communicator (hoomd.comm.Communicator) – MPI communicator object. Can be left None if using a default MPI communicator

  • msg_file (str) – Name of file to write messages to

  • shared_msg_file (str) – (MPI only) Name of shared file to write message to (append partition #)

  • notice_level (int) – Minimum level of notice messages to print

property comm

Get the MPI Communicator

class hoomd.device.GPU(gpu_ids=None, communicator=None, msg_file=None, shared_msg_file=None, notice_level=2)

Run simulations on a GPU

Parameters
  • gpu_ids (list(int)) – GPU or comma-separated list of GPUs on which to execute

  • communicator (hoomd.comm.Communicator) – MPI communicator object. Can be left None if using a default MPI communicator

  • msg_file (str) – Name of file to write messages to

  • shared_msg_file (str) – (MPI only) Name of shared file to write message to (append partition #)

  • notice_level (int) – Minimum level of notice messages to print

property comm

Get the MPI Communicator