rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
device_session.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include "device_properties.hpp"
6#include "memory_resource_affinity.hpp"
7#include "../platform/dynamic_shared_object.h"
8
9#include <memory>
10
11namespace rexlib
12{
13
14class device;
15class memory_allocator;
16class command_queue;
17
29{
30public:
46 REXLIB_API
48 std::shared_ptr<device> dev,
49 device_properties properties
50 );
51 device_session(const device_session &other) = delete;
52 device_session(device_session &&other) = delete;
53 REXLIB_API
55
56 device_session& operator=(const device_session &other) = delete;
57 device_session& operator=(device_session &&other) = delete;
58
64 REXLIB_API
65 const std::shared_ptr<device>& get_device() const noexcept;
66
72 REXLIB_API
73 const device_properties& get_properties() const noexcept;
74
84 REXLIB_API
85 const std::shared_ptr<memory_allocator>&
86 get_allocator(memory_resource_affinity affinity) const noexcept;
87
95 REXLIB_API
96 const std::shared_ptr<command_queue>& get_default_queue() const noexcept;
97
98private:
99 class implementation;
100 std::unique_ptr<implementation> m_implementation;
101};
102
103} // namespace rexlib
Abstract command queue belonging to a device.
Definition command_queue.hpp:27
Description of the static characteristics of a physical device visible from the host.
Definition device_properties.hpp:27
Immutable aggregate of a device handle and its associated objects.
Definition device_session.hpp:29
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< command_queue > & get_default_queue() const noexcept
Retrieve the default command queue of this session.
const std::shared_ptr< memory_allocator > & get_allocator(memory_resource_affinity affinity) const noexcept
Retrieve the allocator for the given affinity.
device_session(std::shared_ptr< device > dev, device_properties properties)
Construct an session wrapping dev.
Abstract allocator of buffer objects on a memory_resource.
Definition memory_allocator.hpp:30
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
memory_resource_affinity
Enumeration to query memory_resource according to its intended usage.
Definition memory_resource_affinity.hpp:12
@ device
The memory resource can be optimally accessed by the device.