opal/hwloc: remove min_bound() functions
df_search_min_bound() would need to be fixed for hwloc 2.0, but it's only used in opal_hwloc_base_find_min_bound_target_under_obj() which isn't used anymore. So just remove all of them. Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
Этот коммит содержится в:
родитель
c4dffa1d0f
Коммит
0cd0c12111
@ -175,10 +175,6 @@ OPAL_DECLSPEC unsigned int opal_hwloc_base_get_nbobjs_by_type(hwloc_topology_t t
|
|||||||
hwloc_obj_type_t target,
|
hwloc_obj_type_t target,
|
||||||
unsigned cache_level,
|
unsigned cache_level,
|
||||||
opal_hwloc_resource_type_t rtype);
|
opal_hwloc_resource_type_t rtype);
|
||||||
OPAL_DECLSPEC hwloc_obj_t opal_hwloc_base_find_min_bound_target_under_obj(hwloc_topology_t topo,
|
|
||||||
hwloc_obj_t obj,
|
|
||||||
hwloc_obj_type_t target,
|
|
||||||
unsigned cache_leve);
|
|
||||||
OPAL_DECLSPEC void opal_hwloc_base_clear_usage(hwloc_topology_t topo);
|
OPAL_DECLSPEC void opal_hwloc_base_clear_usage(hwloc_topology_t topo);
|
||||||
|
|
||||||
OPAL_DECLSPEC hwloc_obj_t opal_hwloc_base_get_obj_by_type(hwloc_topology_t topo,
|
OPAL_DECLSPEC hwloc_obj_t opal_hwloc_base_get_obj_by_type(hwloc_topology_t topo,
|
||||||
|
@ -922,124 +922,6 @@ unsigned int opal_hwloc_base_get_nbobjs_by_type(hwloc_topology_t topo,
|
|||||||
return num_objs;
|
return num_objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hwloc_obj_t df_search_min_bound(hwloc_topology_t topo,
|
|
||||||
hwloc_obj_t start,
|
|
||||||
hwloc_obj_type_t target,
|
|
||||||
unsigned cache_level,
|
|
||||||
unsigned int *min_bound)
|
|
||||||
{
|
|
||||||
unsigned k;
|
|
||||||
hwloc_obj_t obj, save=NULL;
|
|
||||||
opal_hwloc_obj_data_t *data;
|
|
||||||
|
|
||||||
if (target == start->type) {
|
|
||||||
/* only consider procs that are allowed */
|
|
||||||
if (0 == (k = opal_hwloc_base_get_npus(topo, start))) {
|
|
||||||
goto notfound;
|
|
||||||
}
|
|
||||||
#if HWLOC_API_VERSION < 0x20000
|
|
||||||
if (HWLOC_OBJ_CACHE == start->type && cache_level != start->attr->cache.depth) {
|
|
||||||
goto notfound;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* see how many procs are bound to us */
|
|
||||||
data = (opal_hwloc_obj_data_t*)start->userdata;
|
|
||||||
if (NULL == data) {
|
|
||||||
data = OBJ_NEW(opal_hwloc_obj_data_t);
|
|
||||||
start->userdata = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
|
|
||||||
"hwloc:base:min_bound_under_obj object %s:%u nbound %u min %u",
|
|
||||||
hwloc_obj_type_string(target), start->logical_index,
|
|
||||||
data->num_bound, *min_bound));
|
|
||||||
if (data->num_bound < *min_bound) {
|
|
||||||
*min_bound = data->num_bound;
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
/* if we have more procs bound to us than the min, return NULL */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
notfound:
|
|
||||||
for (k=0; k < start->arity; k++) {
|
|
||||||
obj = df_search_min_bound(topo, start->children[k], target, cache_level, min_bound);
|
|
||||||
if (NULL != obj) {
|
|
||||||
save = obj;
|
|
||||||
}
|
|
||||||
/* if the target level is HWTHREAD and we are NOT treating
|
|
||||||
* hwthreads as separate cpus, then we can only consider
|
|
||||||
* the 0th hwthread on a core
|
|
||||||
*/
|
|
||||||
if (HWLOC_OBJ_CORE == start->type && HWLOC_OBJ_PU == target &&
|
|
||||||
!opal_hwloc_use_hwthreads_as_cpus) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return save;
|
|
||||||
}
|
|
||||||
|
|
||||||
hwloc_obj_t opal_hwloc_base_find_min_bound_target_under_obj(hwloc_topology_t topo,
|
|
||||||
hwloc_obj_t obj,
|
|
||||||
hwloc_obj_type_t target,
|
|
||||||
unsigned cache_level)
|
|
||||||
{
|
|
||||||
unsigned int min_bound;
|
|
||||||
hwloc_obj_t loc;
|
|
||||||
|
|
||||||
/* bozo check */
|
|
||||||
if (NULL == topo || NULL == obj) {
|
|
||||||
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
|
|
||||||
"hwloc:base:find_min_bound_under_obj NULL %s",
|
|
||||||
(NULL == topo) ? "topology" : "object"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* if the object and target is the same type, then there is
|
|
||||||
* nothing under it, so just return itself
|
|
||||||
*/
|
|
||||||
if (target == obj->type) {
|
|
||||||
/* again, we have to treat caches differently as
|
|
||||||
* the levels distinguish them
|
|
||||||
*/
|
|
||||||
#if HWLOC_API_VERSION < 0x20000
|
|
||||||
if (HWLOC_OBJ_CACHE == target &&
|
|
||||||
cache_level < obj->attr->cache.depth) {
|
|
||||||
goto moveon;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HWLOC_API_VERSION < 0x20000
|
|
||||||
moveon:
|
|
||||||
#endif
|
|
||||||
/* the hwloc accessors all report at the topo level,
|
|
||||||
* so we have to do some work
|
|
||||||
*/
|
|
||||||
min_bound = UINT_MAX;
|
|
||||||
|
|
||||||
loc = df_search_min_bound(topo, obj, target, cache_level, &min_bound);
|
|
||||||
|
|
||||||
if (NULL != loc) {
|
|
||||||
#if HWLOC_API_VERSION < 0x20000
|
|
||||||
if (HWLOC_OBJ_CACHE == target) {
|
|
||||||
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
|
|
||||||
"hwloc:base:min_bound_under_obj found min bound of %u on %s:%u:%u",
|
|
||||||
min_bound, hwloc_obj_type_string(target),
|
|
||||||
cache_level, loc->logical_index));
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
|
|
||||||
"hwloc:base:min_bound_under_obj found min bound of %u on %s:%u",
|
|
||||||
min_bound, hwloc_obj_type_string(target), loc->logical_index));
|
|
||||||
}
|
|
||||||
|
|
||||||
return loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* as above, only return the Nth instance of the specified object
|
/* as above, only return the Nth instance of the specified object
|
||||||
* type from inside the topology
|
* type from inside the topology
|
||||||
*/
|
*/
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user