------- Comment #6 from rrpeter at sandia dot gov  2008-09-30 15:54 -------
Subject: Re:  OpenMP thinks that I have 1 processor
 on an 8 processor pc

jakub at gcc dot gnu dot org wrote:
> ------- Comment #5 from jakub at gcc dot gnu dot org  2008-09-20 08:22 -------
> No, I didn't mean to ask you to try to work around it, I asked you to
> investigate why omp_get_num_procs returns 1 instead of 8.  The gcc 4.3 vs. 4.4
> difference only affects omp_get_max_threads, not omp_get_num_procs, so even
> omp_get_num_procs reports 1, the options are 1) the process has affinity set 
> to
> just one CPU 2) GOMP_CPU_AFFINITY has been used 3) you have omp_get_num_procs
> defined elsewhere in your program, verify that libgomp function is really 
> used.
> strace -f -e sched_getaffinity dump of the program could reveal 1), 2) can be
> determined by looking at the scripts you use to start the program (or by 
> adding
> getenv call in the program to print that for you), 3) can be seen in the
> debugger and/or by using LD_DEBUG=all env var.
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37586
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
>   
Hi Jakub,

I finally have a bit of time respond to your last email!

I may be new enough to this to be missing something important.  Why 
don't we start at the beginning?

I compiled everything with -fopenmp flag on the compiler (4.3.2 is the 
version for g++ and gcc)

*****************************************

Openmp code exists in only one place in my software.

[EMAIL PROTECTED] rwm]$ find . -name "*.*pp" -exec grep -n -H omp.h {} \;
./umbraModCDF/umbModCDFDataSet.cpp:237:#include <omp.h>

[EMAIL PROTECTED] rwm]$ find . -name "*.*pp" -exec grep -n -H 
omp_get_num_procs {} \;
./umbraModCDF/umbModCDFDataSet.cpp:246:   cerr << " OPENMP is " << 
_OPENMP << "  Number of processors available:" << omp_get_num_procs() << 
" MAX number of OpenMP threads " << omp_get_max_threads() << endl;
[EMAIL PROTECTED] rwm]$

All of the OpenMP code that I have is in the following function

**********************************
#include <omp.h>

void test_openmp()
{  
   cerr << "\nEnter test_openmp() " << endl;

#ifdef _OPENMP
//    omp_set_dynamic(true);
//    omp_set_num_threads(8);
   cerr << " OPENMP is " << _OPENMP << "  Number of processors 
available:" << omp_get_num_procs() << " MAX number of OpenMP threads " 
<< omp_get_max_threads() << endl;
   char *GCU = getenv("GOMP_CPU_AFFINITY");
   if(GCU != NULL)
      cerr << " GOMP_CPU_AFFINITY is " << GCU << "!!!!\n"<< endl;
   else
      cerr << " GOMP_CPU_AFFINITY is unknown" << endl;

#endif

   cerr << "\nExit test_openmp()\n" << endl;
   cerr.flush();
}

***********

Output snippet is:
Enter test_openmp()
 OPENMP is 200505  Number of processors available:1 MAX number of OpenMP 
threads 1
 GOMP_CPU_AFFINITY is unknown

Exit test_openmp()

************

I ran strace and I got some results.  In the output I see:
sched_getaffinity(3502, 128,  { ff, 0, 0, 0 }) = 32
....
 sched_getaffinity(3502, 128,  { 1, 0, 0, 0 }) = 32
...
sched_getaffinity(3502, 128,  { 1, 0, 0, 0 }) = 32

I will let you interpret  the output which is reproduce in full below.

[EMAIL PROTECTED] rwm]$ strace -f -e sched_getaffinity uview 
./viewer_scripts/viewer_CDF.tcl
Process 3503 attached (waiting for parent)
Process 3503 resumed (parent 3502 ready)
Process 3503 detached
--- SIGCHLD (Child exited) @ 0 (0) ---
provided packge "ucl" version 4.7.1
STATUS> Umbra installed at UmbraPath -> /home/hopper/UMBRA_4
STATUS> Use UmbraPath variable to refer to this location
STATUS> uview is using gui from developerViewer
STATUS> loading umbraConfig.tcl from uclLoad.tcl
STATUS> searching for umbra config files in path 
/home/hopper/UMBRA_4/umbra/SNL/rwm . /home/hopper/UMBRA_4
library r {umb {4.7.1 debug {Sep 29 2008} 13:08:47}} {usg {4.7.1 debug 
{Sep 29 2008} 13:08:56}} {ucl {4.7.1 debug {Sep 29 2008} 13:08:55}}
STATUS> loading ustk library from uclLoad.tcl

