JuliaParallel / JuliaParallel/Hwloc.jl
Numa distance matrix?
- Dominant language
- Julia
- Stars
- 83
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
What would be necessary to exploit the Hwloc numa distance feature (that is available in the wrapper already)?
I'm interested in implementing it and wanted to follow the templates/models the maintainers recommend to expose the interface in a more friendly manner. The way I've been doing it is through the following code.
```
using Hwloc
topo = Hwloc.topology_init()
Hwloc.topology_load(topo)
nnuma = Hwloc.num_numa_nodes()
if nnuma == 0
println("No NUMA nodes found on this system.")
else
nr = Ref{Cuint}(0)
distances_ptr = Ref{Ptr{Hwloc.LibHwloc.hwloc_distances_s}}(C_NULL)
kind = 0
flags = 0
numa_type = Hwloc.LibHwloc.HWLOC_OBJ_NUMANODE
ret = Hwloc.LibHwloc.hwloc_distances_get_by_type(topo, numa_type, nr, distances_ptr, kind, flags)
if ret != 0 || nr[] == 0 || distances_ptr[] == C_NULL
println("No NUMA distances found or error occurred.")
else
distances = unsafe_load(distances_ptr[])
n = distances.nbobjs
vals = unsafe_wrap(Array, distances.values, (n, n))
println("NUMA distance matrix:")
println(vals)
Hwloc.LibHwloc.hwloc_distances_release(topo, distances_ptr[])
end
end
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the existing Hwloc wrapper and the LibHwloc entry points shown: topology_init, topology_load, hwloc_distances_get_by_type, and hwloc_distances_release. Compare nearby wrapper interfaces and maintainer-recommended templates before deciding how to expose NUMA distances; done means a friendly public interface for retrieving the distance matrix with appropriate handling when no NUMA data is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100