DeviceManager
#include <poplar/DeviceManager.hpp>
-
namespace poplar
Poplar classes and functions.
A VectorList is a list of vectors with a specific layout and with the usage semantics of a 2D vector.
A 1D vector must be laid out in a contiguous memory region. A 2D vector is a vector of 1D vectors. Each of these 1D vectors that make up a 2D vector is called a “sub-vector” for the remainder of this document. The elements of a 2D vector can be accessed by indexing the 2D vector along the
outer
andinner
dimensions asA[outer][inner]
.The following two categories of layouts are supported:
VectorListLayout::DELTANELEMENTS
is a memory efficient 2D vector layout. For legacy systemsVectorListLayout::DELTAN
served a similar purpose. Each sub-vector must be laid out as a contiguous memory region but the sub-vectors may may not be laid out contiguous with respect to each other in memory. Each sub-vector may have a different length.VectorListLayout::ONE_PTR
and otherVectorListLayout
layouts that are prefixed by SCALED_PTR are for Poplar runtime use only.
-
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::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.
-
DeviceManager()
-
namespace core