Skip to content

Commit 9ff05d1

Browse files
committed
API: improve the documentation of insert_group()
Start from the easy case where we group children of the same parent, then talk about more general cases that may however fail. Thanks to HadrienG2 for the suggestion. Closes #648 Signed-off-by: Brice Goglin <[email protected]>
1 parent 8b82269 commit 9ff05d1

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

include/hwloc.h

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2023 Inria. All rights reserved.
3+
* Copyright © 2009-2024 Inria. All rights reserved.
44
* Copyright © 2009-2012 Université Bordeaux
55
* Copyright © 2009-2020 Cisco Systems, Inc. All rights reserved.
66
* See COPYING in top-level directory.
@@ -2859,12 +2859,31 @@ HWLOC_DECLSPEC int hwloc_topology_free_group_object(hwloc_topology_t topology, h
28592859
* the final location of the Group in the topology.
28602860
* Then the object can be passed to this function for actual insertion in the topology.
28612861
*
2862-
* Either the cpuset or nodeset field (or both, if compatible) must be set
2863-
* to a non-empty bitmap. The complete_cpuset or complete_nodeset may be set
2864-
* instead if inserting with respect to the complete topology
2862+
* The main use case for this function is to group a subset of
2863+
* siblings among the list of children below a single parent.
2864+
* For instance, if grouping 4 cores out of a 8-core socket,
2865+
* the logical list of cores will be reordered so that the 4 grouped
2866+
* ones are consecutive.
2867+
* Then, if needed, a new depth is added between the parent and those
2868+
* children, and the Group is inserted there.
2869+
* At the end, the 4 grouped cores are now children of the Group,
2870+
* which replaces them as a child of the original parent.
2871+
*
2872+
* In practice, the grouped objects are specified through cpusets
2873+
* and/or nodesets, for instance using hwloc_obj_add_other_obj_sets()
2874+
* iteratively.
2875+
* Hence it is possible to Group objects that are not children of the
2876+
* same parent, for instance some PUs below the 4 cores in example above.
2877+
* However this general case may fail if the expected Group conflicts
2878+
* with the existing hierarchy.
2879+
* For instance if each core has two PUs, it is not possible to insert
2880+
* a Group containing a single PU of each core.
2881+
*
2882+
* To specify the objects to group, either the cpuset or nodeset field
2883+
* (or both, if compatible) must be set to a non-empty bitmap.
2884+
* The complete_cpuset or complete_nodeset may be set instead if
2885+
* inserting with respect to the complete topology
28652886
* (including disallowed, offline or unknown objects).
2866-
* If grouping several objects, hwloc_obj_add_other_obj_sets() is an easy way
2867-
* to build the Group sets iteratively.
28682887
* These sets cannot be larger than the current topology, or they would get
28692888
* restricted silently.
28702889
* The core will setup the other sets after actual insertion.

0 commit comments

Comments
 (0)