Frage

My MacBookPro, running BootCamp, has an Intel i7-640M processor, which has 2 cores. Like all the other i7 chips, each core is hyperthreaded, so you can have up to 4 threads. Using Visual Studio 2010 c/c++ to determine these:

coresAvailable      =    omp_get_num_procs ( );
threadsAvailable    =    omp_get_max_threads ( ) ;

The "threadsAvailable" comes back with a value of 4, as expected. But "coresAvailable" also is reported as 4.

What am I missing?

War es hilfreich?

Lösung

omp_get_num_procs returns the number of CPUs the OS reports, and since a hyperthreaded core reports itself as 2 CPUs, a dual-core hyperthreaded chip will report itself as 4 processors.

omp_get_max_threads returns the most threads that will be used in a parallel region of code, so it makes sense that the most threads it will use will be the number of CPUs available.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top