rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::device_properties Class Reference

Description of the static characteristics of a physical device visible from the host. More...

#include <rexlib/core/hardware/device_properties.hpp>

Public Member Functions

 device_properties (const device_properties &other)
 
 device_properties (device_properties &&other) noexcept
 
device_properties & operator= (const device_properties &other)
 
device_properties & operator= (device_properties &&other) noexcept
 
void set_type (device_type type)
 Set the device type.
 
device_type get_type () const noexcept
 Get the device type.
 
void set_name (const std::string &name)
 Set the device name.
 
const std::string & get_name () const noexcept
 Get the device name.
 
void set_physical_location (const std::string &location)
 Set the physical location of the device.
 
const std::string & get_physical_location () const noexcept
 Get the physical location of the device.
 
void set_total_memory_bytes (std::size_t bytes)
 Set the total memory of the device in bytes.
 
std::size_t get_total_memory_bytes () const noexcept
 Get the total memory of the device in bytes.
 
void set_optimal_data_alignment (std::size_t alignment)
 Set the optimal data alignment.
 
std::size_t get_optimal_data_alignment () const noexcept
 Get the optimal data alignment.
 

Detailed Description

Description of the static characteristics of a physical device visible from the host.

device_properties is a value-type container populated by a device_backend (typically via device_backend::get_device_properties) and consumed by callers that need to inspect a device without instantiating it. Instances are copyable and movable and use the pimpl idiom, so the binary representation is owned by the implementation and unrelated to the size of this class.

Member Function Documentation

◆ get_name()

const std::string & rexlib::device_properties::get_name ( ) const
noexcept

Get the device name.

Returns
const std::string& The device name, or an empty string if none has been set. The reference is valid until the next non-const operation on this object.

◆ get_optimal_data_alignment()

std::size_t rexlib::device_properties::get_optimal_data_alignment ( ) const
noexcept

Get the optimal data alignment.

Returns
std::size_t The optimal data alignment in bytes, or zero if no value has been set.

◆ get_physical_location()

const std::string & rexlib::device_properties::get_physical_location ( ) const
noexcept

Get the physical location of the device.

Usually this is a PCI address; see set_physical_location for the format conventions.

Returns
const std::string& The physical location of the device, or an empty string if none has been set. The reference is valid until the next non-const operation on this object.

◆ get_total_memory_bytes()

std::size_t rexlib::device_properties::get_total_memory_bytes ( ) const
noexcept

Get the total memory of the device in bytes.

Returns
std::size_t Number of bytes, or zero if the value has not been set by the backend.

◆ get_type()

device_type rexlib::device_properties::get_type ( ) const
noexcept

Get the device type.

Returns
device_type The device type, or device_type::unknown if no value has been set.

◆ set_name()

void rexlib::device_properties::set_name ( const std::string &  name)

Set the device name.

The name is meant to be a human-readable identifier suitable for display (e.g. the model reported by the vendor driver) and is not required to be unique.

Parameters
[in]nameThe device name.

◆ set_optimal_data_alignment()

void rexlib::device_properties::set_optimal_data_alignment ( std::size_t  alignment)

Set the optimal data alignment.

Buffers aligned to this boundary typically yield the best throughput on this device (e.g. SIMD width on CPUs, coalesced access boundary on GPUs). The value should be a power of two.

Parameters
[in]alignmentThe optimal data alignment in bytes.

◆ set_physical_location()

void rexlib::device_properties::set_physical_location ( const std::string &  location)

Set the physical location of the device.

Usually this is a PCI address but the format is backend defined and intended only for diagnostics and matching against external tooling.

Parameters
[in]locationThe physical location of the device.

◆ set_total_memory_bytes()

void rexlib::device_properties::set_total_memory_bytes ( std::size_t  bytes)

Set the total memory of the device in bytes.

This is the total amount of memory that the device exposes to the framework, not the currently free amount, and represents an upper bound for how much can ever be allocated on it.

Parameters
[in]bytesNumber of bytes.

◆ set_type()

void rexlib::device_properties::set_type ( device_type  type)

Set the device type.

Classifies the device into one of the broad categories defined by device_type (CPU, discrete GPU, integrated GPU, etc.). Used by higher-level dispatch logic to pick reasonable defaults without knowing the specific backend.

Parameters
[in]typeThe device type.

The documentation for this class was generated from the following file: