glam icon indicating copy to clipboard operation
glam copied to clipboard

"Unable to find OpenCL devices"

Open FelixCAAuer opened this issue 4 years ago • 2 comments

Problem When computing the "crosslessness" metric, it could happen that a std::runtime_error is thrown with "Unable to find OpenCL devices" even though there are devices available on the machine.

Possible cause The available devices get filtered by CL_DEVICE_TYPE_CPU and CL_DEVICE_TYPE_ACCELERATOR for which they might not qualify.

Workaround By changing lines 250 and 251 in glam/include/kw/graph/layout/metric/edge_crossing.hpp from

for (auto& device : platform.devices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR)) { to for (auto& device : platform.devices()) {

the available devices don't get filtered and appear in the list. This workaround has fixed the issue for me (running on wsl2).

FelixCAAuer avatar Sep 21 '21 21:09 FelixCAAuer

The code for computing crosslessness is designed only for GPU and Accelerator.

You could run it on CPU but it will be much slower than more efficient sweep line algorithms for checking line-segment intersections.

So I don't plan to add CPU in the device list.

kwonoh avatar Sep 21 '21 21:09 kwonoh

Makes sense of course! I need the workaround since I have to work on the windows-subsystem, which doesn't yet fully support OpenCL for GPUs (at least that's what I found). I just posted the issue here so that maybe someone else, who is facing similar restrictions, can use it 🙂

FelixCAAuer avatar Sep 21 '21 21:09 FelixCAAuer