Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] Thread core affinity
From: Samuel Thibault (samuel.thibault_at_[hidden])
Date: 2011-07-29 06:50:07


Hello,

Gabriele Fatigati, le Fri 29 Jul 2011 12:43:47 +0200, a écrit :
> I'm so confused. I see couples of cores with the same core id! ( Core#8 for
> example)  How is it possible? 

That's because they are on different sockets. These are physical IDs
(not logical IDs), and are thus not garanteed to be unique.

> 2) logical Core id and Physical core id maybe differents. If i want to be sure
> that id 0 and id 1 are physically near, i have to use core id or PU id? PU ids
> are ever physically near?

Using core or thread ID does not matter. What matters is that you take
the proper ID. Physical IDs will in general never bring you any
proximity indication. What you want is logical IDs, which hwloc takes
care of meaning proximity. Using adjacent logical IDs (be it for core or
threads) will bring you adjacent cores/threads.

> 3) Binding a thread on a core, what's the difference between hwloc_set_cpubind
> () and hwloc_set_thread_cpubind()? More in depth, my code example works well
> with:
>
> hwloc_set_cpubind(topology, set,  HWLOC_CPUBIND_THREAD);
>
> and crash with:
>
> hwloc_set_thread_cpubind(topology, tid, set,  HWLOC_CPUBIND_THREAD);

Note that tid is hwloc_thread_t, i.e. pthread_t on unixes.
It is not a (Linux-specific) tid. If what you have is a (Linux-specific)
tid, use the Linux-specific function, hwloc_linux_set_tid_cpubind.

Samuel