summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Van Bortel <jared@nomic.ai>2024-03-06 15:42:23 -0500
committerGitHub <noreply@github.com>2024-03-06 15:42:23 -0500
commite04e04f8fad549bb0b3ec1c91f0413aeb08baf29 (patch)
tree714f5259e103fcbcb2494a135addcae48efa8921
parente25fb4b18fcedb9bed6be4585cf842e9a669b28b (diff)
ggml : use SYS_get_cpu if SYS_getcpu is not defined (#5906)
Fixes #5694 Fixes ggerganov/whisper.cpp#1894
-rw-r--r--ggml.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ggml.c b/ggml.c
index 6a10bbcb..92b17ee6 100644
--- a/ggml.c
+++ b/ggml.c
@@ -2154,7 +2154,10 @@ void ggml_numa_init(enum ggml_numa_strategy numa_flag) {
getcpu_ret = getcpu(&current_cpu, &g_state.numa.current_node);
#else
// old glibc doesn't have a wrapper for this call. Fall back on direct syscall
- getcpu_ret = syscall(SYS_getcpu,&current_cpu,&g_state.numa.current_node);
+# if !defined(SYS_getcpu) && defined(SYS_get_cpu)
+# define SYS_getcpu SYS_get_cpu // some older glibc versions use this name
+# endif
+ getcpu_ret = syscall(SYS_getcpu, &current_cpu, &g_state.numa.current_node);
#endif
if (g_state.numa.n_nodes < 1 || g_state.numa.total_cpus < 1 || getcpu_ret != 0) {