#include <poplar/Device.hpp>
namespace poplar

Poplar classes and functions.

class Device
#include <Device.hpp>

A device refers to a physical entity that can execute code.

Devices should be obtained from a poplar::DeviceManager object or from appropriate factory poplar::Device::createXXXDevice(). Devices can not be copied but can be moved.

Public Functions

Device(Device&&) noexcept
virtual ~Device()
Device &operator=(Device&&) noexcept
Device(const Device&) = delete
Device &operator=(const Device&) = delete
unsigned getId() const

Get the numerical ID of this device as known by the DeviceManager.

const Target &getTarget() const

Get the target description of the device.

bool attach() const

Try and acquire this device and lock it to the current process.

void detach() const

Release this device to other processes.

void getDriverVersion(unsigned &major, unsigned &minor, unsigned &point) const

Retrieve driver version of the attached device.

Throws if the device is not attached or is not an IPU device.

bool supportsRemoteBuffers() const

Retrieve availability of remote buffers from the attached device.

Throws if the device is not attached or is not an IPU device.

bool hasGateway() const

Retrieve IPU-Gateway (such as in an IPU-M2000) availability from the attached device.

Throws an exception if the device is not attached or is not an IPU device.

std::map<std::string, std::string> getAttributes() const


use Device::getAttribute

std::string getAttribute(IPUAttributes::AttributeId attributeId) const

Retrieve a device attribute string value keyed by attributeId.

std::vector<int> getNumaTopology() const

Get the NUMA node of each IPU that makes up this device.

std::vector<int> getNumaNodesUsedForIPUs() const

Get the NUMA nodes that Poplar will use to execute code that communicates with each IPU that makes up this device.

If Poplar can’t execute code on the NUMA node for an IPU then this function returns -1 for that IPU. Poplar will interpret the -1 as disabling NUMA node pinning for that IPU.

Note that this function is not necessarily the same as getNumaTopology(), as it also handles NUMA node restrictions imposed by the Poplar process’ CPU affinity. For example on a machine with two NUMA nodes, with ids of 0 and 1, each connected to one CPU and one IPU then a Poplar process that is bound to CPU 1 will use CPU 1 to execute stream callbacks for IPUs on both NUMA node 0 and 1, so this function would return [-1, 1] whereas the getNumaTopology() would return [0, 1].

Note that if the look-up of available host NUMA nodes fails then this function will return a vector of -1s, with one element for each IPU.

std::vector<unsigned> getDriverIDs() const

Get the list of driver device IDs that make up this device.

void reset() const

Reset the device’s state.

Device createVirtualDevice(unsigned tilesPerIPU)

Create a virtual device with a restricted number of tiles per IPU.

This method provides a smaller “virtual” device whose target only shows a subset of the tiles on the underlying device.

The calling object becomes a null device (the underlying device is moved into the returned Device object).

inline core::Device &getImpl() const

Public Static Functions

static Device createCPUDevice(unsigned numOfIPUs = 1)

Create a device that executes vertex code on the host CPU.

This is only suitable for running small amounts of code; for example, for functional testing. It may not reproduce exactly the same functionality as running on an IPU. Also, functions such as Engine::getTileClockFrequency() may not return meaningful results.

Note that the number of IPUs in a CPU device must equal the top-level replication factor of the graph that will run on the device (1 IPU per replica).


numOfIPUs – The number of IPUs the device will have.

static Device createSimulatorDevice(const Target &target, const OptionFlags &options = {})

Private Members

Target target
std::unique_ptr<core::Device> impl
namespace core