Get node distance (transitions) on NUMA systems

Is there any API / way to get a "distance" (called "hops" in the literature) between two NUMA nodes? I want to implement a memory allocation system that uses this (reusing memory from the nearest node because access is faster).
Windows doesn't seem to have such a feature ... and libnuma (under Linux) doesn't seem to have this. Is there any way to get this information (even with something like "cpuid")?

+5
source share
2 answers

For Linux, you can get the topology, at least by parsing / proc. This is explained, for example, in chapter 5 by Ulrich Drapper β€œWhat Every Programmer Should Know About Memory” . Chapter 6.5 also matters.

+2
source

Take a look at the library and tools in hwloc .

+2
source

All Articles