Robert Osfield wrote:
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.

  Yeah, that's a no-brainer. ;)

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.

Yes. For example, my code that I took this from wants to know how many real CPUs are present so it can decide how much extra time to have left over for the DatabasePager background thread to do its loading work.

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().

Which is exactly what the original code offers, but I'm just not sure how Intel's copyrighted example code can be integrated into OpenThreads' license. :(

We can visit the issue more after the 1.1.1 release, but at least the code to solve these issues is now archived in the mailing list, in case someone needs it.

--
Chris 'Xenon' Hanson aka Eric Hammil | http://www.3DNature.com/ eric at logrus
 "I set the wheels in motion, turn up all the machines, activate the programs,
  and run behind the scenes. I set the clouds in motion, turn up light and 
sound,
  activate the window, and watch the world go 'round." -Prime Mover, Rush.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to