Open
Description
Describe the bug
Parsing of PYOPENCL_CTX
and PYOPENCL_TEST
is implemented differently, leading to a different selection behavior. An example is given below. #780 is another example.
To Reproduce
$ clinfo -l
Platform #0: AMD Accelerated Parallel Processing
`-- Device #0: gfx90a:sramecc+:xnack-
$ PYOPENCL_TEST=AMD:90 python -c "import pyopencl; pyopencl.choose_devices()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/p/lustre1/diener3/Work/enew/pyopencl/pyopencl/__init__.py", line 1561, in choose_devices
for _plat, devs in get_test_platforms_and_devices():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/p/lustre1/diener3/Work/enew/pyopencl/pyopencl/tools.py", line 646, in get_test_platforms_and_devices
[find_cl_obj(devs, dev_id)
File "/p/lustre1/diener3/Work/enew/pyopencl/pyopencl/tools.py", line 646, in <listcomp>
[find_cl_obj(devs, dev_id)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/p/lustre1/diener3/Work/enew/pyopencl/pyopencl/tools.py", line 618, in find_cl_obj
return objs[num]
~~~~^^^^^
IndexError: list index out of range
$ PYOPENCL_CTX=AMD:90 python -c "import pyopencl; pyopencl.choose_devices()"
$ # works fine
Expected behavior
Having the same selection logic may be beneficial.
Environment (please complete the following information):
- OS: [e.g. Linux] Any
- ICD Loader and version: [e.g. ocl-icd 2.3.1] ocl-icd 2.3.2
- ICD and version: [e.g. pocl 1.8] Any
- CPU/GPU: [e.g. Nvidia Titan V] Any
- Python version: [e.g. 3.10] 3.11
- PyOpenCL version: [e.g. 2021.1] 2024.2.7
Additional context
Add any other context about the problem here.