Making PyOpenCL handle NumPy arrays as images

The OpenCL logo.

PyOpenCL Image objects take a shape tuple that gives (width, height, depth), but NumPy arrays specify shape in the order (rows, columns, ...) a.k.a. (height, width, ...) where the ellipsis indicates higher dimensions.  What's important is that the width and height dimensions have been swapped.  The PyOpenCL documentation suggests creating the NumPy arrays in the … Continue reading Making PyOpenCL handle NumPy arrays as images

My computer can’t add (part 2)

In My computer can't add (part 1) introduced Kahan summation and showed how it helps to improve the accuracy of summing up a large number of floating point values.  Kahan's algorithm is fine for this task, but what happens when one tries combining the result of two sums?  What if you need to multiply the compensated … Continue reading My computer can’t add (part 2)