2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright (c) 2021 PANTHEON.tech s.r.o.
10 if os.name == 'posix':
11 if os.path.isdir('/sys/devices/system/node'):
12 numa_nodes = glob.glob('/sys/devices/system/node/node*')
14 print(int(os.path.basename(numa_nodes[-1])[4:]) + 1)
16 subprocess.run(['sysctl', '-n', 'vm.ndomains'], check=False)
19 libkernel32 = ctypes.windll.kernel32
21 numa_count = ctypes.c_ulong()
23 libkernel32.GetNumaHighestNodeNumber(ctypes.pointer(numa_count))
24 print(numa_count.value + 1)