MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / clear_numa_thread_affinity

Function clear_numa_thread_affinity

ggml.c:16552–16572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16550}
16551
16552static void clear_numa_thread_affinity(void) {
16553 if (!ggml_is_numa()) {
16554 return;
16555 }
16556
16557 size_t setsize = CPU_ALLOC_SIZE(g_state.numa.total_cpus);
16558
16559 cpu_set_t * cpus = CPU_ALLOC(g_state.numa.total_cpus);
16560 CPU_ZERO_S(setsize, cpus);
16561 for (unsigned i = 0; i < g_state.numa.total_cpus; ++i) {
16562 CPU_SET_S(i, setsize, cpus);
16563 }
16564
16565 int rv = pthread_setaffinity_np(pthread_self(), setsize, cpus);
16566 if (rv) {
16567 fprintf(stderr, "warning: pthread_setaffinity_np() failed: %s\n",
16568 strerror(rv));
16569 }
16570
16571 CPU_FREE(cpus);
16572}
16573#else
16574// TODO: Windows etc.
16575// (the linux implementation may also work on BSD, someone should test)

Callers 1

ggml_graph_computeFunction · 0.70

Calls 2

fprintfFunction · 0.85
ggml_is_numaFunction · 0.70

Tested by

no test coverage detected