27#ifndef BACKEND_UTILS_H
28#define BACKEND_UTILS_H
37#include <sycl/sycl.hpp>
39#include <dpnp_iface_fptr.hpp>
45#ifndef __SYCL_COMPILER_VECTOR_ABS_CHANGED
46#define __SYCL_COMPILER_VECTOR_ABS_CHANGED 20230503L
52#ifndef __INTEL_MKL_2023_0_0_VERSION_REQUIRED
53#define __INTEL_MKL_2023_0_0_VERSION_REQUIRED 20230000
62#ifndef __INTEL_MKL_2023_2_0_VERSION_REQUIRED
63#define __INTEL_MKL_2023_2_0_VERSION_REQUIRED 20230002L
84static inline void validate_type_for_device(
const sycl::device &d)
86 if constexpr (std::is_same_v<T, double>) {
87 if (!d.has(sycl::aspect::fp64)) {
88 throw std::runtime_error(
"Device " +
89 d.get_info<sycl::info::device::name>() +
90 " does not support type 'double'");
93 else if constexpr (std::is_same_v<T, std::complex<double>>) {
94 if (!d.has(sycl::aspect::fp64)) {
95 throw std::runtime_error(
96 "Device " + d.get_info<sycl::info::device::name>() +
97 " does not support type 'complex<double>'");
100 else if constexpr (std::is_same_v<T, sycl::half>) {
101 if (!d.has(sycl::aspect::fp16)) {
102 throw std::runtime_error(
"Device " +
103 d.get_info<sycl::info::device::name>() +
104 " does not support type 'half'");
120static inline void validate_type_for_device(
const sycl::queue &q)
122 validate_type_for_device<T>(q.get_device());
134std::ostream &
operator<<(std::ostream &out,
const std::vector<T> &vec)
136 std::string delimiter;
141 for (
auto &elem : vec) {
142 out << delimiter << elem;
143 if (delimiter.empty()) {
144 delimiter.assign(
", ");
164 out << static_cast<size_t>(elem);
DPNPFuncType
Template types which are used in this interface.
std::ostream & operator<<(std::ostream &out, const std::vector< T > &vec)
print std::vector to std::ostream.