Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
memory.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
20
21namespace shamalgs::memory {
22
23 template<class T>
24 T extract_element(sycl::queue &q, sycl::buffer<T> &buf, u32 idx) {
26 }
27
28 template<class T>
29 sycl::buffer<T> vec_to_buf(const std::vector<T> &vec) {
31 }
32
33 template<class T>
34 std::vector<T> buf_to_vec(sycl::buffer<T> &buf, u32 len) {
35 return details::Fallback<T>::buf_to_vec(buf, len);
36 }
37
38#define XMAC_TYPES \
39 X(f32) \
40 X(f32_2) \
41 X(f32_3) \
42 X(f32_4) \
43 X(f32_8) \
44 X(f32_16) \
45 X(f64) \
46 X(f64_2) \
47 X(f64_3) \
48 X(f64_4) \
49 X(f64_8) \
50 X(f64_16) \
51 X(u8) \
52 X(u32) \
53 X(u32_2) \
54 X(u32_3) \
55 X(u32_4) \
56 X(u32_8) \
57 X(u32_16) \
58 X(u64) \
59 X(u64_2) \
60 X(u64_3) \
61 X(u64_4) \
62 X(u64_8) \
63 X(u64_16) \
64 X(i64_3) \
65 X(i64)
66
67#define X(_arg_) \
68 template _arg_ extract_element(sycl::queue &q, sycl::buffer<_arg_> &buf, u32 idx); \
69 template sycl::buffer<_arg_> vec_to_buf(const std::vector<_arg_> &buf); \
70 template std::vector<_arg_> buf_to_vec(sycl::buffer<_arg_> &buf, u32 len);
71
72 XMAC_TYPES
73#undef X
74
75} // namespace shamalgs::memory
std::uint32_t u32
32 bit unsigned integer
memory manipulation algorithms
T extract_element(sycl::queue &q, sycl::buffer< T > &buf, u32 idx)
extract a value of a buffer
Definition memory.cpp:24
sycl::buffer< T > vec_to_buf(const std::vector< T > &buf)
Convert a std::vector to a sycl::buffer
Definition memory.cpp:29
std::vector< T > buf_to_vec(sycl::buffer< T > &buf, u32 len)
Convert a sycl::buffer to a std::vector
Definition memory.cpp:34