[Omp] Controling the number of processors that take part in an openmp program

Micah Elliott mde at micah.elliott.name
Fri Oct 13 07:36:29 PDT 2006


On 2006-10-13 Temp Tmp wrote:

> For example : My computer has 2 cores, and I want to run a program
> that uses 5 threads on 1 core only.

Sounds like Kay and Chris answered the affinity part: taskset or Task
Manager.

> Is there a way to control the number of processors that take part in a
> program that uses the openmp lib?

The number of threads often defaults to the number of processors, but
is implementation dependent.

You can set the environment variable OMP_NUM_THREADS=5, or call
omp_set_num_threads(5), or use the num_threads clause to specify that
you want 5 threads.

-- 
_ _     ___
|V|icah |- lliott
" "     """
mde at micah.elliott.name            <><            http://micah.elliott.name
PGP: 0x7C07CBF0                                         Linux User #417195
HackerKey: v3sw6YUCFhw5ln5pr7OPcr2ma9u8Lw3Dm5l6Ci2e7t3b8DTen6g4a3Xs2MRr5p4


More information about the Omp mailing list