8000 ggml-cpu : set openmp wait time if not set (#13758) · ggml-org/llama.cpp@2bd1b30 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2bd1b30

Browse files
authored
ggml-cpu : set openmp wait time if not set (#13758)
1 parent 259469c commit 2bd1b30

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,19 @@ void ggml_cpu_init(void) {
34843484
const uint64_t t_end = ggml_time_us(); UNUSED(t_end);
34853485

34863486
GGML_PRINT_DEBUG("%s: GELU, Quick GELU, SILU and EXP tables initialized in %f ms\n", __func__, (t_end - t_start)/1000.0);
3487+
3488+
#ifdef GGML_USE_OPENMP
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
3498+
}
3499+
#endif
34873500
}
34883501

34893502
#if defined(__ARM_ARCH)

0 commit comments

Comments
 (0)
0