[Omp] Noob question about processors

Klaas Vantournhout Klaas.Vantournhout at UGent.be
Wed Apr 26 01:47:09 PDT 2006


Hi,

I just started with using OpenMP on the gcc4.2 compiler.  And I have a
couple of questions.

My first concern is the following, if I have a node with lets say 2 Xeon
processors with hyper threading enabled, and I use 4 threads in my
openmp implementation, will those threads be evenly spread over the 2
processors (so 1 thread over each of the 4 virtual processors) or do I
have to do some special kernel stuff that this would happen?

Finally I am wondering about the following,   I would like to compile my
code on a couple of machines separately, and the amount of threads I
have depend on the amount of real/virtual processors.  Is there a
preprocessor directive which obtains the amount of cpus?  In that way I
could do something like

#if NCPU != 1
#include <omp.h>
#endif

...

#if NCPU != 1
#pragma omp parallel private(tid)
#endif

Thanks

Klaas
-- 
"Several billion trillion tons of superhot
exploding hydrogen nuclei rose slowly above
the horizon and managed to look small, cold
and slightly damp."
	Douglas Adams - The Hitch Hickers
		Guide to the Galaxy


More information about the Omp mailing list