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)
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0, cache_level = 2;
|
||||
unsigned size;
|
||||
hwloc_obj_t obj;
|
||||
bool found = false;
|
||||
|
||||
/* Look for the smallest L2 cache size */
|
||||
size = 4096;
|
||||
while (1) {
|
||||
obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology,
|
||||
HWLOC_OBJ_CACHE, 2,
|
||||
i, OPAL_HWLOC_LOGICAL);
|
||||
if (NULL == obj) {
|
||||
break;
|
||||
} else {
|
||||
found = true;
|
||||
if (NULL != obj->attr &&
|
||||
size > obj->attr->cache.linesize) {
|
||||
size = obj->attr->cache.linesize;
|
||||
while (cache_level > 0 && !found) {
|
||||
i=0;
|
||||
while (1) {
|
||||
obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology,
|
||||
HWLOC_OBJ_CACHE, cache_level,
|
||||
i, OPAL_HWLOC_LOGICAL);
|
||||
if (NULL == obj) {
|
||||
--cache_level;
|
||||
break;
|
||||
} else {
|
||||
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
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user