30#ifndef BACKEND_UTILS_H
31#define BACKEND_UTILS_H
40#include <sycl/sycl.hpp>
42#include <dpnp_iface_fptr.hpp>
62static inline void validate_type_for_device(
const sycl::device &d)
64 if constexpr (std::is_same_v<T, double>) {
65 if (!d.has(sycl::aspect::fp64)) {
66 throw std::runtime_error(
"Device " +
67 d.get_info<sycl::info::device::name>() +
68 " does not support type 'double'");
71 else if constexpr (std::is_same_v<T, std::complex<double>>) {
72 if (!d.has(sycl::aspect::fp64)) {
73 throw std::runtime_error(
74 "Device " + d.get_info<sycl::info::device::name>() +
75 " does not support type 'complex<double>'");
78 else if constexpr (std::is_same_v<T, sycl::half>) {
79 if (!d.has(sycl::aspect::fp16)) {
80 throw std::runtime_error(
"Device " +
81 d.get_info<sycl::info::device::name>() +
82 " does not support type 'half'");
98static inline void validate_type_for_device(
const sycl::queue &q)
100 validate_type_for_device<T>(q.get_device());
112std::ostream &
operator<<(std::ostream &out,
const std::vector<T> &vec)
114 std::string delimiter;
119 for (
auto &elem : vec) {
120 out << delimiter << elem;
121 if (delimiter.empty()) {
122 delimiter.assign(
", ");
142 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.