I've stumbled upon the following issue. Our renderer runs
SingleThreaded because that what most Qt integrations seem to use, or
else other issues arise. I'd be happy to change that of course.
This makes the whole application run on just one core. It's still
"multithreaded", as the load average still goes up when several threads
are started, but they all run on one core.
Is this a bug, or am I doing something completely wrong?
For reference, I simply create several std::future's using std::async()
and then query their results. Only when our composite viewer was
requested to set its threading model to SingleThreaded all these threads
run on one core, otherwise it works as it's supposed to.
Thanks,
Christoph
--
Mit freundlichen Grüßen,
Christoph Weiß
WSoptics GmbH
we...@WSoptics.de
+49 8868 181 997 3
Zugspitzstraße 9
86972 Altenstadt
HRB 204558 Gerichtsstand: München B Ust.Id.Nr.: DE289079930
Geschäftsführer: Florian Sepp, Dr. Christoph Weiß
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Hi Robert,
> Have you tried setting the affinity of the threads that are created?
> Have you tried creating the threads before the call to viewer.realize()?
Yes, both cause the threads being distributed across the cores. That is probably also why initialising TBB early in main helps, as it creates a pool of worker threads. For my app, you can consider it solved.
But don't you see a difficulty for OSG, if you cannot use any threading library without additonal setup code?
> The way things are behaving looks to be down to the way that the Linux threading is forcing the inheritance of the threading affinity of the main thread to child threads.
> I don't know if there is an setting on the Linux threads side that can change this behaviour so it's more consistent with other platforms.
I was looking for that, and my search was fruitless.
It also seems not to be Linux specific. FreeBSD seems to do the the same, as is Windows: https://msdn.microsoft.com/es-es/library/windows/desktop/ms686223(v=vs.85).aspx
> Process affinity is inherited by any child process or newly instantiated local process
It looks more like OS X is the isolated case (and qnx).
Cheers,
Fabian
While not ideal that this issue exists at all at least we now have a handle on it. Given the issue only occurs with a very specific set of usage I don't think there is any reason for sweeping changes to the core OSG, or changes to the defaults.
Robert.