Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 713a078

Browse files
[SYCL] new tests for SYCL 2020 standalone device selectors ( gpu_selector_v and friends) (#1141)
1 parent 2fb0a0e commit 713a078

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

SYCL/Basic/device-selectors.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,29 @@ int main() {
9393
assert(e.code() == sycl::errc::runtime && "Incorrect error code.");
9494
}
9595

96+
// Standalone device selectors.
97+
queue default_queue(default_selector_v); // Compilation and no error
98+
99+
// Not sure what devices are available when this test is run, so no action is
100+
// necessary on error.
101+
try {
102+
queue gpu_queue(gpu_selector_v);
103+
assert(gpu_queue.get_device().is_gpu() &&
104+
"Incorrect device. Expected GPU.");
105+
} catch (exception &e) {
106+
}
107+
try {
108+
queue cpu_queue(cpu_selector_v);
109+
assert(cpu_queue.get_device().is_cpu() &&
110+
"Incorrect device. Expected CPU.");
111+
} catch (exception &e) {
112+
}
113+
try {
114+
queue acc_queue(accelerator_selector_v);
115+
assert(acc_queue.get_device().is_accelerator() &&
116+
"Incorrect device. Expected Accelerator.");
117+
} catch (exception &e) {
118+
}
119+
96120
return 0;
97121
}

0 commit comments

Comments
 (0)