Open MPI logo

Hardware Locality Users' Mailing List Archives

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

Subject: Re: [hwloc-users] Problem getting cpuset of MPI task
From: Samuel Thibault (samuel.thibault_at_[hidden])
Date: 2011-02-09 11:06:34


Hendryk Bockelmann, le Wed 09 Feb 2011 16:57:43 +0100, a écrit :
> Since I am new to hwloc there might be a misunderstanding from my side,
> but I have a problem getting the cpuset of MPI tasks.

> /* get native cpuset of this process */
> cpuset = hwloc_bitmap_alloc();
> hwloc_get_cpubind(topology, cpuset, 0);

get_cpubind gives where the threads are bound, not where they are
actually running. If you haven't bound them yourself, the default is no
binding, i.e. all CPUs are allowed, thus a full mask, that's why you get
0xf for all of them.

> hwloc_bitmap_singlify(cpuset);

Singlify is just an operation on the resulting cpu mask, taking the
first of them. That's why you end up with just 0x1.

Adding a function that returns where threads are actually running is on
the TODO list for hwloc 1.2.

Samuel