Hi All, I have intended for a while to add support for processor affinity to the OSG, and this afternoon I did some testing, and check into CVS this work. What I have done is a small modification to OsgCameraGroup's Realize callback, that uses 2.6 Linux kernel's processor affinity functions. By default these aren't used, but you can enable via the env var:
export OSG_PROCESSOR_AFFINTIY = ON And switch it off via: export OSG_PROCESSOR_AFFINTIY = OFF All osgProducer::OsgCameraGroup/Viewer based apps will automatically then have the processor affinity support under linux. The processor affinity path is only taken when more than one processor is detected, you have more than one camera, and its processor affinity is enabled via the env var above. Dual core processors report as 2, so if like me you have on Althon X2 or dual core Intel processor your in luck. I think hyper-threaded cores will report as 2 though, and this might be a good thing or bad.. depending on how well suited the processor is the tackling things. The results I'm getting on my models is generally positive, I've seen up to a 20% improvement in speed, and the worst case is if uncommon case, but still repeatable 5% reduction. So overall I'm seeing an improvement. The most noticeable difference though is on the stats bar for cull and draw, suddenly they lock in parallel all the time, rather than jumping about without the affinity switched on. However, I think I am probably hitting memory DDR bandwidth limit most of the time with big models, so the both cores are starved so can't produce the optimum performance. Perhaps will later chips with DD2 support we might see a better jump with setting processor affinity. Adding process affinity on other platforms many not be too much work, I haven't looked into this, so others are welcome to pitch in. The code I've changed is in src/osgProducer/OsgCameraGroup.cpp. The code I have implemented today is an experiment, a useful one, and possible good enough to stay in place for the up coming 1.1.1 release. However, its an experiment no less, longer term we need to push the processor affinity setup into OpenThreads and make it as cross platform as we can, then look at where best in Producer/OpenSceneGraph we should put controls for setting it all up. Robert. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
