Vendor-specific OpenMP Issues
- By default Intel OpenMP threads stay active and spin for 200ms after they complete
a task. The spin makes the threads fast to restart, but it consumes CPU cycles. 200ms
is a very long time to spin for an application like Maya, since a single OpenMP loop
evaluated as part of an animation playing at any more than 5fps could keep all CPUs
busy spinning all the time. Such spinning would interfere with other threads in the
application and also other applications on the system. For this reason we explicitly
set the spin-wait time to zero in Maya, and only use nonzero values temporarily for
specific closely packed loops where the spinning produces a noticeable performance
benefit, being sure to reset it to zero afterwards.
If you are using Intel OpenMP in a plug-in, and want to set a nonzero spin-wait time
you can include the Intel compiler version of the header file omp.h and then use the kmp_set_blocktime() function. However, be very careful to set the spin wait time back to zero before
exiting the plug-in and returning control to Maya: kmp_set_blocktime(0);
- Microsoft OpenMP threads do not spin-wait, and therefore do not have the above concern.
However this can lead to lower performance where multiple threaded regions are run
in close succession, as the thread pool must be woken up each time.
- Guided scheduling is unreliable in the OpenMP implementation of Visual Studio 2005,
sometimes producing incorrect results. If you are using Visual Studio 2005, make sure
to test the results or avoid using this scheduling model. A better alternative is
to use Visual Studio 2012 with the guided scheduling model.