hwlocality_memattrs_manage.3 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. .TH "hwlocality_memattrs_manage" 3 "Thu Sep 7 2023" "Version 2.9.3" "Hardware Locality (hwloc)" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. hwlocality_memattrs_manage \- Managing memory attributes
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Enumerations"
  10. .in +1c
  11. .ti -1c
  12. .RI "enum \fBhwloc_memattr_flag_e\fP { \fBHWLOC_MEMATTR_FLAG_HIGHER_FIRST\fP = (1UL<<0), \fBHWLOC_MEMATTR_FLAG_LOWER_FIRST\fP = (1UL<<1), \fBHWLOC_MEMATTR_FLAG_NEED_INITIATOR\fP = (1UL<<2) }"
  13. .br
  14. .in -1c
  15. .SS "Functions"
  16. .in +1c
  17. .ti -1c
  18. .RI "int \fBhwloc_memattr_get_name\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, const char **name)"
  19. .br
  20. .ti -1c
  21. .RI "int \fBhwloc_memattr_get_flags\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, unsigned long *flags)"
  22. .br
  23. .ti -1c
  24. .RI "int \fBhwloc_memattr_register\fP (\fBhwloc_topology_t\fP topology, const char *name, unsigned long flags, \fBhwloc_memattr_id_t\fP *id)"
  25. .br
  26. .ti -1c
  27. .RI "int \fBhwloc_memattr_set_value\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, \fBhwloc_obj_t\fP target_node, struct \fBhwloc_location\fP *initiator, unsigned long flags, hwloc_uint64_t value)"
  28. .br
  29. .ti -1c
  30. .RI "int \fBhwloc_memattr_get_targets\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, struct \fBhwloc_location\fP *initiator, unsigned long flags, unsigned *nr, \fBhwloc_obj_t\fP *targets, hwloc_uint64_t *values)"
  31. .br
  32. .ti -1c
  33. .RI "int \fBhwloc_memattr_get_initiators\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, \fBhwloc_obj_t\fP target_node, unsigned long flags, unsigned *nr, struct \fBhwloc_location\fP *initiators, hwloc_uint64_t *values)"
  34. .br
  35. .in -1c
  36. .SH "Detailed Description"
  37. .PP
  38. .SH "Enumeration Type Documentation"
  39. .PP
  40. .SS "enum \fBhwloc_memattr_flag_e\fP"
  41. .PP
  42. Memory attribute flags\&. Given to \fBhwloc_memattr_register()\fP and returned by \fBhwloc_memattr_get_flags()\fP\&.
  43. .PP
  44. \fBEnumerator\fP
  45. .in +1c
  46. .TP
  47. \fB\fIHWLOC_MEMATTR_FLAG_HIGHER_FIRST \fP\fP
  48. The best nodes for this memory attribute are those with the higher values\&. For instance Bandwidth\&.
  49. .TP
  50. \fB\fIHWLOC_MEMATTR_FLAG_LOWER_FIRST \fP\fP
  51. The best nodes for this memory attribute are those with the lower values\&. For instance Latency\&.
  52. .TP
  53. \fB\fIHWLOC_MEMATTR_FLAG_NEED_INITIATOR \fP\fP
  54. The value returned for this memory attribute depends on the given initiator\&. For instance Bandwidth and Latency, but not Capacity\&.
  55. .SH "Function Documentation"
  56. .PP
  57. .SS "int hwloc_memattr_get_flags (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, unsigned long * flags)"
  58. .PP
  59. Return the flags of the given attribute\&. Flags are a OR'ed set of \fBhwloc_memattr_flag_e\fP\&.
  60. .PP
  61. \fBReturns\fP
  62. .RS 4
  63. 0 on success\&.
  64. .PP
  65. -1 with errno set to \fCEINVAL\fP if the attribute does not exist\&.
  66. .RE
  67. .PP
  68. .SS "int hwloc_memattr_get_initiators (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, \fBhwloc_obj_t\fP target_node, unsigned long flags, unsigned * nr, struct \fBhwloc_location\fP * initiators, hwloc_uint64_t * values)"
  69. .PP
  70. Return the initiators that have values for a given attribute for a specific target NUMA node\&. Return initiators for the given attribute and target node in the \fCinitiators\fP array\&. If \fCvalues\fP is not \fCNULL\fP, the corresponding attribute values are stored in the array it points to\&.
  71. .PP
  72. On input, \fCnr\fP points to the number of initiators that may be stored in the array \fCinitiators\fP (and \fCvalues\fP)\&. On output, \fCnr\fP points to the number of initiators (and values) that were actually found, even if some of them couldn't be stored in the array\&. Initiators that couldn't be stored are ignored, but the function still returns success (\fC0\fP)\&. The caller may find out by comparing the value pointed by \fCnr\fP before and after the function call\&.
  73. .PP
  74. The returned initiators should not be modified or freed, they belong to the topology\&.
  75. .PP
  76. \fCflags\fP must be \fC0\fP for now\&.
  77. .PP
  78. If the attribute does not relate to a specific initiator (it does not have the flag \fBHWLOC_MEMATTR_FLAG_NEED_INITIATOR\fP), no initiator is returned\&.
  79. .PP
  80. \fBReturns\fP
  81. .RS 4
  82. 0 on success or -1 on error\&.
  83. .RE
  84. .PP
  85. \fBNote\fP
  86. .RS 4
  87. This function is meant for tools and debugging (listing internal information) rather than for application queries\&. Applications should rather select useful NUMA nodes with \fBhwloc_get_local_numanode_objs()\fP and then look at their attribute values for some relevant initiators\&.
  88. .RE
  89. .PP
  90. .SS "int hwloc_memattr_get_name (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, const char ** name)"
  91. .PP
  92. Return the name of a memory attribute\&.
  93. .PP
  94. \fBReturns\fP
  95. .RS 4
  96. 0 on success\&.
  97. .PP
  98. -1 with errno set to \fCEINVAL\fP if the attribute does not exist\&.
  99. .RE
  100. .PP
  101. .SS "int hwloc_memattr_get_targets (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, struct \fBhwloc_location\fP * initiator, unsigned long flags, unsigned * nr, \fBhwloc_obj_t\fP * targets, hwloc_uint64_t * values)"
  102. .PP
  103. Return the target NUMA nodes that have some values for a given attribute\&. Return targets for the given attribute in the \fCtargets\fP array (for the given initiator if any)\&. If \fCvalues\fP is not \fCNULL\fP, the corresponding attribute values are stored in the array it points to\&.
  104. .PP
  105. On input, \fCnr\fP points to the number of targets that may be stored in the array \fCtargets\fP (and \fCvalues\fP)\&. On output, \fCnr\fP points to the number of targets (and values) that were actually found, even if some of them couldn't be stored in the array\&. Targets that couldn't be stored are ignored, but the function still returns success (\fC0\fP)\&. The caller may find out by comparing the value pointed by \fCnr\fP before and after the function call\&.
  106. .PP
  107. The returned targets should not be modified or freed, they belong to the topology\&.
  108. .PP
  109. Argument \fCinitiator\fP is ignored if the attribute does not relate to a specific initiator (it does not have the flag \fBHWLOC_MEMATTR_FLAG_NEED_INITIATOR\fP)\&. Otherwise \fCinitiator\fP may be non \fCNULL\fP to report only targets that have a value for that initiator\&.
  110. .PP
  111. \fCflags\fP must be \fC0\fP for now\&.
  112. .PP
  113. \fBNote\fP
  114. .RS 4
  115. This function is meant for tools and debugging (listing internal information) rather than for application queries\&. Applications should rather select useful NUMA nodes with \fBhwloc_get_local_numanode_objs()\fP and then look at their attribute values\&.
  116. .RE
  117. .PP
  118. \fBReturns\fP
  119. .RS 4
  120. 0 on success or -1 on error\&.
  121. .RE
  122. .PP
  123. \fBNote\fP
  124. .RS 4
  125. The initiator \fCinitiator\fP should be of type \fBHWLOC_LOCATION_TYPE_CPUSET\fP when referring to accesses performed by CPU cores\&. \fBHWLOC_LOCATION_TYPE_OBJECT\fP is currently unused internally by hwloc, but users may for instance use it to provide custom information about host memory accesses performed by GPUs\&.
  126. .RE
  127. .PP
  128. .SS "int hwloc_memattr_register (\fBhwloc_topology_t\fP topology, const char * name, unsigned long flags, \fBhwloc_memattr_id_t\fP * id)"
  129. .PP
  130. Register a new memory attribute\&. Add a specific memory attribute that is not defined in \fBhwloc_memattr_id_e\fP\&. Flags are a OR'ed set of \fBhwloc_memattr_flag_e\fP\&. It must contain at least one of \fBHWLOC_MEMATTR_FLAG_HIGHER_FIRST\fP or \fBHWLOC_MEMATTR_FLAG_LOWER_FIRST\fP\&.
  131. .PP
  132. \fBReturns\fP
  133. .RS 4
  134. 0 on success\&.
  135. .PP
  136. -1 with errno set to \fCEBUSY\fP if another attribute already uses this name\&.
  137. .RE
  138. .PP
  139. .SS "int hwloc_memattr_set_value (\fBhwloc_topology_t\fP topology, \fBhwloc_memattr_id_t\fP attribute, \fBhwloc_obj_t\fP target_node, struct \fBhwloc_location\fP * initiator, unsigned long flags, hwloc_uint64_t value)"
  140. .PP
  141. Set an attribute value for a specific target NUMA node\&. If the attribute does not relate to a specific initiator (it does not have the flag \fBHWLOC_MEMATTR_FLAG_NEED_INITIATOR\fP), location \fCinitiator\fP is ignored and may be \fCNULL\fP\&.
  142. .PP
  143. The initiator will be copied into the topology, the caller should free anything allocated to store the initiator, for instance the cpuset\&.
  144. .PP
  145. \fCflags\fP must be \fC0\fP for now\&.
  146. .PP
  147. \fBNote\fP
  148. .RS 4
  149. The initiator \fCinitiator\fP should be of type \fBHWLOC_LOCATION_TYPE_CPUSET\fP when referring to accesses performed by CPU cores\&. \fBHWLOC_LOCATION_TYPE_OBJECT\fP is currently unused internally by hwloc, but users may for instance use it to provide custom information about host memory accesses performed by GPUs\&.
  150. .RE
  151. .PP
  152. \fBReturns\fP
  153. .RS 4
  154. 0 on success or -1 on error\&.
  155. .RE
  156. .PP
  157. .SH "Author"
  158. .PP
  159. Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.