hwlocality_tinker.3 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. .TH "hwlocality_tinker" 3 "Thu Sep 7 2023" "Version 2.9.3" "Hardware Locality (hwloc)" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. hwlocality_tinker \- Modifying a loaded Topology
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Enumerations"
  10. .in +1c
  11. .ti -1c
  12. .RI "enum \fBhwloc_restrict_flags_e\fP { \fBHWLOC_RESTRICT_FLAG_REMOVE_CPULESS\fP, \fBHWLOC_RESTRICT_FLAG_BYNODESET\fP = (1UL<<3), \fBHWLOC_RESTRICT_FLAG_REMOVE_MEMLESS\fP, \fBHWLOC_RESTRICT_FLAG_ADAPT_MISC\fP, \fBHWLOC_RESTRICT_FLAG_ADAPT_IO\fP }"
  13. .br
  14. .ti -1c
  15. .RI "enum \fBhwloc_allow_flags_e\fP { \fBHWLOC_ALLOW_FLAG_ALL\fP, \fBHWLOC_ALLOW_FLAG_LOCAL_RESTRICTIONS\fP, \fBHWLOC_ALLOW_FLAG_CUSTOM\fP }"
  16. .br
  17. .in -1c
  18. .SS "Functions"
  19. .in +1c
  20. .ti -1c
  21. .RI "int \fBhwloc_topology_restrict\fP (\fBhwloc_topology_t\fP restrict topology, \fBhwloc_const_bitmap_t\fP set, unsigned long flags)"
  22. .br
  23. .ti -1c
  24. .RI "int \fBhwloc_topology_allow\fP (\fBhwloc_topology_t\fP restrict topology, \fBhwloc_const_cpuset_t\fP cpuset, \fBhwloc_const_nodeset_t\fP nodeset, unsigned long flags)"
  25. .br
  26. .ti -1c
  27. .RI "\fBhwloc_obj_t\fP \fBhwloc_topology_insert_misc_object\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_t\fP parent, const char *name)"
  28. .br
  29. .ti -1c
  30. .RI "\fBhwloc_obj_t\fP \fBhwloc_topology_alloc_group_object\fP (\fBhwloc_topology_t\fP topology)"
  31. .br
  32. .ti -1c
  33. .RI "\fBhwloc_obj_t\fP \fBhwloc_topology_insert_group_object\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_t\fP group)"
  34. .br
  35. .ti -1c
  36. .RI "int \fBhwloc_obj_add_other_obj_sets\fP (\fBhwloc_obj_t\fP dst, \fBhwloc_obj_t\fP src)"
  37. .br
  38. .ti -1c
  39. .RI "int \fBhwloc_topology_refresh\fP (\fBhwloc_topology_t\fP topology)"
  40. .br
  41. .in -1c
  42. .SH "Detailed Description"
  43. .PP
  44. .SH "Enumeration Type Documentation"
  45. .PP
  46. .SS "enum \fBhwloc_allow_flags_e\fP"
  47. .PP
  48. Flags to be given to \fBhwloc_topology_allow()\fP\&.
  49. .PP
  50. \fBEnumerator\fP
  51. .in +1c
  52. .TP
  53. \fB\fIHWLOC_ALLOW_FLAG_ALL \fP\fP
  54. Mark all objects as allowed in the topology\&. \fCcpuset\fP and \fCnođeset\fP given to \fBhwloc_topology_allow()\fP must be \fCNULL\fP\&.
  55. .TP
  56. \fB\fIHWLOC_ALLOW_FLAG_LOCAL_RESTRICTIONS \fP\fP
  57. Only allow objects that are available to the current process\&. The topology must have \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP so that the set of available resources can actually be retrieved from the operating system\&.
  58. .PP
  59. \fCcpuset\fP and \fCnođeset\fP given to \fBhwloc_topology_allow()\fP must be \fCNULL\fP\&.
  60. .TP
  61. \fB\fIHWLOC_ALLOW_FLAG_CUSTOM \fP\fP
  62. Allow a custom set of objects, given to \fBhwloc_topology_allow()\fP as \fCcpuset\fP and/or \fCnodeset\fP parameters\&.
  63. .SS "enum \fBhwloc_restrict_flags_e\fP"
  64. .PP
  65. Flags to be given to \fBhwloc_topology_restrict()\fP\&.
  66. .PP
  67. \fBEnumerator\fP
  68. .in +1c
  69. .TP
  70. \fB\fIHWLOC_RESTRICT_FLAG_REMOVE_CPULESS \fP\fP
  71. Remove all objects that became CPU-less\&. By default, only objects that contain no PU and no memory are removed\&. This flag may not be used with \fBHWLOC_RESTRICT_FLAG_BYNODESET\fP\&.
  72. .TP
  73. \fB\fIHWLOC_RESTRICT_FLAG_BYNODESET \fP\fP
  74. Restrict by nodeset instead of CPU set\&. Only keep objects whose nodeset is included or partially included in the given set\&. This flag may not be used with \fBHWLOC_RESTRICT_FLAG_REMOVE_CPULESS\fP\&.
  75. .TP
  76. \fB\fIHWLOC_RESTRICT_FLAG_REMOVE_MEMLESS \fP\fP
  77. Remove all objects that became Memory-less\&. By default, only objects that contain no PU and no memory are removed\&. This flag may only be used with \fBHWLOC_RESTRICT_FLAG_BYNODESET\fP\&.
  78. .TP
  79. \fB\fIHWLOC_RESTRICT_FLAG_ADAPT_MISC \fP\fP
  80. Move Misc objects to ancestors if their parents are removed during restriction\&. If this flag is not set, Misc objects are removed when their parents are removed\&.
  81. .TP
  82. \fB\fIHWLOC_RESTRICT_FLAG_ADAPT_IO \fP\fP
  83. Move I/O objects to ancestors if their parents are removed during restriction\&. If this flag is not set, I/O devices and bridges are removed when their parents are removed\&.
  84. .SH "Function Documentation"
  85. .PP
  86. .SS "int hwloc_obj_add_other_obj_sets (\fBhwloc_obj_t\fP dst, \fBhwloc_obj_t\fP src)"
  87. .PP
  88. Setup object cpusets/nodesets by OR'ing another object's sets\&. For each defined cpuset or nodeset in \fCsrc\fP, allocate the corresponding set in \fCdst\fP and add \fCsrc\fP to it by OR'ing sets\&.
  89. .PP
  90. This function is convenient between \fBhwloc_topology_alloc_group_object()\fP and \fBhwloc_topology_insert_group_object()\fP\&. It builds the sets of the new Group that will be inserted as a new intermediate parent of several objects\&.
  91. .PP
  92. \fBReturns\fP
  93. .RS 4
  94. 0 on success\&.
  95. .PP
  96. -1 with errno set to \fCENOMEM\fP if some internal reallocation failed\&.
  97. .RE
  98. .PP
  99. .SS "\fBhwloc_obj_t\fP hwloc_topology_alloc_group_object (\fBhwloc_topology_t\fP topology)"
  100. .PP
  101. Allocate a Group object to insert later with \fBhwloc_topology_insert_group_object()\fP\&. This function returns a new Group object\&.
  102. .PP
  103. The caller should (at least) initialize its sets before inserting the object in the topology\&. See \fBhwloc_topology_insert_group_object()\fP\&.
  104. .PP
  105. \fBReturns\fP
  106. .RS 4
  107. The allocated object on success\&.
  108. .PP
  109. \fCNULL\fP on error\&.
  110. .RE
  111. .PP
  112. .SS "int hwloc_topology_allow (\fBhwloc_topology_t\fP restrict topology, \fBhwloc_const_cpuset_t\fP cpuset, \fBhwloc_const_nodeset_t\fP nodeset, unsigned long flags)"
  113. .PP
  114. Change the sets of allowed PUs and NUMA nodes in the topology\&. This function only works if the \fBHWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED\fP was set on the topology\&. It does not modify any object, it only changes the sets returned by \fBhwloc_topology_get_allowed_cpuset()\fP and \fBhwloc_topology_get_allowed_nodeset()\fP\&.
  115. .PP
  116. It is notably useful when importing a topology from another process running in a different Linux Cgroup\&.
  117. .PP
  118. \fCflags\fP must be set to one flag among \fBhwloc_allow_flags_e\fP\&.
  119. .PP
  120. \fBReturns\fP
  121. .RS 4
  122. 0 on success, -1 on error\&.
  123. .RE
  124. .PP
  125. \fBNote\fP
  126. .RS 4
  127. Removing objects from a topology should rather be performed with \fBhwloc_topology_restrict()\fP\&.
  128. .RE
  129. .PP
  130. .SS "\fBhwloc_obj_t\fP hwloc_topology_insert_group_object (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_t\fP group)"
  131. .PP
  132. Add more structure to the topology by adding an intermediate Group\&. The caller should first allocate a new Group object with \fBhwloc_topology_alloc_group_object()\fP\&. Then it must setup at least one of its CPU or node sets to specify the final location of the Group in the topology\&. Then the object can be passed to this function for actual insertion in the topology\&.
  133. .PP
  134. Either the cpuset or nodeset field (or both, if compatible) must be set to a non-empty bitmap\&. The complete_cpuset or complete_nodeset may be set instead if inserting with respect to the complete topology (including disallowed, offline or unknown objects)\&. If grouping several objects, \fBhwloc_obj_add_other_obj_sets()\fP is an easy way to build the Group sets iteratively\&. These sets cannot be larger than the current topology, or they would get restricted silently\&. The core will setup the other sets after actual insertion\&.
  135. .PP
  136. The \fCsubtype\fP object attribute may be defined (to a dynamically allocated string) to display something else than 'Group' as the type name for this object in lstopo\&. Custom name-value info pairs may be added with \fBhwloc_obj_add_info()\fP after insertion\&.
  137. .PP
  138. The group \fCdont_merge\fP attribute may be set to \fC1\fP to prevent the hwloc core from ever merging this object with another hierarchically-identical object\&. This is useful when the Group itself describes an important feature that cannot be exposed anywhere else in the hierarchy\&.
  139. .PP
  140. The group \fCkind\fP attribute may be set to a high value such as \fC0xffffffff\fP to tell hwloc that this new Group should always be discarded in favor of any existing Group with the same locality\&.
  141. .PP
  142. \fBNote\fP
  143. .RS 4
  144. Inserting a group adds some locality information to the topology, hence the existing objects may get reordered (including PUs and NUMA nodes), and their logical indexes may change\&.
  145. .RE
  146. .PP
  147. \fBReturns\fP
  148. .RS 4
  149. The inserted object if it was properly inserted\&.
  150. .PP
  151. An existing object if the Group was merged or discarded because the topology already contained an object at the same location (the Group did not add any hierarchy information)\&.
  152. .PP
  153. \fCNULL\fP if the insertion failed because of conflicting sets in topology tree\&.
  154. .PP
  155. \fCNULL\fP if Group objects are filtered-out of the topology (\fBHWLOC_TYPE_FILTER_KEEP_NONE\fP)\&.
  156. .PP
  157. \fCNULL\fP if the object was discarded because no set was initialized in the Group before insert, or all of them were empty\&.
  158. .RE
  159. .PP
  160. .SS "\fBhwloc_obj_t\fP hwloc_topology_insert_misc_object (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_t\fP parent, const char * name)"
  161. .PP
  162. Add a MISC object as a leaf of the topology\&. A new MISC object will be created and inserted into the topology at the position given by parent\&. It is appended to the list of existing Misc children, without ever adding any intermediate hierarchy level\&. This is useful for annotating the topology without actually changing the hierarchy\&.
  163. .PP
  164. \fCname\fP is supposed to be unique across all Misc objects in the topology\&. It will be duplicated to setup the new object attributes\&.
  165. .PP
  166. The new leaf object will not have any \fCcpuset\fP\&.
  167. .PP
  168. \fBReturns\fP
  169. .RS 4
  170. the newly-created object
  171. .PP
  172. \fCNULL\fP on error\&.
  173. .PP
  174. \fCNULL\fP if Misc objects are filtered-out of the topology (\fBHWLOC_TYPE_FILTER_KEEP_NONE\fP)\&.
  175. .RE
  176. .PP
  177. \fBNote\fP
  178. .RS 4
  179. If \fCname\fP contains some non-printable characters, they will be dropped when exporting to XML, see \fBhwloc_topology_export_xml()\fP in \fBhwloc/export\&.h\fP\&.
  180. .RE
  181. .PP
  182. .SS "int hwloc_topology_refresh (\fBhwloc_topology_t\fP topology)"
  183. .PP
  184. Refresh internal structures after topology modification\&. Modifying the topology (by restricting, adding objects, modifying structures such as distances or memory attributes, etc\&.) may cause some internal caches to become invalid\&. These caches are automatically refreshed when accessed but this refreshing is not thread-safe\&.
  185. .PP
  186. This function is not thread-safe either, but it is a good way to end a non-thread-safe phase of topology modification\&. Once this refresh is done, multiple threads may concurrently consult the topology, objects, distances, attributes, etc\&.
  187. .PP
  188. See also \fBThread Safety\fP
  189. .PP
  190. \fBReturns\fP
  191. .RS 4
  192. 0 on success\&.
  193. .PP
  194. -1 on error, for instance if some internal reallocation failed\&.
  195. .RE
  196. .PP
  197. .SS "int hwloc_topology_restrict (\fBhwloc_topology_t\fP restrict topology, \fBhwloc_const_bitmap_t\fP set, unsigned long flags)"
  198. .PP
  199. Restrict the topology to the given CPU set or nodeset\&. Topology \fCtopology\fP is modified so as to remove all objects that are not included (or partially included) in the CPU set \fCset\fP\&. All objects CPU and node sets are restricted accordingly\&.
  200. .PP
  201. By default, \fCset\fP is a CPU set\&. It means that the set of PUs in the topology is restricted\&. Once some PUs got removed, their parents may also get removed recursively if they became child-less\&.
  202. .PP
  203. If \fBHWLOC_RESTRICT_FLAG_BYNODESET\fP is passed in \fCflags\fP, \fCset\fP is considered a nodeset instead of a CPU set\&. It means that the set of NUMA nodes in the topology is restricted (instead of PUs)\&. Once some NUMA nodes got removed, their parents may also get removed recursively if they became child-less\&.
  204. .PP
  205. \fCflags\fP is a OR'ed set of \fBhwloc_restrict_flags_e\fP\&.
  206. .PP
  207. \fBNote\fP
  208. .RS 4
  209. Restricting the topology removes some locality information, hence the remaining objects may get reordered (including PUs and NUMA nodes), and their logical indexes may change\&.
  210. .PP
  211. This call may not be reverted by restricting back to a larger set\&. Once dropped during restriction, objects may not be brought back, except by loading another topology with \fBhwloc_topology_load()\fP\&.
  212. .RE
  213. .PP
  214. \fBReturns\fP
  215. .RS 4
  216. 0 on success\&.
  217. .PP
  218. -1 with errno set to \fCEINVAL\fP if the input set is invalid\&. The topology is not modified in this case\&.
  219. .PP
  220. -1 with errno set to \fCENOMEM\fP on failure to allocate internal data\&. The topology is reinitialized in this case\&. It should be either destroyed with \fBhwloc_topology_destroy()\fP or configured and loaded again\&.
  221. .RE
  222. .PP
  223. .SH "Author"
  224. .PP
  225. Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.