I'm failing to understand what hwloc (v1.5) is doing. I'm trying to use hwloc_get_latency() to determine the distance between two cores.
The two cores are on different sockets. According to libnuma's numactl, the latency between the two sockets is 20, whereas between cores on the same socket is 10. According to hwloc-ls -v, the latency is 2.0, whereas between cores on the same socket is 1.0. Thus, I know that hwloc is getting topology information.
However, programmatically, hwloc_get_latency() just returns -1. I tried using hwloc_get_whole_distance_matrix_by_depth(), and found that the distance matrix is only defined for depth 0, which, according to hwloc_obj_type_string(hwloc_get_depth_type(topology, 0)) is "Machine". Now, the documentation for hwloc_get_whole_distance_matrix_by_depth() says it returns "a distances structure containing a matrix with all distances between all objects at the given depth". Given that I only have one object that depth 0 (just the one machine), what does this mean? If I try with depth 1 (aka "NUMANode" or HWLOC_OBJ_NODE), I get NULL back, suggesting that there is no matrix of distances between NUMANodes. Of course, that's not true; hwloc-ls reports that matrix! So what's going on here?
And why is hwloc_get_latency() failing?
Kyle B. Wheeler
Dept. 1423: Scalable System Software
Sandia National Laboratories