Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] towards PLPA-like API in 1.0
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2009-12-22 04:56:41

Brice Goglin wrote:
> Jeff Squyres wrote:
>>> and Jeff has already removed the PLPA tests from
>>> trunk, I am going to add (1) and probably (3), and document (2) and (4)
>>> in the PLPA doc section. Then I'll move most comments from plpa.h into
>>> this doc section and remove plpa.h entirely.
>> How about having a v-like interface like you mentioned in #2? (analogous to writev, etc. -- takes an array)
> Ok.

Here's an untested proposal. Not sure about the function name and the
documentation. Any better idea would be much appreciated.


/** \brief Find an object below a chain of objects specified by types and indexes.
 * Arrays \p typev and \p idxv must contain \p nr types and indexes.
 * Start from the top system object and walk the arrays \p typev and \p idxv.
 * For each type and index couple in the arrays, look under the previously found
 * object to find the index-th object of the given type.
static __inline hwloc_obj_t
hwloc_get_obj_below_array_by_type (hwloc_topology_t topology, int nr, hwloc_obj_type_t *typev, unsigned *idxv)
  hwloc_obj_t obj = hwloc_get_system_obj(topology);
  int i;

  for(i=0; i<nr; i++) {
    obj = hwloc_get_obj_inside_cpuset_by_type(topology, obj->cpuset, typev[i], idxv[i];
    if (!obj)
      return NULL;

  return obj;