The docs for Hwloc library state that the logical indices of Processor units used by Hwloc are not the same as the indices used by OS.
- How does one map Hwloc logical indices to OS indices?
- Is this functionality exposed in Hwloc.jl wrapper?
The docs for Hwloc library state that the logical indices of Processor units used by Hwloc are not the same as the indices used by OS.
AFAIU, that can be system / OS dependent. So there is no unique answer here.
No, because of the above.
In ThreadPinning.jl (which only works on Linux) I parse the output of lscpu --all --extended
to get the OS indices.
Actually, it seems that Hwloc objects store both logical index assigned by Hwloc and an index assigned by os. Look at the picture at the bottom of this page.
Ok. Now I am really confused.
I looked at this line in the source code of Hwloc.jl.
What I see, is that all hwloc objects indeed have the field os_index
. It is actually used to print the topology.
It seems, that I can get the os indices of all processing units by doing
using Hwloc
collectobjects(:PU) .|> x->getproperty(x, :os_index)
@carstenbauer Do you want to say, that the field os_index
does not actually correspond to the index used by OS?
I believe to remember that I had a case where hwloc and lscpu didn’t agree but maybe I’m hallucinating. Sorry that I can’t clarify. Given that the field is called os_index
I would think (and hope) that it’s correct and what you’re looking for.
Could it be that you compared an hwloc logical_index
with the output of lscpu?
If you really observed a discrepancy, may be it is a good idea to file an issue with the hwloc library. Yeah, if only we had time for everything.