Le 15/12/2015 05:57, Rezaul Karim Raju a écrit :
> *OUTPUT: *
> *Policy-->* buffer(Array: A) *membind [default OS binding] Policy is:=
> 1 [1 refers to *HWLOC_MEMBIND_FIRSTTOUCH
> <https://www.open-mpi.org/projects/hwloc/doc/v1.11.1/a00083.php#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0>*]*
> *Nodeset --> *buffer(Array: A) bound to nodeset*0x000000ff *with
> contains*:*
> * *node #0 (OS index 0) with 8387047424 bytes of memory
>  node #1 (OS index 1) with 8471617536 bytes of memory
>  node #2 (OS index 2) with 8471621632 bytes of memory
>  node #3 (OS index 3) with 8471617536 bytes of memory
>  node #4 (OS index 4) with 8471621632 bytes of memory
>  node #5 (OS index 5) with 8471617536 bytes of memory
>  node #6 (OS index 6) with 8471621632 bytes of memory
>  node #7 (OS index 7) with 8471564288 bytes of memory
> *
> *
> *why it shows allocated memory is bound to all available nodeset..?
> should it not be allocated to a specific nodeset one ..?*
> *
> *

Hello

You are confusing the "binding" and the "actual location". Your memory
buffer isn't bound to a specific location by default. But Linux has to
allocate it somewhere. So your buffer is "located" in some node after
the allocation, but it is not "bound" there (what get_area_membind
returns) which means Linux could have allocated it somewhere else.

hwloc cannot currently return the "location" of a memory buffer. I have
been thinking about adding this feature in the past, but it looks like
you are the first actual user requesting this. We could add something like
hwloc_get_last_memory_location(topology, input buffer, outputnodeset)
At least on Linux that's possible.

For clarity, this is similar to the difference between
hwloc_get_cpubind() and hwloc_get_last_cpu_location(): A task always
runs on a specific PU, even if it is not bound to anything specific PU.

Brice




> *If I write as below: *
>
> /* Get last node. */
>     n = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_NODE);
>     if (n) {
>
>         
>         void *m;
> int prev_val, next_val;
>         size = sizeof(int); //1024*1024;
>
>         obj = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NODE, n - 1);
>         m = *hwloc_alloc_membind_nodeset(*topology, size,
> *obj->nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_PROCESS*);
>         hwloc_free(topology, m, size);
>
>         m = malloc(size);
>         // touch the m memory 
> m = &prev_val;
> *(int*)m = 1010;
>         *hwloc_set_area_membind_nodeset(*topology, m, size,
> *obj->nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_STRICT*);
> //HWLOC_MEMBIND_DEFAULT:= Reset the memory allocation policy to the
> system default(HWLOC_MEMBIND_FIRSTTOUCH (Linux)).
> */* check where buffer(m) is allocated */*
> nodeset = hwloc_bitmap_alloc();
> *hwloc_get_area_membind_nodeset(topology, m, size, nodeset,
> &nodepolicy, 0); *
>
> /* check the binding policy */
> printf("buffer(m) membind-ed policy is %d \n", nodepolicy);
> /* print the corresponding NUMA nodes */
> hwloc_bitmap_asprintf(&s, nodeset);
> printf("buffer bound to nodeset %s with contains:\n", s);
> free(s);
> hwloc_bitmap_foreach_begin(i, nodeset) {
> obj = hwloc_get_numanode_obj_by_os_index(topology, i);
> printf("  node #%u (OS index %u) with %lld bytes of memory\n",
> obj->logical_index, i, (unsigned long long) obj->memory.local_memory);
> } hwloc_bitmap_foreach_end();
> hwloc_bitmap_free(nodeset);
>
> *OUTPUT: *
> *Policy:* buffer(Array: A) membind *[default OS binding] Policy is:= 2*
> *Nodeset: *    buffer(Array: A) *bound to nodeset 0x00000080* with contains:
>   *node #7 (OS index 7) *with 8471564288 bytes of memory
> In this case it shows the specific nodeset one where the memory is
> allocated. 
>
> *Can you please comment and explain what is happening underneath ..?
> Thanking you in advance.* 
>
> ------------------------
> RaJu, Rezaul Karim
> Graduate Student (PhD) | Computer Science | University of Houston
> Research in High Performance Computing Tools  
> Houston, Texas-77004
>
>
> _______________________________________________
> hwloc-users mailing list
> hwloc-us...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
> Link to this post: 
> http://www.open-mpi.org/community/lists/hwloc-users/2015/12/1225.php

Reply via email to