Le 25/09/2011 11:14, Gabriele Fatigati a écrit :

I report my  questions in a different way (in the first question i did a mistake):


1) I don't understand the means of set_membind() function. Why I should to allocate in a node "near" my cpuset and not in my local node (where thread or process runs?)

It's exactly the same. Your local node is near the cpuset that contains the CPUs that are close to this node.

2) Which is the behaviour of HWLOC_MEMBIND_BIND  flag? 

From the manual:

"Allocate memory on the specified nodes."

It means that I can allocate without binding the memory?

It's about physical memory allocation (first touch causing a fault causing a page to be allocated), not about virtual memory (malloc).

What happens if one thread allocate and another thread in another node  read/write for the first time this memory? In a little example I see the memory is allocated on the second thread, not where first thread does malloc().  So, when I have to use HWLOC_MEMBIND_BIND flag? Or it has nothing to do with binding?

If the effective allocation is done when first thread touch the memory, which is the means of this flag?

The flag says "when the first touch occurs and the physical memory is allocated for real, don't allocate on the local node (default), but rather allocate where specified by set_membind".

2) My goal is to replicate the behaviour of set_area_membind_nodeset() in some manner for all futures allocation without call this function each time I allocate some memory. Is it possible to do this?

set_membind_nodeset() with BIND and the nodeset containing the nodes where physical memory should be allocated.

Brice