preda / gpuowl

GPU Mersenne primality test.
GNU General Public License v3.0
127 stars 35 forks source link

Fix failure on systems with multiple OpenCL platforms #290

Closed proski closed 3 weeks ago

proski commented 3 weeks ago

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.

proski commented 3 weeks ago

Test results.

No platforms:

20240822 18:52:57  PRPLL 0.13-4-gdbd28f2
20240822 18:52:57  PRPLL 0.13-4-gdbd28f2
20240822 18:52:57  config: -ll 12345678
20240822 18:52:57  No OpenCL platforms found (ICD_NOT_FOUND)
20240822 18:52:57  No OpenCL device found. Check clinfo
20240822 18:52:57  Exiting because "No OpenCL device found. Check clinfo"
20240822 18:52:57  Bye

One platform, no devices:

20240822 18:52:35  PRPLL 0.13-4-gdbd28f2
20240822 18:52:35  PRPLL 0.13-4-gdbd28f2
20240822 18:52:35  config: -ll 12345678
20240822 18:52:35  No OpenCL device found. Check clinfo
20240822 18:52:35  Exiting because "No OpenCL device found. Check clinfo"
20240822 18:52:35  Bye

One platform, one device:

20240822 18:57:56  PRPLL 0.13-4-gdbd28f2
20240822 18:57:56  PRPLL 0.13-4-gdbd28f2
20240822 18:57:56  config: -ll 12345678
20240822 18:57:56  device 0, OpenCL 24.26.30049.6, unique id ''
20240822 18:57:56 12345678 config:
20240822 18:57:56 12345678 FFT: 640K 256:5:256:2:0 (18.84 bpw)

Two platforms, one device:

20240822 18:59:07  PRPLL 0.13-4-gdbd28f2
20240822 18:59:07  PRPLL 0.13-4-gdbd28f2
20240822 18:59:07  config: -ll 12345678
20240822 18:59:07  device 0, OpenCL 24.26.30049.6, unique id ''
20240822 18:59:07 12345678 config:
20240822 18:59:07 12345678 FFT: 640K 256:5:256:2:0 (18.84 bpw)

Master branch behavior for two platforms, one device:

20240822 19:00:59  PRPLL 0.13-3-g669966f
20240822 19:00:59  PRPLL 0.13-3-g669966f
20240822 19:00:59  config: -ll 12345678
terminate called after throwing an instance of 'gpu_error'
  what():  DEVICE_NOT_FOUND (-1) clGetDeviceIDs(platforms[i], kind, 64, devices, &n) at src/clwrap.cpp:100 getAllDeviceIDs
Aborted (core dumped)