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:
Salvatore Mesoraca 2024-08-31 13:26:16 +02:00
parent a47667cff4
commit 4badab2b6c
No known key found for this signature in database
GPG key ID: 89E44B017275E5E7

View file

@ -910,6 +910,7 @@ namespace dpct
auto platform_list = sycl::platform::get_platforms();
for (const auto& platform : platform_list) {
if (!env || !std::strstr(env, "cpu")) {
auto devices = platform.get_devices();
auto gpu_dev = std::find_if(devices.begin(), devices.end(), [](const sycl::device& d) {
return d.is_gpu();
@ -920,6 +921,7 @@ namespace dpct
// << "] does not contain GPU devices, skipping\n";
continue;
}
}
auto platform_name = platform.get_info<sycl::info::platform::name>();
std::string platform_name_low_case;