Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
compute_histogram.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
15
18
20
22 [](const sham::DeviceScheduler_ptr &dev_sched, auto &self) {
23 if (dev_sched->ctx->device->prop.type == sham::DeviceType::GPU) {
24 self.set(GpuOversubscribe{});
25 } else {
26 self.set(NaiveGpu{}); // it is portable and fast everywhere
27 }
28 }};
29
30 // Must come after the global it registers: same TU, so it is initialized after it
32
33} // namespace shamalgs::primitives::impl
Name-keyed registry of the implementation selectors (IImplVariant) of every algorithm.
#define SHAMALGS_REGISTER_IMPL(name, impl)
Register the implementation selector impl under name at static initialization.
namespace to control implementation behavior
shamalgs::ImplVariantGlobal< Reference, NaiveGpu, GpuTeamFetching, GpuOversubscribe > ComputeHistogramImpl
Implementation selector type for compute_histogram.
constexpr std::string_view compute_histogram_impl_name
Registry name, shared by its registration and the dispatch site(s).
ComputeHistogramImpl compute_histogram_impl
Implementation selector for compute_histogram (defined in compute_histogram.cpp).
GPU kernel oversubscribing a work-group per bin, reducing locally.
Portable GPU kernel, one work-item per bin.