5

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

Dervin Thunk
  • 19,515
  • 28
  • 127
  • 217
Gratian Lup
  • 1,485
  • 3
  • 19
  • 29

2 Answers2

2

For Linux it's possible to get the topology at least by parsing /proc. This is explained e.g. in chapter 5 of Ulrich Drepper's "What every programmer should know about memory". Chapter 6.5 is also somewhat relevant.

janneb
  • 36,249
  • 2
  • 81
  • 97
2

Have a look at the library and tools in hwloc.

Phil Miller
  • 36,389
  • 13
  • 67
  • 90