Re: [osg-users] Built application with pthread openthreads runs only on one core

2014-01-09 Thread Marcel Pursche
Hi, I think I found the source of this bug. There is a Linux specific detail in the pthreads API: The new thread inherits copies of the calling thread's capability sets (see capabilities(7)) and CPU affinity mask (see sched_setaffinity(2)). This can be found in the man page of

Re: [osg-users] Built application with pthread openthreads runs only on one core

2013-12-16 Thread Jan Klimke
Hi, just to mention it i got a (hopefully plausible) theory why it could happen that all my application threads have the thread affinity of the first cpu core. I think the viewer thread was actually the first one that got created. All other thread where started afterwards and inherited the CPU

Re: [osg-users] Built application with pthread openthreads runs only on one core

2013-12-10 Thread Robert Osfield
Hi Jan, You provide too few details to know what is going on at your end. How many threads is your app using? Is it manually creating them? Are you using the viewer multi-threaded? Which version of the OSG are you using? Robert. On 9 December 2013 22:17, Jan Klimke osgfo...@tevs.eu wrote:

Re: [osg-users] Built application with pthread openthreads runs only on one core

2013-12-10 Thread Jan Klimke
Hi Robert, the overall application is a pretty big system for rendering of massive 3D city models. We are creating several threads on our own, e.g. for service request, fetching of texture tiles etc. The viewer itself is not operating in a threaded mode. Some threads are also database pager

Re: [osg-users] Built application with pthread openthreads runs only on one core

2013-12-10 Thread Robert Osfield
Hi Jan, The code in Pthread.cpp so set the affinity is only called by the Viewer for the viewer threads, and if you are running it in single threaded mode it'll just set the affinity of that single thread to CPU 0 to avoid it jumping from core to core. If you use a threaded viewer it'll use

Re: [osg-users] Built application with pthread openthreads runs only on one core

2013-12-10 Thread Jan Klimke
Hi Robert, actually this piece of code from pthreads.cpp was the only one that was containing the word affinity. :-) so that was just a guess that this could be the problem. Nevertheless i was not able to understand why the whole application did not receive the process affinity mask with only

Re: [osg-users] Built application with pthread openthreads runs only on one core

2013-12-10 Thread Robert Osfield
Hi Jan, The thread has to have it's affinity set for it to have an affinity to a cpu core, so you if are creating your own threads and not setting their affinity they won't have any and should more from core to core according to what the OS decides. The only thread I expect will have affinity to

[osg-users] Built application with pthread openthreads runs only on one core

2013-12-09 Thread Jan Klimke
Hi, i noticed a while ago that my application that was build using openscenegraph and openthreads with pthreads was only running on a single core of my 4 core processor. Today i digged a little bit deeper into the problem and noticed that the cpu affinity mask was always set to use the first