ggml : use SYS_get_cpu if SYS_getcpu is not defined (llama/5906)

Fixes #5694
Fixes ggerganov/whisper.cpp#1894
pull/1943/head
Jared Van Bortel 2024-03-06 15:42:23 -05:00 committed by Georgi Gerganov
parent 2f6f1d4465
commit 1daeffca54
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735
1 changed files with 4 additions and 1 deletions

5
ggml.c
View File

@ -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) {