Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
reduction.hpp
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
10#pragma once
11
17
20
21namespace shamalgs::primitives {
22
54 template<class T>
55 T sum(
56 const sham::DeviceScheduler_ptr &sched,
57 const sham::DeviceBuffer<T> &buf1,
58 u32 start_id,
59 u32 end_id);
60
92 template<class T>
93 T min(
94 const sham::DeviceScheduler_ptr &sched,
95 const sham::DeviceBuffer<T> &buf1,
96 u32 start_id,
97 u32 end_id);
98
130 template<class T>
131 T max(
132 const sham::DeviceScheduler_ptr &sched,
133 const sham::DeviceBuffer<T> &buf1,
134 u32 start_id,
135 u32 end_id);
136
137} // namespace shamalgs::primitives
std::uint32_t u32
32 bit unsigned integer
namespace for primitive algorithm (e.g. sort, scan, reductions, ...)
T sum(const sham::DeviceScheduler_ptr &sched, const sham::DeviceBuffer< T > &buf1, u32 start_id, u32 end_id)
Compute the sum of elements in a device buffer within a specified range.
T min(const sham::DeviceScheduler_ptr &sched, const sham::DeviceBuffer< T > &buf1, u32 start_id, u32 end_id)
Find the minimum element in a device buffer within a specified range.
T max(const sham::DeviceScheduler_ptr &sched, const sham::DeviceBuffer< T > &buf1, u32 start_id, u32 end_id)
Find the maximum element in a device buffer within a specified range.