Friday, September 25, 2009

Parallelizing code

I have modified my fractal generation code to use Intel TBB. While before, on an 8 core machine I was only able to get 13% CPU usage, I now have almost 100%.

The first part I did was layer generation. This means a single parallel_for.

I have then parallelized the triangle generation part (the so-called marching cubes). To do so I have a simple parallel_for and each thread writes its computed triangles to a shared concurrent_vector. Very simple and impressively effective.

So this scales quite well and I was able to achieve an overall speedup of 6x on a 8 core machine, over a single core.