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 multiple
threads and assign each thread to separate core.

Currently the DatabasePager doesn't set the affinity of the threads it
creates so won't be locked to any particular core.  You could manually set
it if you wish.

As far as I'm aware things are working correctly, I'm really not sure what
you expectation is here.

Robert.


On 10 December 2013 08:54, Jan Klimke <osgfo...@tevs.eu> wrote:

> 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 threads created by
> OSG.
>
> The version of OSG is the one tagged as 3.3.0 in the github repository.
> For me it seems like the following code from PThread.cpp causes the cpu
> affinity mask of the complete process to be set to CPU zero. After i found
> this piece of code, i switched openthreads to use QT threads. After
> recompilation, the cpu affinity of all process threads was set correctly to
> use all processors.
>
>
> Code:
>
>         if (pd->cpunum>=0)
>         {
> #if defined(__sgi)
>             pthread_setrunon_np( pd->cpunum );
> #elif defined(HAVE_PTHREAD_SETAFFINITY_NP) ||
> defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY) ||
> defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
>             cpu_set_t cpumask;
>             CPU_ZERO( &cpumask );
>             CPU_SET( pd->cpunum, &cpumask );
>
> #if defined(HAVE_PTHREAD_SETAFFINITY_NP)
>             pthread_setaffinity_np( pthread_self(), sizeof(cpumask),
> &cpumask);
> #elif defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
>             sched_setaffinity( 0, sizeof(cpumask), &cpumask );
> #elif defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
>             sched_setaffinity( 0, &cpumask );
> #endif
> #endif
>         }
>
>
>
>
> Kind regards,
> Jan
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57630#57630
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to