Skip to content

Commit

Permalink
memattrs: remove MemoryTier info when not valid anymore
Browse files Browse the repository at this point in the history
When recomputing memory tiers, remove all existing ones
instead of just replacing some.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Apr 30, 2024
1 parent ffa6bea commit 9155ece
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hwloc/memattrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ hwloc__apply_memory_tiers_subtypes(hwloc_topology_t topology,
if (nr_tiers > 1) {
char tmp[20];
snprintf(tmp, sizeof(tmp), "%u", j);
hwloc__replace_infos(&node->infos, "MemoryTier", tmp);
hwloc__add_info(&node->infos, "MemoryTier", tmp);
}
break; /* each node is in a single tier */
}
Expand All @@ -1813,10 +1813,16 @@ int
hwloc_internal_memattrs_guess_memory_tiers(hwloc_topology_t topology, int force_subtype)
{
struct hwloc_memory_tier_s *tiers;
hwloc_obj_t node = NULL;
unsigned nr_tiers;
unsigned i;
const char *env;

/* removing existing info attrs */
while ((node = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NUMANODE, node)) != NULL) {
hwloc__remove_infos(&node->infos, "MemoryTier", NULL);
}

env = getenv("HWLOC_MEMTIERS");
if (env) {
if (!strcmp(env, "none"))
Expand Down

0 comments on commit 9155ece

Please sign in to comment.