30#ifndef BACKEND_UTILS_H
31#define BACKEND_UTILS_H
40#include <sycl/sycl.hpp>
42#include <dpnp_iface_fptr.hpp>
47#ifndef __INTEL_MKL_2023_0_0_VERSION_REQUIRED
48#define __INTEL_MKL_2023_0_0_VERSION_REQUIRED 20230000
69static inline void validate_type_for_device(
const sycl::device &d)
71 if constexpr (std::is_same_v<T, double>) {
72 if (!d.has(sycl::aspect::fp64)) {
73 throw std::runtime_error(
"Device " +
74 d.get_info<sycl::info::device::name>() +
75 " does not support type 'double'");
78 else if constexpr (std::is_same_v<T, std::complex<double>>) {
79 if (!d.has(sycl::aspect::fp64)) {
80 throw std::runtime_error(
81 "Device " + d.get_info<sycl::info::device::name>() +
82 " does not support type 'complex<double>'");
85 else if constexpr (std::is_same_v<T, sycl::half>) {
86 if (!d.has(sycl::aspect::fp16)) {
87 throw std::runtime_error(
"Device " +
88 d.get_info<sycl::info::device::name>() +
89 " does not support type 'half'");
105static inline void validate_type_for_device(
const sycl::queue &q)
107 validate_type_for_device<T>(q.get_device());
119std::ostream &
operator<<(std::ostream &out,
const std::vector<T> &vec)
121 std::string delimiter;
126 for (
auto &elem : vec) {
127 out << delimiter << elem;
128 if (delimiter.empty()) {
129 delimiter.assign(
", ");
149 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.