[Openmp-dev] OpenMP code and thread priority on OSX
Cownie, James H via Openmp-dev
openmp-dev at lists.llvm.org
Thu Nov 26 04:54:06 PST 2015
The OpenMP runtime does not manipulate thread priorities
A first skim through https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html doesn't make it clear to me whether threads inherit their priority from their creator.
Since OpenMP threads are created using pthread_create, that page suggests you may need to use pthread_setschedparam inside each thread to bump its priority. (Or you may be able to hack the runtime to pass the priority as an attribute at thread creation time).
BEWARE, though, you will almost certainly also want to change the default sleep behaviour of your OpenMP threads. By default they will spin for 200ms before sleeping in the kernel, which is unlikely to be helpful to the overall user experience if they’re at high-priority! (See KMP_BLOCKTIME).
Overall OpenMP is not designed for concurrency, but for parallelism, and you may find this a hard thing to make work.
James Cownie <james.h.cownie at intel.com>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)
Tel: +44 117 9071438
From: Openmp-dev [mailto:openmp-dev-bounces at lists.llvm.org] On Behalf Of Stéphane Letz via Openmp-dev
Sent: Wednesday, November 25, 2015 4:53 PM
To: openmp-dev at lists.llvm.org
Subject: [Openmp-dev] OpenMP code and thread priority on OSX
We are testing OpenMP aware audio C++ code with clang 3.7 on OSX. Basically this code is later on started in a realtime audio thread, using CoreAudio API on OSX. It seems that master and worker threads do not "inherit" thread priority from the realtime audio thread as we could expect, so the application do not behave reliably (audi drop out…)
Is there any specific set configuration of the libomp library we need to do ? Like environment variable or similar to set up?
Openmp-dev mailing list
Openmp-dev at lists.llvm.org
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the Openmp-dev