SYCL: do not skip CPU or FPGA if explicitly selected
It can be useful to be able to use SYCL on CPU e.g. to run tests on a machine without a GPU. With this commit a user can enable the use of the CPU with the following env variable: export ONEAPI_DEVICE_SELECTOR="opencl:cpu" Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
This commit is contained in:
parent
a47667cff4
commit
4badab2b6c
1 changed files with 10 additions and 8 deletions
|
@ -910,15 +910,17 @@ namespace dpct
|
||||||
auto platform_list = sycl::platform::get_platforms();
|
auto platform_list = sycl::platform::get_platforms();
|
||||||
|
|
||||||
for (const auto& platform : platform_list) {
|
for (const auto& platform : platform_list) {
|
||||||
auto devices = platform.get_devices();
|
if (!env || !std::strstr(env, "cpu")) {
|
||||||
auto gpu_dev = std::find_if(devices.begin(), devices.end(), [](const sycl::device& d) {
|
auto devices = platform.get_devices();
|
||||||
return d.is_gpu();
|
auto gpu_dev = std::find_if(devices.begin(), devices.end(), [](const sycl::device& d) {
|
||||||
});
|
return d.is_gpu();
|
||||||
|
});
|
||||||
|
|
||||||
if (gpu_dev == devices.end()) {
|
if (gpu_dev == devices.end()) {
|
||||||
// cout << "platform [" << platform_name
|
// cout << "platform [" << platform_name
|
||||||
// << "] does not contain GPU devices, skipping\n";
|
// << "] does not contain GPU devices, skipping\n";
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto platform_name = platform.get_info<sycl::info::platform::name>();
|
auto platform_name = platform.get_info<sycl::info::platform::name>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue