30#ifndef BACKEND_UTILS_H
31#define BACKEND_UTILS_H
40#include <sycl/sycl.hpp>
42#include <dpnp_iface_fptr.hpp>
48#ifndef __SYCL_COMPILER_VECTOR_ABS_CHANGED
49#define __SYCL_COMPILER_VECTOR_ABS_CHANGED 20230503L
55#ifndef __INTEL_MKL_2023_0_0_VERSION_REQUIRED
56#define __INTEL_MKL_2023_0_0_VERSION_REQUIRED 20230000
77static inline void validate_type_for_device(
const sycl::device &d)
79 if constexpr (std::is_same_v<T, double>) {
80 if (!d.has(sycl::aspect::fp64)) {
81 throw std::runtime_error(
"Device " +
82 d.get_info<sycl::info::device::name>() +
83 " does not support type 'double'");
86 else if constexpr (std::is_same_v<T, std::complex<double>>) {
87 if (!d.has(sycl::aspect::fp64)) {
88 throw std::runtime_error(
89 "Device " + d.get_info<sycl::info::device::name>() +
90 " does not support type 'complex<double>'");
93 else if constexpr (std::is_same_v<T, sycl::half>) {
94 if (!d.has(sycl::aspect::fp16)) {
95 throw std::runtime_error(
"Device " +
96 d.get_info<sycl::info::device::name>() +
97 " does not support type 'half'");
113static inline void validate_type_for_device(
const sycl::queue &q)
115 validate_type_for_device<T>(q.get_device());
127std::ostream &
operator<<(std::ostream &out,
const std::vector<T> &vec)
129 std::string delimiter;
134 for (
auto &elem : vec) {
135 out << delimiter << elem;
136 if (delimiter.empty()) {
137 delimiter.assign(
", ");
157 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.