My goal is to set memory binding policy for future allocations for each thread.

So, according to definition of set_membind function:

"Set the default memory binding policy of the current process or thread to prefer the
NUMA node(s) near the specified cpuset."

and according to definition of HWLOC_MEMBIND_BIND flag:

"Allocate memory on the specified nodes."

Merging togheter, I expect to set memory policy  of thread/process equal to allocate memory on local node. But in my example,

after done this, memory is allocated not in a local node of thread that does set_membind and malloc, but in node of  thread that touches it. And I don't understand this behaviour :(


2011/9/25 Brice Goglin <Brice.Goglin@inria.fr>
Le 25/09/2011 20:27, Gabriele Fatigati a écrit :
if(tid==0){

 set_membind(HWLOCMEMBIND_BIND, node 0)
 malloc(array)...

}

if (tid==1){
 set_membind(HWLOCMEMBIND_BIND, node 1)

for(i...)
  array(i)
}

end parallel region


array is allocated on node 1, not node 0 as I expected So it seems set_membind() of second thread influence in some manner array allocation using first touch.

Why do you call set_membind() here? It's whole point is to change the allocation policy of the current thread. If this thread then first-touches some data, this data will obviously get allocated acocording to set_membind().

If you don't want set_membind() to modify the allocation policy of the current thread, why do you call it?

Brice



_______________________________________________
hwloc-users mailing list
hwloc-users@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users



--
Ing. Gabriele Fatigati

HPC specialist

SuperComputing Applications and Innovation Department

Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy

www.cineca.it                    Tel:   +39 051 6171722

g.fatigati [AT] cineca.it