Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
reduction_alg.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
19#include "shambackends/sycl.hpp"
20#include <memory>
21#include <vector>
22
48template<class u_morton>
50 // in
51 sycl::queue &queue,
52 u32 morton_count,
53 std::unique_ptr<sycl::buffer<u_morton>> &buf_morton,
54 u32 reduction_level,
55 // out
56 std::unique_ptr<sycl::buffer<u32>> &buf_reduc_index_map,
57 u32 &morton_leaf_count);
58
76template<class u_morton>
78 // in
79 sycl::queue &queue,
80 u32 morton_leaf_count,
81 std::unique_ptr<sycl::buffer<u32>> &buf_reduc_index_map,
82 std::unique_ptr<sycl::buffer<u_morton>> &buf_morton,
83 // out
84 std::unique_ptr<sycl::buffer<u_morton>> &buf_leaf_morton);
85
95template<class split_int>
97 sham::DeviceBuffer<split_int> buf_reduc_index_map;
98 u32 morton_leaf_count;
99};
100
127template<class u_morton>
129 const sham::DeviceScheduler_ptr &dev_sched,
130 u32 morton_count,
132 u32 reduction_level);
133
151template<class u_morton>
153 // in
154 sham::DeviceQueue &queue,
155 u32 morton_leaf_count,
156 sham::DeviceBuffer<u32> &buf_reduc_index_map,
158 // out
159 sham::DeviceBuffer<u_morton> &buf_leaf_morton);
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
A SYCL queue associated with a device and a context.
void sycl_morton_remap_reduction(sycl::queue &queue, u32 morton_leaf_count, std::unique_ptr< sycl::buffer< u32 > > &buf_reduc_index_map, std::unique_ptr< sycl::buffer< u_morton > > &buf_morton, std::unique_ptr< sycl::buffer< u_morton > > &buf_leaf_morton)
Remaps a Morton tree on device using a reduction index map.
void reduction_alg(sycl::queue &queue, u32 morton_count, std::unique_ptr< sycl::buffer< u_morton > > &buf_morton, u32 reduction_level, std::unique_ptr< sycl::buffer< u32 > > &buf_reduc_index_map, u32 &morton_leaf_count)
Reduces a Morton tree on device.
Return type of reduction algorithms.