Hi Robert & all,
I did the "simple thing" to test if the call pthread_setaffinity_np(
pthread_self(), sizeof(cpumask), &cpumask) was causing OpenMP problems.
A code snippet from the function SetProcessorAffinityOfCurrentThread in
PThread.c++ follows. Changing "doit" from true to false and recompiling
lets me test this call.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
#if defined(HAVE_PTHREAD_SETAFFINITY_NP)
std::cout << "SetProcessorAffinityOfCurrentThread: cpunum=" <<
cpunum << " sizeof(cpumask)=" << sizeof(cpumask) << std::endl;
bool doit = true;
if(doit)
{
pthread_setaffinity_np( pthread_self(), sizeof(cpumask),
&cpumask);
std::cout << "SetProcessorAffinityOfCurrentThread:
pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask)
called immediately before this printout" << std::endl;
}
else
std::cout << "SetProcessorAffinityOfCurrentThread:
pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask) NOT
called immediately before this printout result"
<< std::endl;
#elif defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
The result was what I suspected. If the call to pthread_setaffinity_np
is NOT made then OpenMP recognizes that there are 8 processors,
otherwise it thinks that there is only 1. In both cases I used "strace
-f -e sched_setaffinity -e sched_getaffinity" to keep an eye on system
calls. Output for both cases is listed below.
I am just trying to use OpenMP inside an application that uses
OpenSceneGraph. What needs to be done to fix this problem, wherever it
may be, is "above my current paygrade". :-)
However, getting our application (umbra -
http://robotics.sandia.gov/UMBRA.html) to use OpenMP may be important to
many of us.
Thanks,
Ralph
************************************************************
Call pthread_setaffinity_np:
camera number: 0
SetProcessorAffinityOfCurrentThread: cpunum=0 sizeof(cpumask)=128
sched_getaffinity(32493, 128, { ff, 0, 0, 0 }) = 32
SetProcessorAffinityOfCurrentThread: pthread_setaffinity_np(
pthread_self(), sizeof(cpumask), &cpumask) called immediately before
this printout
INFO> navigation mode set to umbra
Warning: font file "fonts/arial.ttf" not found.
Setting savConfigCB to '::guiWrapper saveConfig'
sched_getaffinity(32493, 128, { 1, 0, 0, 0 }) = 32
sLoadFile filename:/home/vision_data/geometry_objects/test.cdf
fileType: lineRowCnt=-1 lineColCnt=-1
std::string UmbModCDFDataSet::LoadFile(const s....
Enter test_openmp()
sched_getaffinity(32493, 128, { 1, 0, 0, 0 }) = 32
OPENMP is 200505 Number of processors available:1 MAX number of OpenMP
threads 1
GOMP_CPU_AFFINITY is unknown
Exit test_openmp()
****************************************************************
do NOT call pthread_setaffinity_np:
camera number: 0
SetProcessorAffinityOfCurrentThread: cpunum=0 sizeof(cpumask)=128
SetProcessorAffinityOfCurrentThread: pthread_setaffinity_np(
pthread_self(), sizeof(cpumask), &cpumask) NOT called immediately before
this printout result
INFO> navigation mode set to umbra
Warning: font file "fonts/arial.ttf" not found.
Setting savConfigCB to '::guiWrapper saveConfig'
sched_getaffinity(1393, 128, { ff, 0, 0, 0 }) = 32
sLoadFile filename:/home/vision_data/geometry_objects/test.cdf
fileType: lineRowCnt=-1 lineColCnt=-1
std::string UmbModCDFDataSet::LoadFile(const s....
Enter test_openmp()
sched_getaffinity(1393, 128, { ff, 0, 0, 0 }) = 32
OPENMP is 200505 Number of processors available:8 MAX number of OpenMP
threads 8
GOMP_CPU_AFFINITY is unknown
Exit test_openmp()
************************************************************************
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org