Skip to content

Commit 069d671

Browse files
committed
ggml : use SYS_get_cpu if SYS_getcpu is not defined
Fixes #5694 Fixes ggml-org/whisper.cpp#1894
1 parent e25fb4b commit 069d671

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ggml.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,10 @@ void ggml_numa_init(enum ggml_numa_strategy numa_flag) {
21542154
getcpu_ret = getcpu(&current_cpu, &g_state.numa.current_node);
21552155
#else
21562156
// old glibc doesn't have a wrapper for this call. Fall back on direct syscall
2157-
getcpu_ret = syscall(SYS_getcpu,&current_cpu,&g_state.numa.current_node);
2157+
# if !defined(SYS_getcpu) && defined(SYS_get_cpu)
2158+
# define SYS_getcpu SYS_get_cpu // some older glibc versions use this name
2159+
# endif
2160+
getcpu_ret = syscall(SYS_getcpu, &current_cpu, &g_state.numa.current_node);
21582161
#endif
21592162

21602163
if (g_state.numa.n_nodes < 1 || g_state.numa.total_cpus < 1 || getcpu_ret != 0) {

0 commit comments

Comments
 (0)