Skip to content

Commit b21b20f

Browse files
committed
Try to update opencl_interop.cpp according to 67a3806
1 parent 7e36eef commit b21b20f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sycl/test-e2e/DeprecatedFeatures/opencl_interop.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// REQUIRES: opencl, opencl_icd
22

33
// RUN: %{build} -D__SYCL_INTERNAL_API -o %t.out %opencl_lib
4-
// RUN: %{run} %t.out
4+
// RUN: %{run-unfiltered-devices} %t.out
55

66
#include <cassert>
77
#include <exception>
@@ -25,7 +25,14 @@ cl_platform_id selectOpenCLPlatform() {
2525
err = clGetPlatformIDs(num_of_platforms, &platforms[0], 0);
2626
CL_CHECK_ERRORS(err);
2727

28-
return platforms[0];
28+
for (int i = 0; i < num_of_platforms; ++i) {
29+
cl_uint num_of_devices = 0;
30+
err =
31+
clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, 0, &num_of_devices);
32+
if (err == CL_SUCCESS && num_of_devices > 0)
33+
return platforms[i];
34+
}
35+
throw std::runtime_error("No OpenCL platforms with available devices!");
2936
}
3037

3138
cl_device_id selectOpenCLDevice(cl_platform_id platform) {

0 commit comments

Comments
 (0)