28 [[deprecated(
"please use the shamalgs library instead")]]
29 inline T get_max(sycl::queue &queue,
const std::unique_ptr<sycl::buffer<T>> &buf,
u32 len) {
34 accum = buf->get_host_access()[0];
37 sycl::host_accessor acc{*buf, sycl::read_only};
48 for (
u32 i = 0; i < len; i++) {
49 accum = sycl::max(accum, acc[i]);
54 "syclalg::get_max : input buffer not allocated");
61 [[deprecated(
"please use the shamalgs library instead")]]
81 for (
u32 i = 0; i < len; i++) {
82 accum = sycl::max(accum, vec[i]);
87 "syclalg::get_max : input buffer not allocated");
95 [[deprecated(
"please use the shamalgs library instead")]]
96 inline T get_min(sycl::queue &queue,
const std::unique_ptr<sycl::buffer<T>> &buf,
u32 len) {
102 accum = buf->get_host_access()[0];
105 sycl::host_accessor acc{*buf, sycl::read_only};
116 for (
u32 i = 0; i < len; i++) {
117 accum = sycl::min(accum, acc[i]);
123 "syclalg::get_min : input buffer not allocated");
130 [[deprecated(
"please use the shamalgs library instead")]]
150 for (
u32 i = 0; i < len; i++) {
151 accum = sycl::min(accum, vec[i]);
156 "syclalg::get_min : input buffer not allocated");
163 [[deprecated(
"please use the shamalgs library instead")]]
164 inline std::tuple<T, T> get_min_max(
165 sycl::queue &queue,
const std::unique_ptr<sycl::buffer<T>> &buf,
u32 len) {
167 T accum_min, accum_max;
171 accum_min = buf->get_host_access()[0];
172 accum_max = buf->get_host_access()[0];
175 sycl::host_accessor acc{*buf, sycl::read_only};
186 for (
u32 i = 0; i < len; i++) {
187 accum_min = sycl::min(accum_min, acc[i]);
188 accum_max = sycl::max(accum_max, acc[i]);
194 "syclalg::get_max : input buffer not allocated");
197 return {accum_min, accum_max};
201 [[deprecated(
"please use the shamalgs library instead")]]
204 T accum_min, accum_max;
209 auto accum_min = vec[0];
210 auto accum_max = vec[0];
223 for (
u32 i = 0; i < len; i++) {
224 accum_min = sycl::min(accum_min, vec[i]);
225 accum_max = sycl::max(accum_max, vec[i]);
231 "syclalg::get_max : input buffer not allocated");
234 return {accum_min, accum_max};
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
std::vector< T > copy_to_stdvec() const
Copy the content of the buffer to a std::vector.
bool is_empty() const
Check if the buffer is empty.
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.