08-05-2010 11:46 PM
I'm new to Intel's TBB and I would like to optimize my raytracing engine.
The problem is, that I don't get any performance boost by using TBB,
which is somehow weird, because it should run faster in a multi-threaded
What I did so far:
[cpp]tbb::task_scheduler_init init; init.initialize(4); ... tbb::blocked_range2dI initialized the task scheduler to use 4 threads and SCREENH, SCREENW and GRAN are the screen resolution and the granularity (I tried values between 1 and 10000 - no effect).
range(0u, SCREENH, GRAN, 0u, SCREENW, GRAN); tbb::parallel_for(range, tRenderParallel(renderer));[/cpp]
The tRenderParallel calls my renderer with the appropriate clip region.
I understand it in that the way, that the above code is enough to parallelize the system. Can anyone tell me, what's wrong with my approach?
Thanks in advance,
Valued Contributor II
08-15-2010 05:25 PM
There are no obvious issues with the code you've shared, but as always, the devil is in the details. Need to see tRenderParallel.operator() and perhaps further details to understand what may be preventing your desired scaling, but one sanity question: you are running four threads on a machine that has at least four HW threads, right?