PyOpenCL-Tutorial icon indicating copy to clipboard operation
PyOpenCL-Tutorial copied to clipboard

Unfair comparison of timing in one of the examples

Open rsnemmen opened this issue 7 years ago • 2 comments

Dear Ben,

Nice examples, thanks for writing this!

The 030_timing.py code is doing an unfair comparison of the speed of a slow python loop versus a compiled C-OpenCL code. In this case, the C-kernel will always be faster. A more fair comparison would be to compare the speed of a C-code that performs the sum vs the OpenCL version executed on the GPU. Does this make sense?

rsnemmen avatar Feb 25 '18 02:02 rsnemmen

You could use numba.jit() to optimise the cpu loop function and compare results.

JonnoFTW avatar May 18 '18 06:05 JonnoFTW

Good point

rsnemmen avatar May 18 '18 14:05 rsnemmen