Hello.
I got bug report on PyOpenCL behaviour.
Basically, if one of the platforms does not have
any devices, PyOpenCL raises an exception.
I can confirm it:
t$ python test_wrapper.py 
============================= test session starts 
platform linux2 -- Python 2.7.6 -- pytest-2.5.1
collected 0 items / 1 errors 

==================================== ERRORS 
_______________________ ERROR collecting test_wrapper.py 
/usr/lib/python2.7/dist-packages/pyopencl/tools.py:261: in
pytest_generate_tests_for_pyopencl
>       test_plat_and_dev = get_test_platforms_and_devices()
/usr/lib/python2.7/dist-packages/pyopencl/tools.py:238: in
get_test_platforms_and_devices
>                   for platform in cl.get_platforms()]
E           RuntimeError: clGetDeviceIDs failed: device not found
=========================== 1 error in 0.18 seconds



I'll try to look into it, but not before the next weekend,
so if someone wants to provide patch earlier - be welcome.

At the same time there is another feature request - should
the PyOpenCL return the first device of the first platform,
of should it return the first GPU, when requesting any context?

Best regards.


-------- Wiadomość przekazywana ----------
Od: Rebecca N. Palmer <[email protected]>
Do: [email protected], [email protected]
Temat: Re: pocl ITP, and opencl-icd selection
Data: Sat, 19 Apr 2014 23:10:32 +0100

(This continues the "can we avoid the need to manually choose an ICD by 
defaulting to all of them? not in their current state" thread from 
http://lists.alioth.debian.org/pipermail/pkg-opencl-devel/Week-of-Mon-20140203/000076.html
 
)

I now have a working pocl package, but it isn't policy-compliant yet; 
see the ITP bug (#676504) for details.

Meanwhile mesa-opencl-icd (for Radeon GPUs) has been added, revealing 
that pyopencl can't handle a platform with no devices (e.g. wrong ICD 
for the hardware) even if the platform does properly report this: the 
clGetDevices call (src/wrapper/wrap_cl.hpp line 851) is wrapped in a 
general "throw exception on non-success return code" guard, so 
CL_DEVICE_NOT_FOUND triggers this before it gets to the specific "return 
empty list if no devices" check.

Also, if pyopencl is asked to choose a platform/device non-interactively 
(pyopencl/__init__.py around line 800), it simply chooses the first 
device of the first platform, which will fail if the first platform has 
no devices and be needlessly slow if it is the CPU.  Given that 
clGetDeviceIDs/clGetDeviceInfo do provide a way to distinguish CPUs from 
GPUs, it would be possible to do better than this.

-- 
Tomasz Rybak  GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A  488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to