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: Gabriele Fatigati (g.fatigati_at_[hidden])
Date: 2011-07-29 07:23:34


Hi Samuel,

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).

2011/7/29 Samuel Thibault <samuel.thibault_at_[hidden]>

> 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
> _______________________________________________
> hwloc-users mailing list
> hwloc-users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
>

-- 
Ing. Gabriele Fatigati
Parallel programmer
CINECA Systems & Tecnologies Department
Supercomputing Group
Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
www.cineca.it                    Tel:   +39 051 6171722
g.fatigati [AT] cineca.it