Poplar and PopLibs
|
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< Device > | getDevices (const OptionFlags &opts={}) const |
Get the list of all devices. | |
std::vector< Device > | getDevices (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. | |
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.
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.
parentId | The device ID of the parent device |
numChildDeviceIpus | The number of IPUs the child devices must contain to be considered a child. |
Device poplar::DeviceManager::getDevice | ( | unsigned | deviceManagerId, |
const OptionFlags & | opts = {} |
||
) | const |
Get a specific device by its device manager id.
deviceManagerId | The 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. |
opts | The arguments passed to the target (optional) |
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.
type | The desired target type (IPU, IPU_Model, CPU) |
requiredNumIPUs | Number of IPUs required |
opts | The arguments passed to the target (optional) |