Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] restrict branch
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2011-03-14 06:01:40


Le 07/03/2011 17:56, Brice Goglin a écrit :
> Le 01/03/2011 11:00, Brice Goglin a écrit :
>
>> Also, in 1.2, we'll have a hwloc_topology_restrict() function which will
>> let you load the whole machine topology and then restrict it to whatever
>> part of it (a part is defined by a hwloc_cpuset_t).
>>
> The restrict may be ready for merging in the near future. The interface
> looks like this:
>

If nobody complains about this, I will likely merge the branch within a
couple days.

Then, we may seriously consider doing a 1.2 beta release.

Brice

> diff --git a/include/hwloc.h b/include/hwloc.h
> index b4ac277..245a780 100644
> --- a/include/hwloc.h
> +++ b/include/hwloc.h
> @@ -783,6 +783,23 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object_by_cpuset(hwloc_top
> */
> HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name);
>
> +/** \brief Flags to be given to hwloc_topology_restrict(). */
> +enum hwloc_restrict_flags_e {
> + HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES = (1<<0)
> + /**< \brief Adapt distance matrices according to objects being removed during restriction.
> + * If this flag is not set, distance matrices are removed.
> + */
> +};
> +
> +/** \brief Restrict the topology to the current thread binding.
> + *
> + * Topology \p topology is modified so as to remove all objects that
> + * are not included (or partially included) in the CPU set \p cpuset.
> + *
> + * \p flags is a OR'ed set of hwloc_restrict_flags_e.
> + */
> +HWLOC_DECLSPEC int hwloc_topology_restrict(hwloc_topology_t __hwloc_restrict topology, hwloc_const_cpuset_t cpuset, unsigned long flags);
> +
> /** @} */
>
>
> Other examples of restrict flags include:
> * restricting memory and/or cpus only (we do both right now)
> * dropping PCI devices or not
> * dropping misc devices or not
>