This is, bizarrely, by design.

In single-threaded mode, OpenSceneGraph silently sets CPU affinity to a single 
core by default. Personally I think this is incredibly obtrusive on the 
programmer, and the reasons for this being default behaviour are terrible, but 
it is what it is.

This is what I do:

#ifdef LINUX
    int numCPU = sysconf( _SC_NPROCESSORS_ONLN ); //glibc fails 'all ones' cpu 
masks so we need this sysconf call
    cpu_set_t  mask;
    for (int i = 0; i < numCPU ; i++)
        CPU_SET(i, &mask);
        //qDebug("SETTING CPU %d",i);
    int ret = sched_setaffinity(0, sizeof(mask), &mask); //override 
OpenSceneGraphs shitty CPU affinity stuff
    //qDebug("CPU COUNT: %d %d",CPU_COUNT(&mask),ret);


Read this topic online here:

osg-users mailing list

Reply via email to