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-08-04 05:55:37


Gabriele Fatigati, le Mon 01 Aug 2011 12:32:44 +0200, a écrit :
> So, are not physically near. I aspect that with Hyperthreading, and 2 hardware
> threads each core, PU P#0 and PU P#1 are on the same core.

Since these are P#0 and 1, they may not be indeed (physical indexes).
That's the whole problem of the indexes provided by operating systems.


> If is it not true,
> using in a OMP PARALLEL region with 2 software threads:
> $ pragma omp paralle num_threads(2)
> tid= omp_get_thread_num();
> 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);
> i would bind thread 0 on PU P#0 and thread 1 on PU P#1, supposing are
> physically near.

No, because hwloc functions do not use physical, but logical indexes,
which it computes according to the topology. Use lstopo --top to check
the actual binding being used.