Hi,

I'm trying to allocate and bind memory on the same NUMA domain as the calling 
thread.  The code I use is as follows.


        /* retrieve the single PU where the current thread actually runs within 
this process binding */


          int err = hwloc_get_last_cpu_location(topo, set, 
HWLOC_CPUBIND_THREAD);

          if (err < 0) {

            fprintf(stderr, "failed to get last cpu location\n");

            return NULL;

          }


          int idx = hwloc_bitmap_first(set);

          auto obj = hwloc_get_pu_obj_by_os_index(topo, idx);


          // get NUMA node containing PU

          obj = hwloc_get_ancestor_obj_by_type(topo, HWLOC_OBJ_NODE, obj);

          void * buffer = hwloc_alloc_membind_nodeset(topo, len, obj->nodeset,

                                      HWLOC_MEMBIND_BIND,

                                      HWLOC_MEMBIND_THREAD | 
HWLOC_MEMBIND_STRICT);

          if (!buffer) {

              fprintf(stderr, "failed to manually allocate memory on node 
%u\n", obj->os_index);

              return NULL;

          }

However, for some allocations, if I print out where the allocation was bound, 
it doesn't match the node of the thread.  Any ideas about what I'm doing wrong?

Thanks,Rob Aulwes

Reply via email to