*-----------------------------------------------------------------------------*
*      The C-Space Toolkit (C) software contained in this program is 
the      *
*  property of Sandia 
Corporation.                                            *
*      Copyright 1995-2003 (C) Sandia Corporation.  All rights 
reserved.      *
*                                                                             
*
*      The C-Space Toolkit (``CSTk'') was developed at Sandia 
National        *
*  Laboratories, which is operated by the Sandia Corporation under 
contract   *
*  for the United States Department of Energy.  The CSTk is is protected 
by   *
*  copyright under the laws of the United States.  CSTk software is not 
to    *
*  be used, disclosed, or duplicated without explicit written 
authorization   *
*  from Sandia 
Corporation.                                                   *
*-----------------------------------------------------------------------------*

STATUS> loading general.tcl from umbra/core/ucl directory
STATUS> loading iTclUtilities.tcl from umbra/core/ucl directory
STATUS> loading monitor.tcl from umbra/core/ucl directory
STATUS> loading XmlSaxParserCore.tcl from umbra/core/ucl directory
STATUS> loading XmlUtils.tcl from umbra/core/ucl directory
STATUS> loading umbTime.tcl from from umbra/core/ucl directory
STATUS> Time Modules simClock & wallClock built
STATUS> loading tkconUmb.tcl from uclLoad.tcl

loading tkconUmb.tcl ... modified version of tkcon.tcl for umbra

STATUS> loading umbraConsole.tcl from uclLoad.tcl
STATUS> loading mkConsoleUmb.tcl from uclLoad.tcl

STATUS> Making the umbra console and a usg::Scene scene



STATUS>         All tcl output will now go to umbra console
STATUS>         Only cout/cerr from C++ will go to this window


--------------------------------------------------------------------------------




NOTE: usg::Scene using usg default data file path list
      path = 
.:/usr/local/share/OpenSceneGraph/data:/usr/local/share/OpenSceneGraph/data/Env:/usr/local/share/OpenSceneGraph/data/fonts:/usr/local/share/OpenSceneGraph/data/Images:/usr/share/OpenSceneGraph/data:/usr/share/OpenSceneGraph/data/Env:/usr/share/OpenSceneGraph/data/fonts:/usr/share/OpenSceneGraph/data/Images
camera number: 0
sched_getaffinity(3502, 128,  { ff, 0, 0, 0 }) = 32
INFO> navigation mode set to umbra
Warning: font file "fonts/arial.ttf" not found.
Setting savConfigCB to '::guiWrapper saveConfig'
sched_getaffinity(3502, 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(3502, 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()

After test_openmp()
Processing CDF File: /home/vision_data/geometry_objects/test.cdf
M(9): Start of CDF Version 1.0 stream
M(1292): End of CDF Version 1.0 stream

Entering UmbModCutCDFDataSet::_CutData(...) cdf_cut
Acummulator replacing data.  New CDF contains 469 points.
No texturing as there are no images
Plotting data for 469 points and 466 polygons.
entering CDFDataSet::plotData
Shape:0 / 13  NumberPoints =8  NumberPolygns=12  NumberLineSegments=0
Shape:1 / 13  NumberPoints =8  NumberPolygns=12  NumberLineSegments=0
Shape:2 / 13  NumberPoints =8  NumberPolygns=12  NumberLineSegments=0
Shape:3 / 13  NumberPoints =62  NumberPolygns=120  NumberLineSegments=0
Shape:4 / 13  NumberPoints =62  NumberPolygns=120  NumberLineSegments=0
Shape:5 / 13  NumberPoints =14  NumberPolygns=24  NumberLineSegments=0
Shape:6 / 13  NumberPoints =14  NumberPolygns=24  NumberLineSegments=0
Shape:7 / 13  NumberPoints =12  NumberPolygns=20  NumberLineSegments=0
Shape:8 / 13  NumberPoints =62  NumberPolygns=120  NumberLineSegments=0
Shape:9 / 13  NumberPoints =4  NumberPolygns=2  NumberLineSegments=0
Shape:10 / 13  NumberPoints =112  NumberPolygns=0  NumberLineSegments=0
Shape:11 / 13  NumberPoints =60  NumberPolygns=0  NumberLineSegments=0
Shape:12 / 13  NumberPoints =36  NumberPolygns=0  NumberLineSegments=0
Shape:13 / 13  NumberPoints =7  NumberPolygns=0  NumberLineSegments=6
exiting CDFDataSet::plotData
DEBUG: Trying to exit.
DEBUG: main loop all done... bye.

End-of-run CumTimer timing results
 Number of entries: 2  Total run time: 2.62966 secs
Id:cdf_cutUmbModCutCDFDataSet::_CutData():          
TotalTime:6.91414e-06    Frac:2.62929e-06    Count:1
Id:cdf_rot_tr_sclRotateTranslateScaleData()          
TotalTime:6.50883e-05    Frac:2.47516e-05    Count:1
BasicDrawParmsGuarantor::cleanup()
cstk::ilWin::finalCleanup()  Cleaning up known windows.
DistEngine::DeleteDfltInst() called.
[EMAIL PROTECTED] rwm]$

***************************************

I hope this helps to find the problem! Please email me with further 
questions as they arise,
Ralph


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37586

Reply via email to