This change has OMP_WAIT_POLICY=active to mean that threads will busy-wait in spin loops and virtually never go to sleep. OMP_WAIT_POLICY=passive now means that threads will immediately go to sleep inside a spin loop. KMP_BLOCKTIME was the previous mechanism to specify this behavior via KMP_BLOCKTIME=0 or KMP_BLOCKTIME=infinite, but the standard OpenMP environment variable should also be able to specify this behavior.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This change has OMP_WAIT_POLICY=active to mean that threads will busy-wait in spin loops and virtually never go to sleep. OMP_WAIT_POLICY=passive now means that threads will immediately go to sleep inside a spin loop. KMP_BLOCKTIME was the previous mechanism to specify this behavior via KMP_BLOCKTIME=0 or KMP_BLOCKTIME=infinite, but the standard OpenMP environment variable should also be able to specify this behavior.
To clarify, is this a change in behavior for OMP_WAIT_POLICY=active, or just for OMP_WAIT_POLICY=passive?
To clarify, is this a change in behavior for OMP_WAIT_POLICY=active, or just for OMP_WAIT_POLICY=passive?
Both actually.
A bit more details: earlier the OMP_WAIT_POLICY was attributed to the KMP_LIBRARY functionality, so the difference between active and passive behavior was the presence of "yield" calls for passive. Thus the majority of applications don't see any difference because of setting OMP_WAIT_POLICY. The blocktime affects performance much stronger than yields, so we decided to make the OMP_WAIT_POLICY more sensitive and added the functionality of KMP_BLOCKTIME to it.
In summary:
Old:
OMP_WAIT_POLICY-active threads spin for the default blocktime, no yields, then go to sleep. OMP_WAIT_POLICY=passive threads spin for the default blocktime calling yields, then go to sleep.
New:
OMP_WAIT_POLICY-active threads spin forever, no yields. OMP_WAIT_POLICY=passive threads do not spin, go to sleep immediately.
Of cause additional setting of the KMP_BLOCKTIME will change the behavior.