Open MPI logo

Hardware Locality Users' Mailing List Archives

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

Subject: Re: [hwloc-users] Windows api threading functions equivalent to hwloc?
From: Samuel Thibault (samuel.thibault_at_[hidden])
Date: 2012-11-19 17:36:09

Brice Goglin, le Mon 19 Nov 2012 21:09:33 +0100, a écrit :
> hwloc_bitmap_t bitmap = hwloc_bitmap_alloc();
> hwloc_bitmap_set_only(bitmap, i);
> hwloc_set_thread_cpubind(topology, m_threads[i], bitmap, 0);
> hwloc_bitmap_free(bitmap);

Or perhaps

hwloc_set_thread_cpubind(topology, m_threads[i],
        hwloc_get_obj_by_type(topology, HWLOC_OBJ_CORE, i),

if you want to get core number in logical order rather than physical
order (or use HWLOC_OBJ_PU if that's the hardware threads you want to

> To get the number of processors with hwloc, use something like:
> hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_CORE);
> or
> hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_PU);
> Then it depends if you want real cores (the former or hardware threads (the
> latter).