instead of checking on glibc, check on SYS_getcpu
This commit is contained in:
parent
78291d93b9
commit
b9e2f2a332
1 changed files with 1 additions and 2 deletions
3
ggml.c
3
ggml.c
|
@ -2521,7 +2521,6 @@ void ggml_numa_init(enum ggml_numa_strategy numa_flag) {
|
||||||
uint current_cpu;
|
uint current_cpu;
|
||||||
int getcpu_ret = 0;
|
int getcpu_ret = 0;
|
||||||
|
|
||||||
#if defined(__GLIBC__)
|
|
||||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 28) || defined(__COSMOPOLITAN__)
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 28) || defined(__COSMOPOLITAN__)
|
||||||
getcpu_ret = getcpu(¤t_cpu, &g_state.numa.current_node);
|
getcpu_ret = getcpu(¤t_cpu, &g_state.numa.current_node);
|
||||||
#else
|
#else
|
||||||
|
@ -2529,9 +2528,9 @@ void ggml_numa_init(enum ggml_numa_strategy numa_flag) {
|
||||||
# if !defined(SYS_getcpu) && defined(SYS_get_cpu)
|
# if !defined(SYS_getcpu) && defined(SYS_get_cpu)
|
||||||
# define SYS_getcpu SYS_get_cpu // some older glibc versions use this name
|
# define SYS_getcpu SYS_get_cpu // some older glibc versions use this name
|
||||||
# endif
|
# endif
|
||||||
|
# if defined(SYS_getcpu)
|
||||||
getcpu_ret = syscall(SYS_getcpu, ¤t_cpu, &g_state.numa.current_node);
|
getcpu_ret = syscall(SYS_getcpu, ¤t_cpu, &g_state.numa.current_node);
|
||||||
#endif
|
#endif
|
||||||
#endif /* defined(__GLIBC__) */
|
|
||||||
|
|
||||||
if (g_state.numa.n_nodes < 1 || g_state.numa.total_cpus < 1 || getcpu_ret != 0) {
|
if (g_state.numa.n_nodes < 1 || g_state.numa.total_cpus < 1 || getcpu_ret != 0) {
|
||||||
g_state.numa.n_nodes = 0;
|
g_state.numa.n_nodes = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue