Skip to content

Commit

Permalink
Fix issue where platform can return no devices
Browse files Browse the repository at this point in the history
OpenCL platforms can exist without any devices, continue to next platform instead of erroring
  • Loading branch information
CCob committed Apr 17, 2020
1 parent e3b20e4 commit 1d6b33b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions worker/opencl_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ func GetAvailableDevices() (shared.DeviceMap, error) {
for _, platform := range platforms {
devices, err := platform.GetDevices(opencl.DeviceTypeAll)
if err != nil {
if err == opencl.ErrDeviceNotFound {
continue
}
return nil, err
}

Expand All @@ -39,5 +42,9 @@ func GetAvailableDevices() (shared.DeviceMap, error) {
}
}

if len(devs) == 0 {
return nil, opencl.ErrDeviceNotFound
}

return devs, nil
}

0 comments on commit 1d6b33b

Please sign in to comment.