Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failure on systems with multiple OpenCL platforms #290

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix failure on systems with multiple OpenCL platforms
No need to fail hard and exist if there are multiple OpenCL platforms
and some of them don't have any device. Only fail if there are no
devices for any platform.

This can happen e.g. if support for both Intel and AMD GPU is installed.
  • Loading branch information
proski committed Aug 23, 2024
commit dbd28f2756d6d51ee89826d083622005a64c05ef
5 changes: 4 additions & 1 deletion src/clwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ vector<cl_device_id> getAllDeviceIDs() {
// log("platform %d\n", i);
unsigned n = 0;
auto kind = false ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_ALL;
CHECK1(clGetDeviceIDs(platforms[i], kind, 64, devices, &n));
err = clGetDeviceIDs(platforms[i], kind, 64, devices, &n);
if (err != CL_SUCCESS) {
continue;
}
for (unsigned k = 0; k < n; ++k) { ret.push_back(devices[k]); }
}
return ret;
Expand Down