Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] hwloc_cpuset_t to cgroups cpuset conversion
From: Rayson Ho (raysonlogin_at_[hidden])
Date: 2012-06-19 03:13:02

Thanks Brice, it's exactly what I need.

I checked the docs, linux-libnuma.h, and linux.h earlier but I could
not find what I needed, as it did not mention cpuset or cgroups :-)

However, the hwloc_bitmap_list_snprintf() function you pointed me to
is exactly the format used by cpuset cgroups (and the older Linux
cpuset), and now I can finally get some sleep (it's 3am here!!).

Thanks again!


Open Grid Scheduler - The Official Open Source Grid Engine

On Tue, Jun 19, 2012 at 2:55 AM, Brice Goglin <Brice.Goglin_at_[hidden]> wrote:
> Hello,
> Isn't this what hwloc_bitmap_list_sscanf/snprintf/asprintf do ? (added
> in 1.2.0)
> Brice
> Le 19/06/2012 08:32, Rayson Ho a écrit :
>> hwloc already has code (linux-libnuma.h) for hwloc_cpuset_t to libnuma
>> data type conversion. Does it make sense to add functions to convert
>> hwloc_cpuset_t types to the cpuset string format used by Linux's
>> cgroups?
>> The cpuset format used by cgroups is not difficult to handle (in fact,
>> the user interface is same as/very similar to the older cpuset
>> implementation). Eg. create a cpuset that includes CPU 2 & 3 for
>> OGS/Grid Engine:
>> # echo 2-3 > /sys/fs/cgroup/cpuset/gridengine/cpuset.cpus
>> Ref:
>> We are pinging the list because we use hwloc for topology binding, and
>> we also added cgroups support (for a lot of things) in OGS/Grid
>> Engine:
>> We are planning to integrate hwloc & cgroups (and skip libnuma)... And
>> we want to choose which method we use at runtime. While hwloc can be
>> used by non-root applications, the applications can modify the
>> affinity mask themselves and thus they can escape from the "cpuset"
>> (as least with the current hwloc implementation that uses
>> sched_setaffinity). The cgroups cpuset support is only available to
>> root, but once binded, batch jobs running as non-root could not escape
>> from the cpuset.
>> Rayson