batchlas::Device Struct Reference

Overview

A handle to one SYCL device: its type and its index among devices of that type.

Queue ctx(gpus.at(1)); // the second GPU
Queue cpu("cpu"); // the first CPU device
static std::vector< Device > get_devices(DeviceType type)
Every device of type, in the SYCL runtime's order.
Where BatchLAS work runs: a device, a backend, an ordered SYCL queue and a workspace arena.

Definition at line 179 of file sycl-device-queue.hh.

#include <batchlas/util/sycl-device-queue.hh>

Constructors

◆ Device() [1/4]

batchlas::Device::Device ( )
default

The host device (index 0).

◆ Device() [2/4]

batchlas::Device::Device ( size_t idx,
DeviceType type )
inline

The idx-th device of type, as numbered by get_devices().

Definition at line 187 of file sycl-device-queue.hh.

◆ Device() [3/4]

batchlas::Device::Device ( std::string type)
inline

The first device of the named type.

Parameters
type"cpu", "gpu" or "accelerator" (case-insensitive)
Exceptions
batchlas::device_errorif no device of that type exists
batchlas::invalid_argumentfor any other string

Definition at line 193 of file sycl-device-queue.hh.

◆ Device() [4/4]

batchlas::Device::Device ( const char * type)
inline

As Device(std::string).

Definition at line 211 of file sycl-device-queue.hh.

Functions

◆ get_devices()

std::vector< Device > batchlas::Device::get_devices ( DeviceType type)
static

Every device of type, in the SYCL runtime's order.

◆ default_device()

Device batchlas::Device::default_device ( )
inlinestatic

The first GPU, else the first CPU, else the host device.

Definition at line 214 of file sycl-device-queue.hh.

◆ default_device_for()

template<typename T>
Device batchlas::Device::default_device_for ( )
inlinestatic

default_device(), except the first CPU device for a double or complex<double> T when that default is a GPU without fp64 (an Apple GPU), which cannot run T kernels.

Definition at line 227 of file sycl-device-queue.hh.

◆ get_name()

std::string batchlas::Device::get_name ( ) const

The device's name as reported by SYCL.

◆ get_vendor()

Vendor batchlas::Device::get_vendor ( ) const

The device's vendor.

◆ get_property()

size_t batchlas::Device::get_property ( DeviceProperty property) const

The value of one device property (units as documented on DeviceProperty).

◆ supports_sub_group_size()

bool batchlas::Device::supports_sub_group_size ( size_t size) const

True when size is one of the device's supported sub-group sizes.

◆ cuda_compute_capability()

int batchlas::Device::cuda_compute_capability ( ) const

CUDA compute capability as major*10+minor (89 = sm_89, 120 = sm_120), or 0 for a non-CUDA device.

Memoized per device. Kernel selection derives its device key from it (sm_89), which picks the per-device table in tuned/.

◆ supports_fp64()

bool batchlas::Device::supports_fp64 ( ) const

True when the device runs double-precision kernels (sycl::aspect::fp64).

Memoized per device. False on Apple GPUs, where a Backend::SYCL build without BATCHLAS_HAS_DEVICE_FP64 has no double or complex<double> kernels.

Variables

◆ idx

size_t batchlas::Device::idx = 0

Index among devices of type.

Definition at line 263 of file sycl-device-queue.hh.

◆ type

DeviceType batchlas::Device::type = DeviceType::HOST

The device's type.

Definition at line 264 of file sycl-device-queue.hh.