37 backend::ext_oneapi_level_zero;
40 device device_selector::select_device()
const {
41 std::vector<device> devices = device::get_devices();
42 int score = REJECT_DEVICE_SCORE;
43 const device *res =
nullptr;
45 for (
const auto &dev : devices) {
46 int dev_score = (*this)(dev);
50 .get_info<info::platform::name>();
51 std::string DeviceName = dev.get_info<info::device::name>();
52 std::cout <<
"SYCL_PI_TRACE[all]: "
53 <<
"select_device(): -> score = " << dev_score
54 << ((dev_score < 0) ?
" (REJECTED)" :
"") << std::endl
55 <<
"SYCL_PI_TRACE[all]: "
56 <<
" platform: " << PlatformName << std::endl
57 <<
"SYCL_PI_TRACE[all]: "
58 <<
" device: " << DeviceName << std::endl;
70 if ((score < dev_score) ||
80 .get_info<info::platform::name>();
81 std::string DeviceName = res->
get_info<info::device::name>();
82 std::cout <<
"SYCL_PI_TRACE[all]: "
83 <<
"Selected device ->" << std::endl
84 <<
"SYCL_PI_TRACE[all]: "
85 <<
" platform: " << PlatformName << std::endl
86 <<
"SYCL_PI_TRACE[all]: "
87 <<
" device: " << DeviceName << std::endl;
92 throw cl::sycl::runtime_error(
"No device of requested type available.",
100 int default_selector::operator()(
const device &dev)
const {
102 int Score = REJECT_DEVICE_SCORE;
138 int gpu_selector::operator()(
const device &dev)
const {
139 int Score = REJECT_DEVICE_SCORE;
151 int cpu_selector::operator()(
const device &dev)
const {
152 int Score = REJECT_DEVICE_SCORE;
165 int accelerator_selector::operator()(
const device &dev)
const {
166 int Score = REJECT_DEVICE_SCORE;
179 int host_selector::operator()(
const device &dev)
const {
180 int Score = REJECT_DEVICE_SCORE;
194 filter_selector::filter_selector(
const std::string &Input)
195 : impl(
std::make_shared<detail::filter_selector_impl>(Input)) {}
198 return impl->operator()(Dev);
204 std::lock_guard<std::mutex> Guard(
218 using namespace ext::oneapi;
219 filter_selector::filter_selector(
const std::string &Input)
220 : ext::oneapi::filter_selector(Input) {}