instead of checking on glibc, check on SYS_getcpu

This commit is contained in:
Julia Longtin 2024-03-12 21:07:10 +00:00
parent 78291d93b9
commit b9e2f2a332

3
ggml.c
View file

@ -2521,7 +2521,6 @@ void ggml_numa_init(enum ggml_numa_strategy numa_flag) {
uint current_cpu;
int getcpu_ret = 0;
#if defined(__GLIBC__)
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 28) || defined(__COSMOPOLITAN__)
getcpu_ret = getcpu(&current_cpu, &g_state.numa.current_node);
#else
@ -2529,9 +2528,9 @@ void ggml_numa_init(enum ggml_numa_strategy numa_flag) {
# if !defined(SYS_getcpu) && defined(SYS_get_cpu)
# define SYS_getcpu SYS_get_cpu // some older glibc versions use this name
# endif
# if defined(SYS_getcpu)
getcpu_ret = syscall(SYS_getcpu, &current_cpu, &g_state.numa.current_node);
#endif
#endif /* defined(__GLIBC__) */
if (g_state.numa.n_nodes < 1 || g_state.numa.total_cpus < 1 || getcpu_ret != 0) {
g_state.numa.n_nodes = 0;