|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Immutable aggregate of a device handle and its associated objects. More...
#include <rexlib/core/hardware/device_session.hpp>
Public Member Functions | |
| device_session (std::shared_ptr< device > dev, device_properties properties) | |
Construct an session wrapping dev. | |
| device_session (const device_session &other)=delete | |
| device_session (device_session &&other)=delete | |
| device_session & | operator= (const device_session &other)=delete |
| device_session & | operator= (device_session &&other)=delete |
| const std::shared_ptr< device > & | get_device () const noexcept |
| Retrieve the wrapped device handle. | |
| const device_properties & | get_properties () const noexcept |
| Retrieve the static properties of the wrapped device. | |
| const std::shared_ptr< memory_allocator > & | get_allocator (memory_resource_affinity affinity) const noexcept |
| Retrieve the allocator for the given affinity. | |
| const std::shared_ptr< command_queue > & | get_default_queue () const noexcept |
| Retrieve the default command queue of this session. | |
Immutable aggregate of a device handle and its associated objects.
A device_session bundles a device handle with the objects needed to make it usable: the static device_properties describing it, a memory_allocator selected for each memory_resource_affinity, and a default command_queue created from the device. All of these are resolved once at construction and remain fixed for the lifetime of the session.
| rexlib::device_session::device_session | ( | std::shared_ptr< device > | dev, |
| device_properties | properties | ||
| ) |
Construct an session wrapping dev.
Stores dev and properties and builds the allocator for each memory_resource_affinity by querying dev for the matching memory resource.
| dev | Device to wrap. Must not be null. |
| properties | Static properties describing dev. Taken by value and moved into the session. |
| std::invalid_argument | if dev is null. |
| std::runtime_error | if a required memory_resource_affinity has no suitable resource on dev. |
|
noexcept |
Retrieve the allocator for the given affinity.
The returned allocator is the one selected at construction for affinity and lives as long as this device_session.
| affinity | The desired memory_resource_affinity (host or device). |
affinity.
|
noexcept |
Retrieve the default command queue of this session.
Retrieve the wrapped device handle.
|
noexcept |
Retrieve the static properties of the wrapped device.