Fix cache line size detection on power
Due to the nature of the cache architecture on power, we don't export coherency_line_size for L2 in sysfs. If we are unable to get the L2 cache line size, try L1. See open-mpi/ompi#383 for more information.
Этот коммит содержится в:
родитель
ded408f485
Коммит
881a9f3d58
@ -211,27 +211,32 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
|
|||||||
|
|
||||||
static void fill_cache_line_size(void)
|
static void fill_cache_line_size(void)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0, cache_level = 2;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
hwloc_obj_t obj;
|
hwloc_obj_t obj;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
/* Look for the smallest L2 cache size */
|
/* Look for the smallest L2 cache size */
|
||||||
size = 4096;
|
size = 4096;
|
||||||
while (1) {
|
while (cache_level > 0 && !found) {
|
||||||
obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology,
|
i=0;
|
||||||
HWLOC_OBJ_CACHE, 2,
|
while (1) {
|
||||||
i, OPAL_HWLOC_LOGICAL);
|
obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology,
|
||||||
if (NULL == obj) {
|
HWLOC_OBJ_CACHE, cache_level,
|
||||||
break;
|
i, OPAL_HWLOC_LOGICAL);
|
||||||
} else {
|
if (NULL == obj) {
|
||||||
found = true;
|
--cache_level;
|
||||||
if (NULL != obj->attr &&
|
break;
|
||||||
size > obj->attr->cache.linesize) {
|
} else {
|
||||||
size = obj->attr->cache.linesize;
|
if (NULL != obj->attr &&
|
||||||
|
obj->attr->cache.linesize > 0 &&
|
||||||
|
size > obj->attr->cache.linesize) {
|
||||||
|
size = obj->attr->cache.linesize;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we found an L2 cache size in the hwloc data, save it in
|
/* If we found an L2 cache size in the hwloc data, save it in
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user