rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
memory_resource.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <memory>
6
7#include <rexlib/core/platform/dynamic_shared_object.h>
8
9#include "memory_resource_kind.hpp"
10
11namespace rexlib
12{
13
14class memory_allocator;
15class device;
16
20class REXLIB_API memory_resource
21{
22public:
23 memory_resource() noexcept;
24 memory_resource(const memory_resource &other) = delete;
25 memory_resource(memory_resource &&other) = delete;
26 virtual ~memory_resource();
27
28 memory_resource& operator=(const memory_resource &other) = delete;
29 memory_resource& operator=(memory_resource &&other) = delete;
30
40 virtual
41 memory_resource_kind get_kind() const noexcept = 0;
42
51 virtual
52 std::shared_ptr<memory_allocator> create_allocator() const = 0;
53};
54
64REXLIB_API
65const memory_resource& get_host_memory_resource() noexcept;
66
67} // namespace rexlib
Abstract allocator of buffer objects on a memory_resource.
Definition memory_allocator.hpp:30
Abstract description of a physical memory region.
Definition memory_resource.hpp:21
virtual memory_resource_kind get_kind() const noexcept=0
Get the kind of memory this resource represents.
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
@ device
The memory resource can be optimally accessed by the device.
memory_resource_kind
Describes the nature of a memory resource.
Definition memory_resource_kind.hpp:14