Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
dot_sum.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
20#include "shambackends/vec.hpp"
21
22namespace shamalgs::primitives {
23
40 template<class T>
41 shambase::VecComponent<T> dot_sum(sham::DeviceBuffer<T> &buf1, u32 start_id, u32 end_id);
42
43 // alias for dot_sum(buf1, 0, buf1.get_size())
44 template<class T>
45 inline shambase::VecComponent<T> dot_sum(sham::DeviceBuffer<T> &buf1) {
46 return dot_sum(buf1, 0, buf1.get_size());
47 }
48
49} // namespace shamalgs::primitives
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
size_t get_size() const
Gets the number of elements in the buffer.
namespace for primitive algorithm (e.g. sort, scan, reductions, ...)
shambase::VecComponent< T > dot_sum(sham::DeviceBuffer< T > &buf1, u32 start_id, u32 end_id)
Compute the sum of dot products of elements in a device buffer with themselves.
Definition dot_sum.cpp:26