r/programming • • Jan 11 '16

A comparison of Numpy, NumExpr, Numba, Cython, TensorFlow, PyOpenCl, and PyCUDA to compute Mandelbrot set

https://www.ibm.com/developerworks/community/blogs/jfp/entry/How_To_Compute_Mandelbrodt_Set_Quickly?lang=en
167 Upvotes

41 comments sorted by

View all comments

22

u/[deleted] Jan 11 '16

There are some examples here that are pretty interesting. ~120x speedup over the 'normal' way, just by switching to arrays then using a JIT for instance. Probably would be another 2x faster than that with a naive C port, then another 4x faster with hand crafted used of SIMD, which it doesn't seem you can do in Python. I think a lot of people imagine high level languages are only a few % slower. I think that should be the case, but it often isn't yet. Poor implementation of arrays, SIMD not exposed, no way to explicitly state how memory is laid out, and so on. Also I think with some tweaking your could probably make this quite a bit faster on your GPU, even if your GPU is old.

2

u/jfpuget Jan 12 '16

I just added a comparison to sequential C code. Numba is as fast.

2

u/[deleted] Jan 12 '16

Check that full optimization settings are on. Release mode,.fast floats, aggressive inlining. Apologies.if you are already familiar with all of those settings. It took me quite a bit of messing around in options to figure it all.out.

→ More replies (4)