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 07:27:10


Gabriele Fatigati, le Fri 29 Jul 2011 13:24:17 +0200, a écrit :
> yhanks for yout quick reply!
>
> But i have a litte doubt. in a non SMT machine, Is it better use this:
>
> hwloc_obj_t core = hwloc_get_obj_by_type(topology, HWLOC_OBJ_CORE, tid);
> hwloc_cpuset_t set = hwloc_bitmap_dup(core->cpuset);
> hwloc_bitmap_singlify(set);
> hwloc_set_cpubind(topology, set,  HWLOC_CPUBIND_THREAD);
>
> or:
>
> hwloc_obj_t core = hwloc_get_obj_by_type(topology, HWLOC_OBJ_PU, tid);
> hwloc_cpuset_t set = hwloc_bitmap_dup(core->cpuset);
> hwloc_bitmap_singlify(set);
> hwloc_set_cpubind(topology, set,  HWLOC_CPUBIND_THREAD);
>
> because work in the same way( i suppose).

They'll both work about the same way on SMT too, since in the end it'll
pick up only one thread. Whether you want to assign threads to cores or
threads then depends on your application: do you want to let its threads
share a core or not.

Samuel