Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
executor.hpp
Go to the documentation of this file.
1#pragma once
2
33
34#include <string_view>
35
39#include "orrery/core/types.hpp"
40
41namespace orrery::backend {
42
50
52class Executor {
53public:
54 virtual ~Executor() = default;
55
66 virtual void run(core::Index count, RangeTask task) = 0;
67
69 [[nodiscard]] virtual std::string_view name() const noexcept = 0;
70
72 [[nodiscard]] virtual unsigned worker_count() const noexcept = 0;
73
82 [[nodiscard]] virtual CoreClass worker_core_class(unsigned worker) const noexcept = 0;
83
91 [[nodiscard]] virtual ExecutorStatistics statistics() const = 0;
92
97 virtual void reset_statistics() noexcept = 0;
98
99protected:
100 // As on the other interfaces in this project: a class with a virtual
101 // destructor suppresses the implicit copy and move operations, and copying
102 // an implementation through a reference to this base would slice it.
103 Executor() = default;
104 Executor(const Executor&) = default;
105 Executor(Executor&&) = default;
106 Executor& operator=(const Executor&) = default;
107 Executor& operator=(Executor&&) = default;
108};
109
110} // namespace orrery::backend
virtual unsigned worker_count() const noexcept=0
How many workers this executor divides work between.
virtual void run(core::Index count, RangeTask task)=0
Call task over pieces that together cover [0, count) exactly once each, and return when all of them h...
virtual CoreClass worker_core_class(unsigned worker) const noexcept=0
What kind of core a worker runs on, where that is known.
virtual ExecutorStatistics statistics() const =0
The record of what the workers have done since the last reset.
virtual std::string_view name() const noexcept=0
The scheme's name, for benchmark tables and reports.
virtual void reset_statistics() noexcept=0
Set every counter back to zero.
Definition function_ref.hpp:36
Which logical processors this machine has, and which of them are fast.
CoreClass
What kind of core a logical processor belongs to.
Definition cpu_topology.hpp:47
core::FunctionRef< void(core::Index, core::Index)> RangeTask
A piece of a parallel loop: the half-open index range [begin, end).
Definition executor.hpp:49
A non-owning reference to something callable.
The whole pool's record.
Definition worker_statistics.hpp:99
The scalar and index types that every layer of the project agrees on.
std::size_t Index
The type of a particle index and of any count of particles.
Definition types.hpp:45
What each worker thread did, and how long it spent doing nothing.