Orrery
A GPU-accelerated N-body gravitational simulator
Toggle main menu visibility
Loading...
Searching...
No Matches
executor.hpp
Go to the documentation of this file.
1
#pragma once
2
33
34
#include <string_view>
35
36
#include "
orrery/backend/cpu_topology.hpp
"
37
#include "
orrery/backend/worker_statistics.hpp
"
38
#include "
orrery/core/function_ref.hpp
"
39
#include "
orrery/core/types.hpp
"
40
41
namespace
orrery::backend {
42
49
using
RangeTask
=
core::FunctionRef
<void(
core::Index
,
core::Index
)>;
50
52
class
Executor {
53
public
:
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
99
protected:
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
orrery::backend::Executor::worker_count
virtual unsigned worker_count() const noexcept=0
How many workers this executor divides work between.
orrery::backend::Executor::run
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...
orrery::backend::Executor::worker_core_class
virtual CoreClass worker_core_class(unsigned worker) const noexcept=0
What kind of core a worker runs on, where that is known.
orrery::backend::Executor::statistics
virtual ExecutorStatistics statistics() const =0
The record of what the workers have done since the last reset.
orrery::backend::Executor::name
virtual std::string_view name() const noexcept=0
The scheme's name, for benchmark tables and reports.
orrery::backend::Executor::reset_statistics
virtual void reset_statistics() noexcept=0
Set every counter back to zero.
orrery::core::FunctionRef
Definition
function_ref.hpp:36
cpu_topology.hpp
Which logical processors this machine has, and which of them are fast.
orrery::backend::CoreClass
CoreClass
What kind of core a logical processor belongs to.
Definition
cpu_topology.hpp:47
orrery::backend::RangeTask
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
function_ref.hpp
A non-owning reference to something callable.
orrery::backend::ExecutorStatistics
The whole pool's record.
Definition
worker_statistics.hpp:99
types.hpp
The scalar and index types that every layer of the project agrees on.
orrery::core::Index
std::size_t Index
The type of a particle index and of any count of particles.
Definition
types.hpp:45
worker_statistics.hpp
What each worker thread did, and how long it spent doing nothing.
orrery
backend
executor.hpp
Generated by
1.17.0