inducer / pyopencl

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

Allow dtype-convertible values in reductions #579

Closed alexfikl closed 2 years ago

alexfikl commented 2 years ago

Allows passing np.float64 instead of a dtype to these functions. Most of the kernels (e.g. get_sum_kernel) assume they're getting a dtype, e.g.

https://github.com/inducer/pyopencl/blob/3abb137cb4dfe78637fd670d0657928d3cce2460/pyopencl/reduction.py#L529

inducer commented 2 years ago

Thanks, looks good. Add a test?

alexfikl commented 2 years ago

Thanks, looks good. Add a test?

@inducer Added a little test for float values (and a lot of markers!).

inducer commented 2 years ago

Thanks!