inducer / pyopencl

OpenCL integration for Python, plus shiny features
http://mathema.tician.de/software/pyopencl
Other
1.04k stars 238 forks source link

Fails to build with OpenCL 3.0 headers #705

Closed franz closed 8 months ago

franz commented 8 months ago

Trying to build with python3 setup.py build i get this:

x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -fwrapv -Wall -O3 -DNDEBUG -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FO>
In file included from /home/michal/0/build/b_pocl_master/examples/PyOpenCL/src/PyOpenCL/.eggs/numpy-1.26.1-py3.10-linux-x86_64.egg/numpy/core/include/numpy/n>
                 from /home/michal/0/build/b_pocl_master/examples/PyOpenCL/src/PyOpenCL/.eggs/numpy-1.26.1-py3.10-linux-x86_64.egg/numpy/core/include/numpy/n>
                 from /home/michal/0/build/b_pocl_master/examples/PyOpenCL/src/PyOpenCL/.eggs/numpy-1.26.1-py3.10-linux-x86_64.egg/numpy/core/include/numpy/a>
                 from src/wrap_cl.hpp:101,
                 from src/wrap_constants.cpp:30:
/home/michal/0/build/b_pocl_master/examples/PyOpenCL/src/PyOpenCL/.eggs/numpy-1.26.1-py3.10-linux-x86_64.egg/numpy/core/include/numpy/npy_1_7_deprecated_api.>
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
src/wrap_constants.cpp: In function ‘void pyopencl_expose_constants(pybind11::module_&)’:
src/wrap_constants.cpp:158:21: error: ‘CL_UNORM_INT24’ was not declared in this scope; did you mean ‘CL_UNORM_INT8’?
  158 |   cls.attr(#NAME) = CL_##PREFIX##NAME
      |                     ^~~
src/wrap_constants.cpp:754:5: note: in expansion of macro ‘ADD_ATTR’
  754 |     ADD_ATTR( , UNORM_INT24);
      |     ^~~~~~~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

The problem is that CL_UNORM_INT24 is only available if cl_gl.h has been included., so it seems the code is missing some ifdef.

inducer commented 8 months ago

Thanks for the report! #706

andiradulescu commented 5 months ago

@inducer Is it possible to make a new release that includes this fix? Thanks!

inducer commented 5 months ago

https://github.com/inducer/pyopencl/releases/tag/v2024.1

Should find its way to the package index soon.