Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Microsoft's OpenMP spinlock time be controlled?

The OpenMP used by the Intel compiler supports an environment variable KMP_BLOCKTIME (docs) which I believe controls the busy-waiting (spinlocked) time the threads will spend waiting for new work (linked document claims this defaults to 200ms).

The OpenMP used by the Gnu compiler supports an environment variable GOMP_SPINCOUNT (docs) which I believe also controls that library's equivalent implementation detail (although apparently expressed as an iteration count rather than a time).

My question is: what control(s) (if any) do Microsoft provide to control this parameter in the OpenMP used by the Microsoft compiler? (It's VS2010 that interests me currently.)

(I'm well aware that if my program's parallelism was entirely OpenMP based there would be little reason to worry about this, but my interest is provoked by some vtune traces from a large complex system which also makes significant use of TBB.)

like image 638
timday Avatar asked Dec 23 '13 17:12

timday


1 Answers

Microsoft Visual Studio 2010 SP1 and higher seem to do support OMP_WAIT_POLICY as seen in this Knowledge base article

setting OMP_WAIT_POLICY to PASSIVE does fix the issue for me when compiling with Visual Studio 2013.

like image 168
Martijn Berger Avatar answered Nov 12 '22 08:11

Martijn Berger