Hi,
I'm not able to detect the number of processors using
omp_get_num_procs() on
a macintosh.
I've installed gcc/g++ v4.3 from hpc.sourceforge.net (the "Tiger"
version)
[Url 1 below]. (Installed = extracted to /)
$ g++ --version
g++ (GCC) 4.3.0 20080125 (experimental)
I compile the code below with no problems.
$ g++ -fopenmp main.cpp -o openmpTest
When the code executes omp_get_num_procs() detects 1 processor.
$ ./openmpTest
num procs 1
thread 0 i: 0
thread 0 i: 1
thread 0 i: 2
thread 0 i: 3
thread 0 i: 4
thread 0 i: 5
thread 0 i: 6
thread 0 i: 7
thread 0 i: 8
thread 0 i: 9
This macintosh has two physical chips and 2 cores per chip.
$ sysctl hw
[...]
hw.ncpu: 4
hw.activecpu: 4
[...]
Does anybody know why omp_get_num_procs() is returning 1 on this
machine?
Let me know if you need more info!
Thanks,
C.
[1]http://prdownloads.sourceforge.net/hpc/gcc-intel-bin.tar.gz?download
-
// "g++ -fopenmp main.cpp -o openmpTest"
#include
#ifdef _OPENMP // defined at compile time by -fopenmp
#include
#endif
using namespace std;
int main (int argc, char **argv) {
int n_iters = 10;
#ifdef OMP_H// defined in header omp.h
cout<<"num procs "<