Poplar and PopLibs
poplar::DeviceManager Class Reference

A DeviceManager is able to enumerate and return groups of physical IPUs connected to an entity/host. More...

#include <DeviceManager.hpp>

Public Member Functions

std::size_t getNumDevices () const
 Get the number of devices attached to this host.
 
std::vector< DevicegetDevices (const OptionFlags &opts={}) const
 Get the list of all devices.
 
std::vector< DevicegetDevices (TargetType type, unsigned requiredNumIPUs, const OptionFlags &opts={}) const
 Get the list of all devices fulfilling the specified criteria. More...
 
Device getDevice (unsigned deviceManagerId, const OptionFlags &opts={}) const
 Get a specific device by its device manager id. More...
 
std::vector< unsigned > getChildDeviceIds (unsigned parentId, unsigned numChildDeviceIpus=1) const
 Get the deviceIds of the child devices of a multi-IPU device. More...
 

Static Public Member Functions

static DeviceManager createDeviceManager ()
 Create a device manager for the current host.
 

Detailed Description

A DeviceManager is able to enumerate and return groups of physical IPUs connected to an entity/host.

It returns such a group of IPUs as a single poplar::Device with a unique device manager id.

The physical devices within any returned Device may overlap with other Devices returned.

Any poplar::Device(s) returned can not be copied but can be moved for further use.

It is thread safe to both construct multiple DeviceManager's in different threads and use them at the same time (although both threads might return the same device and therefore only one will succeed in attaching to it). It is also thread safe to use the same DeviceManager in different threads.

Member Function Documentation

◆ getChildDeviceIds()

std::vector< unsigned > poplar::DeviceManager::getChildDeviceIds ( unsigned  parentId,
unsigned  numChildDeviceIpus = 1 
) const

Get the deviceIds of the child devices of a multi-IPU device.

A multi-IPU device will fully overlap "child" devices that are made out of the same IPUs. This method returns the set of child devices.

Parameters
parentIdThe device ID of the parent device
numChildDeviceIpusThe number of IPUs the child devices must contain to be considered a child.

◆ getDevice()

Device poplar::DeviceManager::getDevice ( unsigned  deviceManagerId,
const OptionFlags opts = {} 
) const

Get a specific device by its device manager id.

Parameters
deviceManagerIdThe ID of the requested device. The ID is that returned by the gc-info command. This can specify a single device or a group of devices.
optsThe arguments passed to the target (optional)
Returns
A matching device

◆ getDevices()

std::vector< Device > poplar::DeviceManager::getDevices ( TargetType  type,
unsigned  requiredNumIPUs,
const OptionFlags opts = {} 
) const

Get the list of all devices fulfilling the specified criteria.

Depending on the criteria, the list may be empty - for example, if the requiredNumIPUs cannot be satisfied by any available device configurations. To view available device configurations, see the gc-info command line tool.

Parameters
typeThe desired target type (IPU, IPU_Model, CPU)
requiredNumIPUsNumber of IPUs required
optsThe arguments passed to the target (optional)
Returns
A potentially empty list of matching devices

The documentation for this class was generated from the following file: