Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get node distance (hops) in NUMA systems

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') ?

like image 332
Gratian Lup Avatar asked Oct 15 '22 11:10

Gratian Lup


1 Answers

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.

like image 105
janneb Avatar answered Oct 17 '22 14:10

janneb