Hi Chris,
Thanks for the code. I have just checked in the following to OpenThreads CVS:
int OpenThreads::GetNumberOfProcessors()
{
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
return sysInfo.dwNumberOfProcessors;
}
This obviously much simpler than your code, but I'm happy to minimize
the chances of breaking the build so close to rc1.
The above will obviously treat a P4 as 2 processors, which on
reflection is ok. I think the key thing is the number of processors
but which processing to bind to which processors. In this case you
need to total number of logical processors, otherwise you'll end up
addressing the wrong processors when it comes to assigning affinity.
We still do want to know about the presence of hyper threading cores
though, as you probably don't want to assign too many processes to one
CPU, for instance if you had two P4's in your machine you'd have four
logical processors, number 0,1,2,3, with 0&1 in the first P4, 2&3 on
the second. Then if you had two graphics cards and running in
parallel you'd want to assign Gfx context 0 to processors 0, and Gfx
context 1 to processors 2.
So to do the above skipping of second cores you need to no if
hyper-threading is present, but you need to do this as a seperate
function call, something like OpenThreads::AreCoresHyperThreaded() or
OpenThreads::LogicalProcessorsPerCore().
On a wider perspective, i.e. for more scalable systems, you actually
want to know the proximitry of CPU cores to GPU cores so that you can
assign processes for doing OpenGL rendering local to the GPU's that
will be doing the work. There only Onyx's and Prism that actually
fall in this bracket right now, but alas they are pining for the
fjiords. Perhaps AMD's 4x4 systems might just fall in to the bracket
too.
In this area is where Producer's config file would be an ideal to
place the processor affinity info.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/