ClikaRT::Device
struct
Header: ClikaRT/compute/device.h
Compute device and backend-API identifiers.
A compute device: a backend API plus a device index (e.g. the 1 in CUDA device 1). Default-constructs to the whole-machine host CPU.
An accelerator index is zero-based and names one physical device. A CPU index instead names a SOCKET, with the whole machine at device::kWholeMachineCpuIndex, so Device::cpu() uses every core, while Device::cpu(0) confines work to socket 0's cores and its local memory.
Static member functions
cpu()
static constexpr Device cpu(std::int32_t i = device::kWholeMachineCpuIndex) noexcept
Named factories. cpu() is every core; cpu(i) is socket i.
Declared in ClikaRT/compute/device.h, line 73
cuda()
static constexpr Device cuda(std::int32_t i = 0) noexcept
The index-th CUDA device.
Declared in ClikaRT/compute/device.h, line 77
vulkan()
static constexpr Device vulkan(std::int32_t i = 0) noexcept
The index-th Vulkan device.
Declared in ClikaRT/compute/device.h, line 79
metal()
static constexpr Device metal(std::int32_t i = 0) noexcept
The index-th Metal device.
Declared in ClikaRT/compute/device.h, line 81
htp()
static constexpr Device htp(std::int32_t i = 0) noexcept
The index-th HTP (Hexagon) device.
Declared in ClikaRT/compute/device.h, line 83
tpu()
static constexpr Device tpu(std::int32_t i = 0) noexcept
The index-th TPU device.
Declared in ClikaRT/compute/device.h, line 85
gpu()
static Device gpu(std::int32_t index = 0)
The generic accelerator: the first backend, in priority order CUDA > TPU > Metal > Vulkan (each a candidate only in a build that carries its backend) that loads and exposes a device on THIS host (resolved at call time, not constexpr; HTP is an NPU and not part of "gpu"). When no GPU backend is available it falls back to cpu() and says so once at warning level on the "ClikaRT" logging channel, so generic code gets a usable device on any host. For explicit control use the per-API factories and backend_load_status (backends.h).
Declared in ClikaRT/compute/device.h, line 95
Member functions
Device()
constexpr constexpr Device() noexcept=default
Declared in ClikaRT/compute/device.h, line 61
Device(device::ComputeAPI, int32_t)
constexpr constexpr Device(device::ComputeAPI api_, std::int32_t index_) noexcept
A device from its api_ and index_ values.
Declared in ClikaRT/compute/device.h, line 63
Device(device::ComputeAPI)
constexpr constexpr Device(device::ComputeAPI api_) noexcept
An API with no index means that backend's default device: the whole machine on CPU, device 0 on an accelerator (which has no "whole machine").
Declared in ClikaRT/compute/device.h, line 68
is_cpu()
constexpr bool is_cpu() const noexcept
True for the CPU API.
Declared in ClikaRT/compute/device.h, line 98
is_cuda()
constexpr bool is_cuda() const noexcept
True for the CUDA API.
Declared in ClikaRT/compute/device.h, line 100
is_vulkan()
constexpr bool is_vulkan() const noexcept
True for the Vulkan API.
Declared in ClikaRT/compute/device.h, line 102
is_metal()
constexpr bool is_metal() const noexcept
True for the Metal API.
Declared in ClikaRT/compute/device.h, line 104
is_htp()
constexpr bool is_htp() const noexcept
True for the HTP API.
Declared in ClikaRT/compute/device.h, line 106
is_tpu()
constexpr bool is_tpu() const noexcept
True for the TPU API.
Declared in ClikaRT/compute/device.h, line 108
Data members
api
which accelerator API drives this device
Declared in ClikaRT/compute/device.h, line 58
index
std::int32_t index = device::kWholeMachineCpuIndex
ordinal within the API (CPU default = the whole machine)
Declared in ClikaRT/compute/device.h, line 59
Friends
operator==
True when a and b match in both api and index.
Declared in ClikaRT/compute/device.h, line 111
operator!=
True when a and b differ.
Declared in ClikaRT/compute/device.h, line 115