Poplar and PopLibs
DeviceManager.hpp
1// Copyright (c) 2018 Graphcore Ltd. All rights reserved.
2
3#ifndef poplar_DeviceManager_hpp
4#define poplar_DeviceManager_hpp
5
6#include <poplar/Device.hpp>
7#include <poplar/OptionFlags.hpp>
8
9namespace poplar {
10
11namespace core {
12class DeviceManagerImpl;
13}
14
31public:
34 DeviceManager(DeviceManager &&) noexcept;
35 virtual ~DeviceManager();
36
38 std::size_t getNumDevices() const;
39
41 std::vector<Device> getDevices(const OptionFlags &opts = {}) const;
42
55 std::vector<Device> getDevices(TargetType type, unsigned requiredNumIPUs,
56 const OptionFlags &opts = {}) const;
57
65 Device getDevice(unsigned deviceManagerId,
66 const OptionFlags &opts = {}) const;
67
77 std::vector<unsigned>
78 getChildDeviceIds(unsigned parentId, unsigned numChildDeviceIpus = 1) const;
79
82
83private:
84 std::unique_ptr<core::DeviceManagerImpl> impl;
85};
86
87} // end namespace poplar
88
89#endif // poplar_DeviceManager_hpp
A DeviceManager is able to enumerate and return groups of physical IPUs connected to an entity/host.
Definition: DeviceManager.hpp:30
Device getDevice(unsigned deviceManagerId, const OptionFlags &opts={}) const
Get a specific device by its device manager id.
std::vector< Device > getDevices(TargetType type, unsigned requiredNumIPUs, const OptionFlags &opts={}) const
Get the list of all devices fulfilling the specified criteria.
std::vector< unsigned > getChildDeviceIds(unsigned parentId, unsigned numChildDeviceIpus=1) const
Get the deviceIds of the child devices of a multi-IPU device.
std::vector< Device > getDevices(const OptionFlags &opts={}) const
Get the list of all devices.
static DeviceManager createDeviceManager()
Create a device manager for the current host.
std::size_t getNumDevices() const
Get the number of devices attached to this host.
A device refers to a physical entity that can execute code.
Definition: Device.hpp:26
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
Poplar classes and functions.
Definition: ArrayRef.hpp:14
TargetType
Enum to represent the type of a device capable of running a graph.
Definition: TargetType.hpp:10