rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
cpu_device.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/hardware/device.hpp>
6
7#include <memory>
8
9namespace rexlib
10{
11namespace cpu
12{
13
14class thread_pool;
15
26class REXLIB_API cpu_device final
27 : public device
28{
29public:
37 explicit cpu_device(std::shared_ptr<thread_pool> pool = nullptr);
38 ~cpu_device() override;
39
40 const memory_resource&
42
43 std::shared_ptr<command_queue> create_command_queue() const override;
44
50 const std::shared_ptr<thread_pool>& get_thread_pool() const noexcept;
51
52private:
53 REXLIB_STD_MEMBER_INTERFACE
54 std::shared_ptr<thread_pool> m_pool;
55};
56
57} // namespace cpu
58} // namespace rexlib
Implementation of the device interface to represent the CPU.
Definition cpu_device.hpp:28
cpu_device(std::shared_ptr< thread_pool > pool=nullptr)
Construct a device over its own threads.
const memory_resource & get_memory_resource(memory_resource_affinity affinity) const override
Retrieve a memory resource by its affinity.
std::shared_ptr< command_queue > create_command_queue() const override
Create a new command queue on this device.
const std::shared_ptr< thread_pool > & get_thread_pool() const noexcept
Get the threads this device runs its programs over.
A fixed set of threads a loop's iterations are spread over.
Definition thread_pool.hpp:38
Abstract representation of a hardware compute device.
Definition device.hpp:26
Abstract description of a physical memory region.
Definition memory_resource.hpp:21
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
@ cpu
CPU of the host node.