Poplar and PopLibs
|
A device refers to a physical entity that can execute code. More...
#include <Device.hpp>
Public Member Functions | |
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. More... | |
bool | supportsRemoteBuffers () const |
Retrieve availability of remote buffers from the attached device. More... | |
bool | hasGateway () const |
Retrieve IPU-Gateway (such as in an IPU-M2000) availability from the attached device. More... | |
std::map< std::string, std::string > | getAttributes () const |
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. More... | |
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. More... | |
Static Public Member Functions | |
static Device | createCPUDevice (unsigned numOfIPUs=1) |
Create a device that executes vertex code on the host CPU. More... | |
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.
|
static |
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.
numOfIPUs | The number of IPUs the device will have. |
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).
Device poplar::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).
std::map< std::string, std::string > poplar::Device::getAttributes | ( | ) | const |
void poplar::Device::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.
std::vector< int > poplar::Device::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 -1
s, with one element for each IPU.
bool poplar::Device::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.
bool poplar::Device::supportsRemoteBuffers | ( | ) | const |
Retrieve availability of remote buffers from the attached device.
Throws if the device is not attached or is not an IPU device.