DeviceManager

#include <poplar/DeviceManager.hpp>
namespace poplar

Poplar classes and functions.

class DeviceManager
#include <DeviceManager.hpp>

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.

Public Functions

DeviceManager()
DeviceManager(const DeviceManager&)
DeviceManager(DeviceManager&&) noexcept
virtual ~DeviceManager()
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.

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
  • type – The desired target type (IPU, IPU_Model, CPU)

  • requiredNumIPUs – Number of IPUs required

  • opts – The arguments passed to the target (optional)

Returns

A potentially empty list of matching devices

Device getDevice(unsigned deviceManagerId, const OptionFlags &opts = {}) const

Get a specific device by its device manager id.

Parameters
  • 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)

Returns

A matching device

std::vector<unsigned> 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
  • parentId – The device ID of the parent device

  • numChildDeviceIpus – The number of IPUs the child devices must contain to be considered a child.

Public Static Functions

static DeviceManager createDeviceManager()

Create a device manager for the current host.

Private Members

std::unique_ptr<core::DeviceManagerImpl> impl
namespace core