hwlocality_distances_add.3 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. .TH "hwlocality_distances_add" 3 "Thu Sep 7 2023" "Version 2.9.3" "Hardware Locality (hwloc)" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. hwlocality_distances_add \- Add distances between objects
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Typedefs"
  10. .in +1c
  11. .ti -1c
  12. .RI "typedef void * \fBhwloc_distances_add_handle_t\fP"
  13. .br
  14. .in -1c
  15. .SS "Enumerations"
  16. .in +1c
  17. .ti -1c
  18. .RI "enum \fBhwloc_distances_add_flag_e\fP { \fBHWLOC_DISTANCES_ADD_FLAG_GROUP\fP, \fBHWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE\fP }"
  19. .br
  20. .in -1c
  21. .SS "Functions"
  22. .in +1c
  23. .ti -1c
  24. .RI "\fBhwloc_distances_add_handle_t\fP \fBhwloc_distances_add_create\fP (\fBhwloc_topology_t\fP topology, const char *name, unsigned long kind, unsigned long flags)"
  25. .br
  26. .ti -1c
  27. .RI "int \fBhwloc_distances_add_values\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_distances_add_handle_t\fP handle, unsigned nbobjs, \fBhwloc_obj_t\fP *objs, hwloc_uint64_t *values, unsigned long flags)"
  28. .br
  29. .ti -1c
  30. .RI "int \fBhwloc_distances_add_commit\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_distances_add_handle_t\fP handle, unsigned long flags)"
  31. .br
  32. .in -1c
  33. .SH "Detailed Description"
  34. .PP
  35. The usual way to add distances is:
  36. .PP
  37. .nf
  38. hwloc_distances_add_handle_t handle;
  39. int err = -1;
  40. handle = hwloc_distances_add_create(topology, "name", kind, 0);
  41. if (handle) {
  42. err = hwloc_distances_add_values(topology, handle, nbobjs, objs, values, 0);
  43. if (!err)
  44. err = hwloc_distances_add_commit(topology, handle, flags);
  45. }
  46. .fi
  47. .PP
  48. If \fCerr\fP is \fC0\fP at the end, then addition was successful\&.
  49. .SH "Typedef Documentation"
  50. .PP
  51. .SS "typedef void* \fBhwloc_distances_add_handle_t\fP"
  52. .PP
  53. Handle to a new distances structure during its addition to the topology\&.
  54. .SH "Enumeration Type Documentation"
  55. .PP
  56. .SS "enum \fBhwloc_distances_add_flag_e\fP"
  57. .PP
  58. Flags for adding a new distances to a topology\&.
  59. .PP
  60. \fBEnumerator\fP
  61. .in +1c
  62. .TP
  63. \fB\fIHWLOC_DISTANCES_ADD_FLAG_GROUP \fP\fP
  64. Try to group objects based on the newly provided distance information\&. This is ignored for distances between objects of different types\&.
  65. .TP
  66. \fB\fIHWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE \fP\fP
  67. If grouping, consider the distance values as inaccurate and relax the comparisons during the grouping algorithms\&. The actual accuracy may be modified through the HWLOC_GROUPING_ACCURACY environment variable (see \fBEnvironment Variables\fP)\&.
  68. .SH "Function Documentation"
  69. .PP
  70. .SS "int hwloc_distances_add_commit (\fBhwloc_topology_t\fP topology, \fBhwloc_distances_add_handle_t\fP handle, unsigned long flags)"
  71. .PP
  72. Commit a new distances structure\&. This function finalizes the distances structure and inserts in it the topology\&.
  73. .PP
  74. Parameter \fChandle\fP was previously returned by \fBhwloc_distances_add_create()\fP\&. Then objects and values were specified with \fBhwloc_distances_add_values()\fP\&.
  75. .PP
  76. \fCflags\fP configures the behavior of the function using an optional OR'ed set of \fBhwloc_distances_add_flag_e\fP\&. It may be used to request the grouping of existing objects based on distances\&.
  77. .PP
  78. On error, the temporary distances structure and its content are destroyed\&.
  79. .PP
  80. \fBReturns\fP
  81. .RS 4
  82. 0 on success\&.
  83. .PP
  84. -1 on error\&.
  85. .RE
  86. .PP
  87. .SS "\fBhwloc_distances_add_handle_t\fP hwloc_distances_add_create (\fBhwloc_topology_t\fP topology, const char * name, unsigned long kind, unsigned long flags)"
  88. .PP
  89. Create a new empty distances structure\&. Create an empty distances structure to be filled with \fBhwloc_distances_add_values()\fP and then committed with \fBhwloc_distances_add_commit()\fP\&.
  90. .PP
  91. Parameter \fCname\fP is optional, it may be \fCNULL\fP\&. Otherwise, it will be copied internally and may later be freed by the caller\&.
  92. .PP
  93. \fCkind\fP specifies the kind of distance as a OR'ed set of \fBhwloc_distances_kind_e\fP\&. Kind \fBHWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES\fP will be automatically set according to objects having different types in \fBhwloc_distances_add_values()\fP\&.
  94. .PP
  95. \fCflags\fP must be \fC0\fP for now\&.
  96. .PP
  97. \fBReturns\fP
  98. .RS 4
  99. A hwloc_distances_add_handle_t that should then be passed to \fBhwloc_distances_add_values()\fP and \fBhwloc_distances_add_commit()\fP\&.
  100. .PP
  101. \fCNULL\fP on error\&.
  102. .RE
  103. .PP
  104. .SS "int hwloc_distances_add_values (\fBhwloc_topology_t\fP topology, \fBhwloc_distances_add_handle_t\fP handle, unsigned nbobjs, \fBhwloc_obj_t\fP * objs, hwloc_uint64_t * values, unsigned long flags)"
  105. .PP
  106. Specify the objects and values in a new empty distances structure\&. Specify the objects and values for a new distances structure that was returned as a handle by \fBhwloc_distances_add_create()\fP\&. The structure must then be committed with \fBhwloc_distances_add_commit()\fP\&.
  107. .PP
  108. The number of objects is \fCnbobjs\fP and the array of objects is \fCobjs\fP\&. Distance values are stored as a one-dimension array in \fCvalues\fP\&. The distance from object i to object j is in slot i*nbobjs+j\&.
  109. .PP
  110. \fCnbobjs\fP must be at least 2\&.
  111. .PP
  112. Arrays \fCobjs\fP and \fCvalues\fP will be copied internally, they may later be freed by the caller\&.
  113. .PP
  114. On error, the temporary distances structure and its content are destroyed\&.
  115. .PP
  116. \fCflags\fP must be \fC0\fP for now\&.
  117. .PP
  118. \fBReturns\fP
  119. .RS 4
  120. 0 on success\&.
  121. .PP
  122. -1 on error\&.
  123. .RE
  124. .PP
  125. .SH "Author"
  126. .PP
  127. Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.