This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgomp/37586] New: OpenMP thinks that I have 1 processor on an 8 processor pc
- From: "rrpeter at sandia dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Sep 2008 14:25:20 -0000
- Subject: [Bug libgomp/37586] New: OpenMP thinks that I have 1 processor on an 8 processor pc
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
I have tried various OpenMP examples on the web and got them all to work fine.
When I tried to parallelize some software that is part of a larger project, I
have had a problem; OpenMP reports only one processor available and so I get
only 1 thread. More details follow.
I am running on an dual quad-core PC. I use RHEL 5.2 and have used the gcc
4.3.2 compiler (compiled it myself) and the RedHat's "stock" 4.1.2 compiler
that has had OpenMP backported to it. Both exhibit the same problem.
In some simple example code (e.g., dotproduct_reduction.cpp that found on the
web), I can put in the following print:
#ifdef _OPENMP
cout << " Number of processors available:" << omp_get_num_procs() << " MAX
Number of threads " << omp_get_max_threads() << endl;
cout.flush();
#endif
and get something like:
Number of processors available:8 MAX Number of threads 8
The example runs 8 threads and appears to run on multiple processors.
In my large project on the same computer:
#ifdef _OPENMP
cout << " Number of processors available:" << omp_get_num_procs() << " MAX
number of OpenMP threads " << omp_get_max_threads() << endl;
#endif
and get:
Number of processors available:1 MAX number of OpenMP threads 1
And so it doesn't parallelize. I am stumped! What could be causing OpenMP to be
confused with regard to the number of processors? I thought it might be
something in the compile, so I re-compiled absolutely everything with
"-fopenmp" turned on and it made no difference.
I tried setting the environment variable OMP_NUM_THREADS to 2 and got 2
threads, but only one processor was running the job.
Compile samples:
cd /home/hopper/UMBRA_4/umbra/SNL/rwm/buildRWM/utility && /usr/bin/g++-4.3.2
-DBOOST_ALL_NO_LIB -Dutility_EXPORTS -O3 -DNDEBUG -fopenmp -fPIC
-I/usr/include/boost-1_35 -I/home/hopper/UMBRA_4/umbra/SNL/rwm/TNT
-I/home/hopper/UMBRA_4 -Wall -fPIC -o CMakeFiles/utility.dir/matrix_math.o -c
/home/hopper/UMBRA_4/umbra/SNL/rwm/utility/matrix_math.cpp
cd /home/hopper/UMBRA_4/umbra/SNL/rwm/buildRWM/micp && /usr/bin/g++-4.3.2
-DBOOST_ALL_NO_LIB -Dmicp_EXPORTS -O3 -DNDEBUG -fopenmp -fPIC
-I/usr/include/boost-1_35 -I/home/hopper/UMBRA_4/umbra/SNL/rwm/utility
-I/home/hopper/UMBRA_4/umbra/SNL/rwm/CDF -I/home/hopper/UMBRA_4
-I/home/hopper/UMBRA_4/include/cstk2 -Wall -fPIC -o CMakeFiles/micp.dir/icp.o
-c /home/hopper/UMBRA_4/umbra/SNL/rwm/micp/icp.cpp
Link sample (everything is linked as a shared library)
Linking CXX shared library ../libutility.so
cd /home/hopper/UMBRA_4/umbra/SNL/rwm/buildRWM/utility && /usr/bin/cmake -E
cmake_link_script CMakeFiles/utility.dir/link.txt --verbose=1
/usr/bin/g++-4.3.2 -fPIC -O3 -DNDEBUG -fopenmp -Wl,--no-undefined -shared
-Wl,-soname,libutility.so -o ../libutility.so CMakeFiles/utility.dir/CharObj.o
CMakeFiles/utility.dir/Classify.o CMakeFiles/utility.dir/crc16_func.o
CMakeFiles/utility.dir/crc32_func.o CMakeFiles/utility.dir/dsvdfit.o
CMakeFiles/utility.dir/geometry.o CMakeFiles/utility.dir/math_funcs.o
CMakeFiles/utility.dir/math_predicate.o CMakeFiles/utility.dir/matrix_math.o
CMakeFiles/utility.dir/PCI.o CMakeFiles/utility.dir/rwm_status.o
CMakeFiles/utility.dir/statistics.o CMakeFiles/utility.dir/string_funcs.o
CMakeFiles/utility.dir/timing.o CMakeFiles/utility.dir/utility.o
CMakeFiles/utility.dir/ValIndex.o /usr/local/lib/libumb.so
-Wl,-rpath,/usr/local/lib
BTW, the .tgz file containing the source code (exclude *.o and*.so) for this
project has a size of 315788806, so its huge!
--
Summary: OpenMP thinks that I have 1 processor on an 8 processor
pc
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rrpeter at sandia dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37586