Skip to content

Commit 9f85363

Browse files
committed
set KMP_BLOCKTIME instead
1 parent 1c55fd6 commit 9f85363

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,8 +3486,15 @@ void ggml_cpu_init(void) {
34863486
GGML_PRINT_DEBUG("%s: GELU, Quick GELU, SILU and EXP tables initialized in %f ms\n", __func__, (t_end - t_start)/1000.0);
34873487

34883488
#ifdef GGML_USE_OPENMP
3489-
if (!getenv("OMP_WAIT_POLICY")) {
3490-
putenv("OMP_WAIT_POLICY=active");
3489+
//if (!getenv("OMP_WAIT_POLICY")) {
3490+
// // set the wait policy to active, so that OpenMP threads don't sleep
3491+
// putenv("OMP_WAIT_POLICY=active");
3492+
//}
3493+
3494+
if (!getenv("KMP_BLOCKTIME")) {
3495+
// set the time to wait before sleeping a thread
3496+
// this is less aggressive than setting the wait policy to active, but should achieve similar results in most cases
3497+
putenv("KMP_BLOCKTIME=200"); // 200ms
34913498
}
34923499
#endif
34933500
}

0 commit comments

Comments
 (0)