bgoglin_at_[hidden], le Fri 04 Feb 2011 11:36:55 +0100, a écrit :
> + HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_BINDING = (1<<2),
> + /**< \brief Restrict the discovered topology to only objects included
> + * in the current thread CPU binding.
> + * \hideinitialize
> + *
> + * This is similar to loading the topology, running hwloc_get_cpubind
> + * and passing the resulting cpuset to hwloc_topology_restrict.
> + */
> };
> + if (topology->flags & HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_BINDING) {
> + hwloc_cpuset_t cpuset = hwloc_bitmap_alloc();
> + int err = hwloc_get_cpubind(topology, cpuset, HWLOC_CPUBIND_THREAD);
> + if (!err)
> + hwloc_topology_restrict(topology, cpuset);
> + hwloc_bitmap_free(cpuset);
> + }
Mmm, I then wonder whether we should really provide a flag, then, if
it's a matter of calling restrict() afterwards. What would be more
generic and useful is a topology configuration option which restricts
detection to a given cpuset: the core filters out objects outside from
that cpuset, and OS backends can also avoid trying to detect them,
making detection faster.
The restrict() operation itself still makes sense.
Samuel
|