Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
sycl_direct_solver.hpp
Go to the documentation of this file.
1#pragma once
2
61
62#include <memory>
63#include <span>
64#include <string_view>
65
69#include "orrery/core/types.hpp"
73
74#ifdef ORRERY_ENABLE_SYCL
75
76namespace orrery::solvers {
77
100
107class SyclDirectSolver final : public ForceSolver {
108public:
121 [[nodiscard]] static std::unique_ptr<SyclDirectSolver>
123
124 ~SyclDirectSolver() override;
125
126 SyclDirectSolver(const SyclDirectSolver&) = delete;
127 SyclDirectSolver& operator=(const SyclDirectSolver&) = delete;
129 SyclDirectSolver& operator=(SyclDirectSolver&&) noexcept;
130
141 void evaluate(core::Vec3Span<const core::Real> positions, std::span<const core::Real> masses,
142 core::Vec3Span<core::Real> accelerations) override;
143
144 [[nodiscard]] std::string_view name() const noexcept override { return "sycl-direct"; }
145
146 [[nodiscard]] core::Softening softening() const noexcept override;
147
148 [[nodiscard]] InteractionCount interaction_count() const noexcept override;
149
150 void reset_interaction_count() noexcept override;
151
157 [[nodiscard]] const backend::DeviceDescription& device() const noexcept;
158
164 [[nodiscard]] core::Index tile_size() const noexcept;
165
167 [[nodiscard]] const SyclEvaluationTimings& timings() const noexcept;
168
176 [[nodiscard]] bool uses_shared_memory() const noexcept;
177
178private:
184 struct Impl;
185
186 explicit SyclDirectSolver(std::unique_ptr<Impl> impl) noexcept;
187
188 std::unique_ptr<Impl> impl_;
189};
190
191} // namespace orrery::solvers
192
193#endif // ORRERY_ENABLE_SYCL
The softening length of the Plummer kernel above.
Definition softening.hpp:49
Direct summation evaluated on a SYCL device.
Definition sycl_direct_solver.hpp:107
void reset_interaction_count() noexcept override
Set every counter back to zero.
bool uses_shared_memory() const noexcept
Whether the arrays the kernel reads are shared unified memory, asked of the runtime rather than assum...
InteractionCount interaction_count() const noexcept override
The work done since construction or since the last reset.
core::Index tile_size() const noexcept
How many sources are staged through local memory at a time, which is also the work-group size.
const backend::DeviceDescription & device() const noexcept
What the runtime says about the device this solver runs on.
std::string_view name() const noexcept override
The solver's name, for benchmark tables and test messages.
Definition sycl_direct_solver.hpp:144
static std::unique_ptr< SyclDirectSolver > try_create(core::Softening softening={})
A solver on this machine's GPU, or nothing.
const SyclEvaluationTimings & timings() const noexcept
Where the last evaluation spent its time.
core::Softening softening() const noexcept override
The softening this solver applies.
void evaluate(core::Vec3Span< const core::Real > positions, std::span< const core::Real > masses, core::Vec3Span< core::Real > accelerations) override
Write the acceleration at each position into accelerations.
What every gravitational force solver in this project provides.
The unit in which the cost of a force evaluation is reported.
Plummer softening, defined once for everything that needs it.
What a solver has done since the count was last reset.
Definition interaction_count.hpp:37
Where the last evaluation spent its time.
Definition sycl_direct_solver.hpp:88
backend::Duration staging_in
Copying positions and masses into the shared allocations, and zeroing the padded tail.
Definition sycl_direct_solver.hpp:91
backend::Duration staging_out
Copying the accelerations back out.
Definition sycl_direct_solver.hpp:98
backend::Duration kernel
Submitting the kernel and waiting for the device.
Definition sycl_direct_solver.hpp:95
Finding the GPU, and reporting what was found.
The scalar and index types that every layer of the project agrees on.
Three parallel component arrays, viewed as one sequence of 3-vectors.
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