Skip to content

Numa distance matrix? #84

@fda-tome

Description

@fda-tome

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions