pouët.net

Raytracing, dual cores and SMP

category: general [glöplog]
 
I've just been testing today multithreading with my dual core. I've used a simple raytraced scene without textures, generating interleaved scanlines for every thread. I've used no mfc but win32 CreateThread and WaitForMultipleObjects for it.

The original program was single thread and optimized for it with the use of some global data. For the conversion to multithreading, I've had to delete such optimizations.

So, the results, comparing the 2 thread with the original, is the 2 thread is 87% faster.

Comparing the multithread code running in only a single thread and running in two threads the speed increase is 96%.

Using more than 2 threads in my dual core only sightly decreased the speed (about 1-2% less using 16 threads). I was curious about 4 threads, because of the HT... but it looks as doing just nothing (at least for my raytracer).

Just so you know.
added on the 2006-10-29 02:43:23 by texel texel
Seems it would be good for raytracing demos/apps to detect number of cores and create corresponding number of worker threads.
added on the 2006-10-29 10:55:48 by masterm masterm
if you are talking about core 2 duo: there is no ht anymore. iirc same counts for pentium d except the extreme edition.
added on the 2006-10-29 11:21:14 by ttl ttl
HT only helps by allowing a thread B to restart computing while thread A which was executing is stalled in a memory read which is not in cache. Since simple raytracing (ie: without quadtress and like to skip checking all pixels against all objects) is bruteforce computation, HT will not help. BUT when you goto raytrace millions of triangles in a quadtree, HT would help to mask the delays from memory :)

I'd just ask the system how many threads it can run in parallel and run that.

Also, try grouping by 16x16 boxes instead of scanlines, it will probably run better due to coherent memory access... at least on dual G4 1.25 it helped a lot :)
added on the 2006-10-29 11:51:36 by winden winden
I've just worked again in the code. Now I get a 97% speed increase..
added on the 2006-10-29 12:08:26 by texel texel
I'm using a pentium D
added on the 2006-10-29 12:08:47 by texel texel
multi processors rock =) (and SSE too :))
added on the 2006-10-29 12:49:53 by earx earx

login