- If you are using Intel Threading Building Blocks and OpenMP*
constructs mixed together in rapid succession in the same
program, and you are using Intel compilers for your OpenMP*
code, set KMP_BLOCKTIME to a small value (e.g., 20 milliseconds)
to improve performance. This setting can also be made within
your OpenMP* code via the kmp_set_blocktime() library call. See
the Intel compiler OpenMP* documentation for more details on
KMP_BLOCKTIME and kmp_set_blocktime().
void FireUpJobs( ... )
// Experiments indicate that when oversubscribing, the main thread should wait a little
// while for the RML worker threads to do some work.
if( checker )
// Give RML time to respond to change in number of threads.
/* to deal with cases where the machine is oversubscribed; we want each thread to trip to
try_process() at least once */
/* this should not involve computing the_balance */
// Time fully subscribed run.
double t2 = TimeFindPrimes( tbb::task_scheduler_init::automatic );
// Time parallel run that is very likely oversubscribed.
double t128 = TimeFindPrimes(32); //XBOX360 can't handle too many threads
double t128 = TimeFindPrimes(128);
REMARK("TestFindPrimes: t2==%g t128=%g k=%g\n", t2, t128, t128/t2);
// We allow the 128-thread run a little extra time to allow for thread overhead.
// Theoretically, following test will fail on machine with >128 processors.
// But that situation is not going to come up in the near future,
// and the generalization to fix the issue is not worth the trouble.
if( t128 > 1.3*t2 )