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
74static inline void validate_type_for_device(
const sycl::device &d)
76 if constexpr (std::is_same_v<T, double>) {
77 if (!d.has(sycl::aspect::fp64)) {
78 throw std::runtime_error(
"Device " +
79 d.get_info<sycl::info::device::name>() +
80 " does not support type 'double'");
83 else if constexpr (std::is_same_v<T, std::complex<double>>) {
84 if (!d.has(sycl::aspect::fp64)) {
85 throw std::runtime_error(
86 "Device " + d.get_info<sycl::info::device::name>() +
87 " does not support type 'complex<double>'");
90 else if constexpr (std::is_same_v<T, sycl::half>) {
91 if (!d.has(sycl::aspect::fp16)) {
92 throw std::runtime_error(
"Device " +
93 d.get_info<sycl::info::device::name>() +
94 " does not support type 'half'");
110static inline void validate_type_for_device(
const sycl::queue &q)
112 validate_type_for_device<T>(q.get_device());
124std::ostream &
operator<<(std::ostream &out,
const std::vector<T> &vec)
126 std::string delimiter;
131 for (
auto &elem : vec) {
132 out << delimiter << elem;
133 if (delimiter.empty()) {
134 delimiter.assign(
", ");
154 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.