[Omp] Noob question about processors

Kay Diederichs kay.diederichs at uni-konstanz.de
Thu Apr 27 03:06:50 PDT 2006


Terboven, Christian wrote:
... (deleted)
 > Scheduling depends on the OpenMP runtime library and the operating
 > system.
 > AFAIK the combination gcc/linux does not provide reliable mechanisms
 > to bind threads to processors.

not quite true - please see below

 > You can expect that if your program is the
 > only one running on that node only one thread at a time will run on
 > given processor, but you will probably experience your threads changing
 > the processors very often. This situation is different on Solaris (for
 > example) where you can do explicit thread binding.
 >
... (deleted)

Under Linux (kernel 2.6), you can use the "taskset" command (on Redhat 
distros: part of the "schedutils" package) to bind to specific 
processors. The bitmask specified by "taskset" is inherited by children 
of a process.

For example, you can put the line
taskset -pc 0-3 $$
into the shell script which starts your program. This will make the 
program run only on the first four processors of your machine.

If you specify as many processors in "taskset" as you use threads during 
execution of your OpenMP program, the kernel will not swap threads 
between processors. This is due to the kernel's "scheduling affinity".

HTH,

Kay
-- 
Kay Diederichs   http://strucbio.biologie.uni-konstanz.de/~kay
email: Kay.Diederichs at uni-konstanz.de  Tel +49 7531 88 4049 Fax 3183
Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3211 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.openmp.org/pipermail/omp/attachments/20060427/450dcf51/smime.bin


More information about the Omp mailing list