Skip to content

Commit

Permalink
synthetic/export: use Socket name when exporting to v1
Browse files Browse the repository at this point in the history
Socket is always supported in v1.x, Package is not.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Dec 19, 2017
1 parent 9c9ffce commit d446968
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions hwloc/topology-synthetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,13 @@ hwloc_topology_export_synthetic_obj(struct hwloc_topology * topology, unsigned l
&& (flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES)) {
/* v1 uses generic "Cache" for non-extended type name */
res = hwloc_snprintf(tmp, tmplen, "Cache%s", aritys);

} else if (obj->type == HWLOC_OBJ_PACKAGE
&& (flags & (HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES
|HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1))) {
/* if exporting to v1 or without extended-types, use all-v1-compatible Socket name */
res = hwloc_snprintf(tmp, tmplen, "Socket%s", aritys);

} else if (obj->type == HWLOC_OBJ_GROUP /* don't export group depth */
|| flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES) {
res = hwloc_snprintf(tmp, tmplen, "%s%s", hwloc_obj_type_string(obj->type), aritys);
Expand Down
4 changes: 2 additions & 2 deletions tests/hwloc/hwloc_synthetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ int main(void)
assert(!err);

err = hwloc_topology_export_synthetic(topology, buffer, sizeof(buffer), HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES|HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS|HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1);
assert(err == 48);
err = strcmp("Package:2 Group:3 NUMANode:1 Cache:4 Core:5 PU:6", buffer);
assert(err == 47);
err = strcmp("Socket:2 Group:3 NUMANode:1 Cache:4 Core:5 PU:6", buffer);
assert(!err);

hwloc_topology_destroy(topology);
Expand Down

0 comments on commit d446968

Please sign in to comment.