Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
serial_executor.hpp
Go to the documentation of this file.
1#pragma once
2
25
26#include <cstdint>
27#include <string_view>
28
32#include "orrery/core/types.hpp"
33
34namespace orrery::backend {
35
37class SerialExecutor final : public Executor {
38public:
39 SerialExecutor() = default;
40
41 void run(core::Index count, RangeTask task) override;
42
43 [[nodiscard]] std::string_view name() const noexcept override { return "serial"; }
44
45 [[nodiscard]] unsigned worker_count() const noexcept override { return 1; }
46
49 [[nodiscard]] CoreClass worker_core_class(unsigned /*worker*/) const noexcept override {
51 }
52
53 [[nodiscard]] ExecutorStatistics statistics() const override;
54
55 void reset_statistics() noexcept override;
56
57private:
58 WorkerStatistics worker_;
59 Duration elapsed_{};
60 std::uint64_t regions_{};
61};
62
63} // namespace orrery::backend
ExecutorStatistics statistics() const override
The record of what the workers have done since the last reset.
CoreClass worker_core_class(unsigned) const noexcept override
Always unknown.
Definition serial_executor.hpp:49
std::string_view name() const noexcept override
The scheme's name, for benchmark tables and reports.
Definition serial_executor.hpp:43
void run(core::Index count, RangeTask task) override
Call task over pieces that together cover [0, count) exactly once each, and return when all of them h...
void reset_statistics() noexcept override
Set every counter back to zero.
unsigned worker_count() const noexcept override
How many workers this executor divides work between.
Definition serial_executor.hpp:45
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
@ kUnknown
The platform does not distinguish, or the machine is homogeneous.
Definition cpu_topology.hpp:49
How a kernel asks for a loop to be run in parallel.
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
The whole pool's record.
Definition worker_statistics.hpp:99
One worker's record, accumulated over every region since the last reset.
Definition worker_statistics.hpp:56
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.
std::chrono::nanoseconds Duration
Durations are stored in nanoseconds so that they add without conversion and mean the same thing on ev...
Definition worker_statistics.hpp:53