Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::backend::Executor Class Referenceabstract

Something that can run a loop body over a range, possibly in parallel. More...

#include <orrery/backend/executor.hpp>

Inheritance diagram for orrery::backend::Executor:
orrery::backend::SerialExecutor orrery::backend::StaticExecutor orrery::backend::WorkStealingExecutor

Public Member Functions

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 have finished.
virtual std::string_view name () const noexcept=0
 The scheme's name, for benchmark tables and reports.
virtual unsigned worker_count () const noexcept=0
 How many workers this executor divides work between.
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 void reset_statistics () noexcept=0
 Set every counter back to zero.

Protected Member Functions

 Executor (const Executor &)=default
 Executor (Executor &&)=default
Executor & operator= (const Executor &)=default
Executor & operator= (Executor &&)=default

Detailed Description

Something that can run a loop body over a range, possibly in parallel.

Member Function Documentation

◆ run()

virtual void orrery::backend::Executor::run ( core::Index count,
RangeTask task )
pure virtual

Call task over pieces that together cover [0, count) exactly once each, and return when all of them have finished.

The division is the implementation's to choose, and so is the number of threads it uses and the order the pieces run in. A caller may rely on each index being covered exactly once and on all the work being complete on return, and on nothing else.

A count of zero runs nothing. An empty configuration is a configuration, and it reaches the solvers by the same path as any other.

Implemented in orrery::backend::SerialExecutor, orrery::backend::StaticExecutor, and orrery::backend::WorkStealingExecutor.

◆ name()

virtual std::string_view orrery::backend::Executor::name ( ) const
nodiscardpure virtualnoexcept

The scheme's name, for benchmark tables and reports.

Implemented in orrery::backend::SerialExecutor, orrery::backend::StaticExecutor, and orrery::backend::WorkStealingExecutor.

◆ worker_count()

virtual unsigned orrery::backend::Executor::worker_count ( ) const
nodiscardpure virtualnoexcept

How many workers this executor divides work between.

Implemented in orrery::backend::SerialExecutor, orrery::backend::StaticExecutor, and orrery::backend::WorkStealingExecutor.

◆ worker_core_class()

virtual CoreClass orrery::backend::Executor::worker_core_class ( unsigned worker) const
nodiscardpure virtualnoexcept

What kind of core a worker runs on, where that is known.

kUnknown unless the executor pinned its workers, because without pinning the operating system is free to move a thread between a performance and an efficiency core mid-region, and an answer that described where the thread started would be a guess about where it spent its time. Phase 6's per-core-class figures come from pinned runs for exactly this reason.

Implemented in orrery::backend::SerialExecutor, orrery::backend::StaticExecutor, and orrery::backend::WorkStealingExecutor.

◆ statistics()

virtual ExecutorStatistics orrery::backend::Executor::statistics ( ) const
nodiscardpure virtual

The record of what the workers have done since the last reset.

Safe to call only when no region is running, which for a single submitting thread means any time run is not on the stack. It copies the per-worker records rather than returning a view of them, because a caller comparing two schemes needs the first scheme's numbers to survive the second scheme running.

Implemented in orrery::backend::SerialExecutor, orrery::backend::StaticExecutor, and orrery::backend::WorkStealingExecutor.

◆ reset_statistics()

virtual void orrery::backend::Executor::reset_statistics ( )
pure virtualnoexcept

Set every counter back to zero.

A benchmark measures the region it timed rather than the warm-up before it, and once the two have been added together they cannot be separated.

Implemented in orrery::backend::SerialExecutor, orrery::backend::StaticExecutor, and orrery::backend::WorkStealingExecutor.


The documentation for this class was generated from the following file: