6

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.)

timday
  • 24,582
  • 12
  • 83
  • 135
  • 1
    Not looking good, i.e. no solution for VS: [see this SO post](http://stackoverflow.com/questions/4738045/openmp-huge-performance-differences-between-visual-c-2008-and-2010) and [this social MSDN post](http://social.msdn.microsoft.com/Forums/ja-JP/528479c8-fb70-4b05-83ce-7a552fd49895/performance-problem-using-openmp-with-visual-c-2010?forum=parallelcppnative) indicating as such. – Chris O Dec 23 '13 at 18:33
  • Thanks for the links; "won't fix" from MS - ouch! Glad to see it's not just me anyway. Am actually having some success controlling Gnu's OMP waiting using the more standard OMP_WAIT_POLICY but whatever version of OpenMP that came in with, MS don't support it http://msdn.microsoft.com/en-us/library/6sfk977f%28v=vs.100%29 (or in 2012/2013 either). – timday Dec 23 '13 at 20:24
  • 1
    `OMP_WAIT_POLICY` was added in OpenMP 3.0. Microsoft's OpenMP implementation is 2.0, even with the latest and greatest MSVC compiler. – Hristo Iliev Dec 24 '13 at 21:40

1 Answers1

5

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.

Martijn Berger
  • 166
  • 1
  • 2