Debian Codegraph @

doc/doxygen-doc/html/a00195.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=11"/>
6 <meta name="generator" content="Doxygen 1.15.0"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>Hardware Locality (hwloc): Comparing memory node attributes for finding where to allocate on</title>
9 <link href="tabs.css" rel="stylesheet" type="text/css"/>
10 <script type="text/javascript" src="jquery.js"></script>
11 <script type="text/javascript" src="dynsections.js"></script>
12 <script type="text/javascript" src="clipboard.js"></script>
13 <link href="doxygen.css" rel="stylesheet" type="text/css" />
14 </head>
15 <body>
16 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
17 <div id="titlearea">
18 <table cellspacing="0" cellpadding="0">
19 <tbody>
20 <tr id="projectrow">
21 <td id="projectalign">
22 <div id="projectname">Hardware Locality (hwloc)<span id="projectnumber">&#160;2.14.0</span>
23 </div>
24 </td>
25 </tr>
26 </tbody>
27 </table>
28 </div>
29 <!-- end header part -->
30 <!-- Generated by Doxygen 1.15.0 -->
31 <script type="text/javascript">
32 $(function() { codefold.init(); });
33 </script>
34 <script type="text/javascript" src="menudata.js"></script>
35 <script type="text/javascript" src="menu.js"></script>
36 <script type="text/javascript">
37 $(function() {
38 initMenu('',false,false,'search.php','Search',false);
39 });
40 </script>
41 <div id="main-nav"></div>
42 </div><!-- top -->
43 <div id="doc-content">
44 <div class="header">
45 <div class="summary">
46 <a href="#nested-classes">Data Structures</a> &#124;
47 <a href="#typedef-members">Typedefs</a> &#124;
48 <a href="#enum-members">Enumerations</a> &#124;
49 <a href="#func-members">Functions</a> </div>
50 <div class="headertitle"><div class="title">Comparing memory node attributes for finding where to allocate on </div></div>
51 </div><!--header-->
52 <div class="contents">
53 <table class="memberdecls">
54 <tr class="heading"><td colspan="2"><h2 id="header-nested-classes" class="groupheader"><a id="nested-classes" name="nested-classes"></a>
55 Data Structures</h2></td></tr>
56 <tr class="memitem:hwloc_5Flocation" id="r_hwloc_5Flocation"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00300.html">hwloc_location</a></td></tr>
57 </table><table class="memberdecls">
58 <tr class="heading"><td colspan="2"><h2 id="header-typedef-members" class="groupheader"><a id="typedef-members" name="typedef-members"></a>
59 Typedefs</h2></td></tr>
60 <tr class="memitem:gacc82003a8610be554615995f0996c888" id="r_gacc82003a8610be554615995f0996c888"><td class="memItemLeft" align="right" valign="top">typedef unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td></tr>
61 </table><table class="memberdecls">
62 <tr class="heading"><td colspan="2"><h2 id="header-enum-members" class="groupheader"><a id="enum-members" name="enum-members"></a>
63 Enumerations</h2></td></tr>
64 <tr class="memitem:gab4bde745db676fc2ea4b47011cd9a80e" id="r_gab4bde745db676fc2ea4b47011cd9a80e"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#gab4bde745db676fc2ea4b47011cd9a80e">hwloc_memattr_id_e</a> { <br />
65 &#160;&#160;<a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80eaa1cfa3ff3d56ff00ecabf7da4f5642cc">HWLOC_MEMATTR_ID_CAPACITY</a>
66 , <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80ea9334e3a4c30a67f491c6523255134efe">HWLOC_MEMATTR_ID_LOCALITY</a>
67 , <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80ea25fe3c7376ae6f9b584bacdb039f8c0f">HWLOC_MEMATTR_ID_BANDWIDTH</a>
68 , <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80eac34dce925d3dadb7e255391d142b4828">HWLOC_MEMATTR_ID_READ_BANDWIDTH</a>
69 , <br />
70 &#160;&#160;<a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80ea44762e8ebe327cfe665cccf1f58f7530">HWLOC_MEMATTR_ID_WRITE_BANDWIDTH</a>
71 , <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80ead1796413759b8b87b61ad195a9349b19">HWLOC_MEMATTR_ID_LATENCY</a>
72 , <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80ea52cab56571c7fafea42a694d80ad3dd0">HWLOC_MEMATTR_ID_READ_LATENCY</a>
73 , <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80eaaf6cd383da87dc9f5e3a608a535a768e">HWLOC_MEMATTR_ID_WRITE_LATENCY</a>
74 , <br />
75 &#160;&#160;<b>HWLOC_MEMATTR_ID_MAX</b>
76 <br />
77 }</td></tr>
78 <tr class="memitem:ga33099ba58f607fc70925da3777688586" id="r_ga33099ba58f607fc70925da3777688586"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga33099ba58f607fc70925da3777688586">hwloc_location_type_e</a> { <a class="el" href="#gga33099ba58f607fc70925da3777688586a7135318a86361ad75fd1648e6bf6d174">HWLOC_LOCATION_TYPE_CPUSET</a>
79 , <a class="el" href="#gga33099ba58f607fc70925da3777688586af637c39b23d48cff15ddb008644aaa84">HWLOC_LOCATION_TYPE_OBJECT</a>
80 }</td></tr>
81 <tr class="memitem:gab9c963ca37255da71b00d94e1b106f9d" id="r_gab9c963ca37255da71b00d94e1b106f9d"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#gab9c963ca37255da71b00d94e1b106f9d">hwloc_local_numanode_flag_e</a> { <a class="el" href="#ggab9c963ca37255da71b00d94e1b106f9da200c6c133bb2125ba36d77ce9ca268cc">HWLOC_LOCAL_NUMANODE_FLAG_LARGER_LOCALITY</a>
82 , <a class="el" href="#ggab9c963ca37255da71b00d94e1b106f9daac9c5e3a2cfb1b193e4acfceaf3bad57">HWLOC_LOCAL_NUMANODE_FLAG_SMALLER_LOCALITY</a>
83 , <a class="el" href="#ggab9c963ca37255da71b00d94e1b106f9da63688752fccbfc4d55b20da28fcb2430">HWLOC_LOCAL_NUMANODE_FLAG_INTERSECT_LOCALITY</a>
84 , <a class="el" href="#ggab9c963ca37255da71b00d94e1b106f9dab5778b34c961a5d56f98f1549edeaed0">HWLOC_LOCAL_NUMANODE_FLAG_ALL</a>
85 }</td></tr>
86 </table><table class="memberdecls">
87 <tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
88 Functions</h2></td></tr>
89 <tr class="memitem:ga79f44f8e1cfd2f97a19171417a75a137" id="r_ga79f44f8e1cfd2f97a19171417a75a137"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga79f44f8e1cfd2f97a19171417a75a137">hwloc_memattr_get_by_name</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const char *name, <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> *id)</td></tr>
90 <tr class="memitem:ga569e80c5be7ef27649b0ef5aa52ffcdc" id="r_ga569e80c5be7ef27649b0ef5aa52ffcdc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga569e80c5be7ef27649b0ef5aa52ffcdc">hwloc_get_local_numanode_objs</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, struct <a class="el" href="a00300.html">hwloc_location</a> *location, unsigned *nr, <a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> *nodes, unsigned long flags)</td></tr>
91 <tr class="memitem:gae7ff5d6f04d3bb71a3259cf1ff3afaed" id="r_gae7ff5d6f04d3bb71a3259cf1ff3afaed"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#gae7ff5d6f04d3bb71a3259cf1ff3afaed">hwloc_topology_get_default_nodeset</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00166.html#ga37e35730fa7e775b5bb0afe893d6d508">hwloc_nodeset_t</a> nodeset, unsigned long flags)</td></tr>
92 <tr class="memitem:ga297e4a9adc2272446a4c7449dacef0df" id="r_ga297e4a9adc2272446a4c7449dacef0df"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga297e4a9adc2272446a4c7449dacef0df">hwloc_memattr_get_value</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, <a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> target_node, struct <a class="el" href="a00300.html">hwloc_location</a> *initiator, unsigned long flags, hwloc_uint64_t *value)</td></tr>
93 <tr class="memitem:ga884d1f2ad745c2fa69c1583c82d28f10" id="r_ga884d1f2ad745c2fa69c1583c82d28f10"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga884d1f2ad745c2fa69c1583c82d28f10">hwloc_memattr_get_best_target</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, struct <a class="el" href="a00300.html">hwloc_location</a> *initiator, unsigned long flags, <a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> *best_target, hwloc_uint64_t *value)</td></tr>
94 <tr class="memitem:gaf6b746dd3494772db18eaf760a5dd9c0" id="r_gaf6b746dd3494772db18eaf760a5dd9c0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#gaf6b746dd3494772db18eaf760a5dd9c0">hwloc_memattr_get_best_initiator</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, <a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> target_node, unsigned long flags, struct <a class="el" href="a00300.html">hwloc_location</a> *best_initiator, hwloc_uint64_t *value)</td></tr>
95 <tr class="memitem:gac8c06c1c89ab352c5db8e04a75033513" id="r_gac8c06c1c89ab352c5db8e04a75033513"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#gac8c06c1c89ab352c5db8e04a75033513">hwloc_memattr_get_targets</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, struct <a class="el" href="a00300.html">hwloc_location</a> *initiator, unsigned long flags, unsigned *nr, <a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> *targets, hwloc_uint64_t *values)</td></tr>
96 <tr class="memitem:ga049aaa860dcbbf0792f0fd4251a99ec0" id="r_ga049aaa860dcbbf0792f0fd4251a99ec0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga049aaa860dcbbf0792f0fd4251a99ec0">hwloc_memattr_get_initiators</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, <a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> target_node, unsigned long flags, unsigned *nr, struct <a class="el" href="a00300.html">hwloc_location</a> *initiators, hwloc_uint64_t *values)</td></tr>
97 </table>
98 <a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
99 <p>Platforms with heterogeneous memory require ways to decide whether a buffer should be allocated on "fast" memory (such as HBM), "normal" memory (DDR) or even "slow" but large-capacity memory (non-volatile memory). These memory nodes are called "Targets" while the CPU accessing them is called the "Initiator". Access performance depends on their locality (NUMA platforms) as well as the intrinsic performance of the targets (heterogeneous platforms).</p>
100 <p>The following attributes describe the performance of memory accesses from an Initiator to a memory Target, for instance their latency or bandwidth. Initiators performing these memory accesses are usually some PUs or Cores (described as a CPU set). Hence a Core may choose where to allocate a memory buffer by comparing the attributes of different target memory nodes nearby.</p>
101 <p>There are also some attributes that are system-wide. Their value does not depend on a specific initiator performing an access. The memory node Capacity is an example of such attribute without initiator.</p>
102 <p>One way to use this API is to start with a cpuset describing the Cores where a program is bound. The best target NUMA node for allocating memory in this program on these Cores may be obtained by passing this cpuset as an initiator to <a class="el" href="#ga884d1f2ad745c2fa69c1583c82d28f10" title="Return the best target NUMA node for the given attribute and initiator.">hwloc_memattr_get_best_target()</a> with the relevant memory attribute. For instance, if the code is latency limited, use the Latency attribute.</p>
103 <p>A more flexible approach consists in getting the list of local NUMA nodes by passing this cpuset to <a class="el" href="#ga569e80c5be7ef27649b0ef5aa52ffcdc" title="Return an array of local NUMA nodes.">hwloc_get_local_numanode_objs()</a>. Attribute values for these nodes, if any, may then be obtained with <a class="el" href="#ga297e4a9adc2272446a4c7449dacef0df" title="Return an attribute value for a specific target NUMA node.">hwloc_memattr_get_value()</a> and manually compared with the desired criteria.</p>
104 <p>Memory attributes are also used internally to build Memory Tiers which provide an easy way to distinguish NUMA nodes of different kinds, as explained in <a class="el" href="a00379.html">Heterogeneous Memory</a>.</p>
105 <p>Beside tiers, hwloc defines a set of "default" nodes where normal memory allocations should be made from (see <a class="el" href="#gae7ff5d6f04d3bb71a3259cf1ff3afaed" title="Return the set of default NUMA nodes.">hwloc_topology_get_default_nodeset()</a>). This is also useful for dividing the machine into a set of non-overlapping NUMA domains, for instance for binding tasks per domain.</p>
106 <dl class="section see"><dt>See also</dt><dd>An example is available in doc/examples/memory-attributes.c in the source tree.</dd></dl>
107 <dl class="section note"><dt>Note</dt><dd>The API also supports specific objects as initiator, but it is currently not used internally by hwloc. Users may for instance use it to provide custom performance values for host memory accesses performed by GPUs.</dd>
108 <dd>
109 The interface actually also accepts targets that are not NUMA nodes. </dd></dl>
110 <a name="doc-typedef-members" id="doc-typedef-members"></a><h2 id="header-doc-typedef-members" class="groupheader">Typedef Documentation</h2>
111 <a id="gacc82003a8610be554615995f0996c888" name="gacc82003a8610be554615995f0996c888"></a>
112 <h2 class="memtitle"><span class="permalink"><a href="#gacc82003a8610be554615995f0996c888">&#9670;&#160;</a></span>hwloc_memattr_id_t</h2>
113
114 <div class="memitem">
115 <div class="memproto">
116 <table class="memname">
117 <tr>
118 <td class="memname">typedef unsigned <a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td>
119 </tr>
120 </table>
121 </div><div class="memdoc">
122
123 <p>A memory attribute identifier. </p>
124 <p>hwloc predefines some commonly-used attributes in <a class="el" href="#gab4bde745db676fc2ea4b47011cd9a80e" title="Predefined memory attribute IDs. See hwloc_memattr_id_t for the generic definition of IDs for predefi...">hwloc_memattr_id_e</a>. One may then dynamically register custom ones with <a class="el" href="a00196.html#ga770657d1e44b09e93e09f623936c1e5f" title="Register a new memory attribute.">hwloc_memattr_register()</a>, they will be assigned IDs immediately after the predefined ones. See <a class="el" href="a00196.html">Managing memory attributes</a> for more information about existing attribute IDs. </p>
125
126 </div>
127 </div>
128 <a name="doc-enum-members" id="doc-enum-members"></a><h2 id="header-doc-enum-members" class="groupheader">Enumeration Type Documentation</h2>
129 <a id="gab9c963ca37255da71b00d94e1b106f9d" name="gab9c963ca37255da71b00d94e1b106f9d"></a>
130 <h2 class="memtitle"><span class="permalink"><a href="#gab9c963ca37255da71b00d94e1b106f9d">&#9670;&#160;</a></span>hwloc_local_numanode_flag_e</h2>
131
132 <div class="memitem">
133 <div class="memproto">
134 <table class="memname">
135 <tr>
136 <td class="memname">enum <a class="el" href="#gab9c963ca37255da71b00d94e1b106f9d">hwloc_local_numanode_flag_e</a></td>
137 </tr>
138 </table>
139 </div><div class="memdoc">
140
141 <p>Flags for selecting target NUMA nodes. </p>
142 <table class="fieldtable">
143 <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggab9c963ca37255da71b00d94e1b106f9da200c6c133bb2125ba36d77ce9ca268cc" name="ggab9c963ca37255da71b00d94e1b106f9da200c6c133bb2125ba36d77ce9ca268cc"></a>HWLOC_LOCAL_NUMANODE_FLAG_LARGER_LOCALITY&#160;</td><td class="fielddoc"><p>Select NUMA nodes whose locality is larger than the given cpuset. For instance, if a single PU (or its cpuset) is given in <code class="param">initiator</code>, select all nodes close to the package that contains this PU. </p>
144 </td></tr>
145 <tr><td class="fieldname"><a id="ggab9c963ca37255da71b00d94e1b106f9daac9c5e3a2cfb1b193e4acfceaf3bad57" name="ggab9c963ca37255da71b00d94e1b106f9daac9c5e3a2cfb1b193e4acfceaf3bad57"></a>HWLOC_LOCAL_NUMANODE_FLAG_SMALLER_LOCALITY&#160;</td><td class="fielddoc"><p>Select NUMA nodes whose locality is smaller than the given cpuset. For instance, if a package (or its cpuset) is given in <code class="param">initiator</code>, also select nodes that are attached to only a half of that package. </p>
146 </td></tr>
147 <tr><td class="fieldname"><a id="ggab9c963ca37255da71b00d94e1b106f9da63688752fccbfc4d55b20da28fcb2430" name="ggab9c963ca37255da71b00d94e1b106f9da63688752fccbfc4d55b20da28fcb2430"></a>HWLOC_LOCAL_NUMANODE_FLAG_INTERSECT_LOCALITY&#160;</td><td class="fielddoc"><p>Select NUMA nodes whose locality intersects the given cpuset. This includes larger and smaller localities as well as localities that are partially included. For instance, if the locality is one core of both packages, a NUMA node local to one package is neither larger nor smaller than this locality, but it intersects it. </p>
148 </td></tr>
149 <tr><td class="fieldname"><a id="ggab9c963ca37255da71b00d94e1b106f9dab5778b34c961a5d56f98f1549edeaed0" name="ggab9c963ca37255da71b00d94e1b106f9dab5778b34c961a5d56f98f1549edeaed0"></a>HWLOC_LOCAL_NUMANODE_FLAG_ALL&#160;</td><td class="fielddoc"><p>Select all NUMA nodes in the topology. The initiator <code class="param">initiator</code> is ignored. </p>
150 </td></tr>
151 </table>
152
153 </div>
154 </div>
155 <a id="ga33099ba58f607fc70925da3777688586" name="ga33099ba58f607fc70925da3777688586"></a>
156 <h2 class="memtitle"><span class="permalink"><a href="#ga33099ba58f607fc70925da3777688586">&#9670;&#160;</a></span>hwloc_location_type_e</h2>
157
158 <div class="memitem">
159 <div class="memproto">
160 <table class="memname">
161 <tr>
162 <td class="memname">enum <a class="el" href="#ga33099ba58f607fc70925da3777688586">hwloc_location_type_e</a></td>
163 </tr>
164 </table>
165 </div><div class="memdoc">
166
167 <p>Type of location. </p>
168 <table class="fieldtable">
169 <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga33099ba58f607fc70925da3777688586a7135318a86361ad75fd1648e6bf6d174" name="gga33099ba58f607fc70925da3777688586a7135318a86361ad75fd1648e6bf6d174"></a>HWLOC_LOCATION_TYPE_CPUSET&#160;</td><td class="fielddoc"><p>Location is given as a cpuset, in the location cpuset union field. </p>
170 </td></tr>
171 <tr><td class="fieldname"><a id="gga33099ba58f607fc70925da3777688586af637c39b23d48cff15ddb008644aaa84" name="gga33099ba58f607fc70925da3777688586af637c39b23d48cff15ddb008644aaa84"></a>HWLOC_LOCATION_TYPE_OBJECT&#160;</td><td class="fielddoc"><p>Location is given as an object, in the location object union field. </p>
172 </td></tr>
173 </table>
174
175 </div>
176 </div>
177 <a id="gab4bde745db676fc2ea4b47011cd9a80e" name="gab4bde745db676fc2ea4b47011cd9a80e"></a>
178 <h2 class="memtitle"><span class="permalink"><a href="#gab4bde745db676fc2ea4b47011cd9a80e">&#9670;&#160;</a></span>hwloc_memattr_id_e</h2>
179
180 <div class="memitem">
181 <div class="memproto">
182 <table class="memname">
183 <tr>
184 <td class="memname">enum <a class="el" href="#gab4bde745db676fc2ea4b47011cd9a80e">hwloc_memattr_id_e</a></td>
185 </tr>
186 </table>
187 </div><div class="memdoc">
188
189 <p>Predefined memory attribute IDs. See <a class="el" href="#gacc82003a8610be554615995f0996c888" title="A memory attribute identifier.">hwloc_memattr_id_t</a> for the generic definition of IDs for predefined or custom attributes. </p>
190 <table class="fieldtable">
191 <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80eaa1cfa3ff3d56ff00ecabf7da4f5642cc" name="ggab4bde745db676fc2ea4b47011cd9a80eaa1cfa3ff3d56ff00ecabf7da4f5642cc"></a>HWLOC_MEMATTR_ID_CAPACITY&#160;</td><td class="fielddoc"><p>The "Capacity" is returned in bytes (local_memory attribute in objects). </p>
192 <p>Best capacity nodes are nodes with <b>higher capacity</b>.</p>
193 <p>No initiator is involved when looking at this attribute. The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" title="The best nodes for this memory attribute are those with the higher values. For instance Bandwidth.">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a>.</p>
194 <p>Capacity values may not be modified using <a class="el" href="a00196.html#ga960529c08b25cf15825e0f72ecceb504" title="Set an attribute value for a specific target NUMA node.">hwloc_memattr_set_value()</a>. </p>
195 </td></tr>
196 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80ea9334e3a4c30a67f491c6523255134efe" name="ggab4bde745db676fc2ea4b47011cd9a80ea9334e3a4c30a67f491c6523255134efe"></a>HWLOC_MEMATTR_ID_LOCALITY&#160;</td><td class="fielddoc"><p>The "Locality" is returned as the number of PUs in that locality (e.g. the weight of its cpuset). </p>
197 <p>Best locality nodes are nodes with <b>smaller locality</b> (nodes that are local to very few PUs). Poor locality nodes are nodes with larger locality (nodes that are local to the entire machine).</p>
198 <p>No initiator is involved when looking at this attribute. The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" title="The best nodes for this memory attribute are those with the higher values. For instance Bandwidth.">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a>.</p>
199 <p>Locality values may not be modified using <a class="el" href="a00196.html#ga960529c08b25cf15825e0f72ecceb504" title="Set an attribute value for a specific target NUMA node.">hwloc_memattr_set_value()</a>. </p>
200 </td></tr>
201 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80ea25fe3c7376ae6f9b584bacdb039f8c0f" name="ggab4bde745db676fc2ea4b47011cd9a80ea25fe3c7376ae6f9b584bacdb039f8c0f"></a>HWLOC_MEMATTR_ID_BANDWIDTH&#160;</td><td class="fielddoc"><p>The "Bandwidth" is returned in MiB/s, as seen from the given initiator location. </p>
202 <p>Best bandwidth nodes are nodes with <b>higher bandwidth</b>.</p>
203 <p>The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" title="The best nodes for this memory attribute are those with the higher values. For instance Bandwidth.">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a> and <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>.</p>
204 <p>This is the average bandwidth for read and write accesses. If the platform provides individual read and write bandwidths but no explicit average value, hwloc computes and returns the average. </p>
205 </td></tr>
206 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80eac34dce925d3dadb7e255391d142b4828" name="ggab4bde745db676fc2ea4b47011cd9a80eac34dce925d3dadb7e255391d142b4828"></a>HWLOC_MEMATTR_ID_READ_BANDWIDTH&#160;</td><td class="fielddoc"><p>The "ReadBandwidth" is returned in MiB/s, as seen from the given initiator location. </p>
207 <p>Best bandwidth nodes are nodes with <b>higher bandwidth</b>.</p>
208 <p>The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" title="The best nodes for this memory attribute are those with the higher values. For instance Bandwidth.">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a> and <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>. </p>
209 </td></tr>
210 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80ea44762e8ebe327cfe665cccf1f58f7530" name="ggab4bde745db676fc2ea4b47011cd9a80ea44762e8ebe327cfe665cccf1f58f7530"></a>HWLOC_MEMATTR_ID_WRITE_BANDWIDTH&#160;</td><td class="fielddoc"><p>The "WriteBandwidth" is returned in MiB/s, as seen from the given initiator location. </p>
211 <p>Best bandwidth nodes are nodes with <b>higher bandwidth</b>.</p>
212 <p>The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" title="The best nodes for this memory attribute are those with the higher values. For instance Bandwidth.">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a> and <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>. </p>
213 </td></tr>
214 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80ead1796413759b8b87b61ad195a9349b19" name="ggab4bde745db676fc2ea4b47011cd9a80ead1796413759b8b87b61ad195a9349b19"></a>HWLOC_MEMATTR_ID_LATENCY&#160;</td><td class="fielddoc"><p>The "Latency" is returned as nanoseconds, as seen from the given initiator location. </p>
215 <p>Best latency nodes are nodes with <b>smaller latency</b>.</p>
216 <p>The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf" title="The best nodes for this memory attribute are those with the lower values. For instance Latency.">HWLOC_MEMATTR_FLAG_LOWER_FIRST</a> and <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>.</p>
217 <p>This is the average latency for read and write accesses. If the platform provides individual read and write latencies but no explicit average value, hwloc computes and returns the average. </p>
218 </td></tr>
219 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80ea52cab56571c7fafea42a694d80ad3dd0" name="ggab4bde745db676fc2ea4b47011cd9a80ea52cab56571c7fafea42a694d80ad3dd0"></a>HWLOC_MEMATTR_ID_READ_LATENCY&#160;</td><td class="fielddoc"><p>The "ReadLatency" is returned as nanoseconds, as seen from the given initiator location. </p>
220 <p>Best latency nodes are nodes with <b>smaller latency</b>.</p>
221 <p>The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf" title="The best nodes for this memory attribute are those with the lower values. For instance Latency.">HWLOC_MEMATTR_FLAG_LOWER_FIRST</a> and <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>. </p>
222 </td></tr>
223 <tr><td class="fieldname"><a id="ggab4bde745db676fc2ea4b47011cd9a80eaaf6cd383da87dc9f5e3a608a535a768e" name="ggab4bde745db676fc2ea4b47011cd9a80eaaf6cd383da87dc9f5e3a608a535a768e"></a>HWLOC_MEMATTR_ID_WRITE_LATENCY&#160;</td><td class="fielddoc"><p>The "WriteLatency" is returned as nanoseconds, as seen from the given initiator location. </p>
224 <p>Best latency nodes are nodes with <b>smaller latency</b>.</p>
225 <p>The corresponding attribute flags are <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf" title="The best nodes for this memory attribute are those with the lower values. For instance Latency.">HWLOC_MEMATTR_FLAG_LOWER_FIRST</a> and <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>. </p>
226 </td></tr>
227 </table>
228
229 </div>
230 </div>
231 <a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
232 <a id="ga569e80c5be7ef27649b0ef5aa52ffcdc" name="ga569e80c5be7ef27649b0ef5aa52ffcdc"></a>
233 <h2 class="memtitle"><span class="permalink"><a href="#ga569e80c5be7ef27649b0ef5aa52ffcdc">&#9670;&#160;</a></span>hwloc_get_local_numanode_objs()</h2>
234
235 <div class="memitem">
236 <div class="memproto">
237 <table class="memname">
238 <tr>
239 <td class="memname">int hwloc_get_local_numanode_objs </td>
240 <td>(</td>
241 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
242 </tr>
243 <tr>
244 <td class="paramkey"></td>
245 <td></td>
246 <td class="paramtype">struct <a class="el" href="a00300.html">hwloc_location</a> *</td> <td class="paramname"><span class="paramname"><em>location</em></span>, </td>
247 </tr>
248 <tr>
249 <td class="paramkey"></td>
250 <td></td>
251 <td class="paramtype">unsigned *</td> <td class="paramname"><span class="paramname"><em>nr</em></span>, </td>
252 </tr>
253 <tr>
254 <td class="paramkey"></td>
255 <td></td>
256 <td class="paramtype"><a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> *</td> <td class="paramname"><span class="paramname"><em>nodes</em></span>, </td>
257 </tr>
258 <tr>
259 <td class="paramkey"></td>
260 <td></td>
261 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>&#160;)</td>
262 </tr>
263 </table>
264 </div><div class="memdoc">
265
266 <p>Return an array of local NUMA nodes. </p>
267 <p>By default only select the NUMA nodes whose locality is exactly the given <code class="param">location</code>. More nodes may be selected if additional flags are given as a OR'ed set of <a class="el" href="#gab9c963ca37255da71b00d94e1b106f9d" title="Flags for selecting target NUMA nodes.">hwloc_local_numanode_flag_e</a>.</p>
268 <p>If <code class="param">location</code> is given as an explicit object, its CPU set is used to find NUMA nodes with the corresponding locality. If the object does not have a CPU set (e.g. I/O object), the CPU parent (where the I/O object is attached) is used.</p>
269 <p>On input, <code class="param">nr</code> points to the number of nodes that may be stored in the <code class="param">nodes</code> array. On output, <code class="param">nr</code> will be changed to the number of stored nodes, or the number of nodes that would have been stored if there were enough room.</p>
270 <dl class="section return"><dt>Returns</dt><dd>0 on success or -1 on error.</dd></dl>
271 <dl class="section note"><dt>Note</dt><dd>Some of these NUMA nodes may not have any memory attribute values and hence not be reported as actual targets in other functions.</dd>
272 <dd>
273 The number of NUMA nodes in the topology (obtained by <a class="el" href="a00188.html#ga0200466842c0e1f5da75e84dde460b10" title="Compute the &quot;weight&quot; of bitmap bitmap (i.e., number of indexes that are in the bitmap).">hwloc_bitmap_weight()</a> on the root object nodeset) may be used to allocate the <code class="param">nodes</code> array.</dd>
274 <dd>
275 When an object CPU set is given as locality, for instance a Package, and when flags contain both <a class="el" href="#ggab9c963ca37255da71b00d94e1b106f9da200c6c133bb2125ba36d77ce9ca268cc" title="Select NUMA nodes whose locality is larger than the given cpuset. For instance, if a single PU (or it...">HWLOC_LOCAL_NUMANODE_FLAG_LARGER_LOCALITY</a> and <a class="el" href="#ggab9c963ca37255da71b00d94e1b106f9daac9c5e3a2cfb1b193e4acfceaf3bad57" title="Select NUMA nodes whose locality is smaller than the given cpuset. For instance, if a package (or its...">HWLOC_LOCAL_NUMANODE_FLAG_SMALLER_LOCALITY</a>, the returned array corresponds to the nodeset of that object. </dd></dl>
276
277 </div>
278 </div>
279 <a id="gaf6b746dd3494772db18eaf760a5dd9c0" name="gaf6b746dd3494772db18eaf760a5dd9c0"></a>
280 <h2 class="memtitle"><span class="permalink"><a href="#gaf6b746dd3494772db18eaf760a5dd9c0">&#9670;&#160;</a></span>hwloc_memattr_get_best_initiator()</h2>
281
282 <div class="memitem">
283 <div class="memproto">
284 <table class="memname">
285 <tr>
286 <td class="memname">int hwloc_memattr_get_best_initiator </td>
287 <td>(</td>
288 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
289 </tr>
290 <tr>
291 <td class="paramkey"></td>
292 <td></td>
293 <td class="paramtype"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
294 </tr>
295 <tr>
296 <td class="paramkey"></td>
297 <td></td>
298 <td class="paramtype"><a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a></td> <td class="paramname"><span class="paramname"><em>target_node</em></span>, </td>
299 </tr>
300 <tr>
301 <td class="paramkey"></td>
302 <td></td>
303 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
304 </tr>
305 <tr>
306 <td class="paramkey"></td>
307 <td></td>
308 <td class="paramtype">struct <a class="el" href="a00300.html">hwloc_location</a> *</td> <td class="paramname"><span class="paramname"><em>best_initiator</em></span>, </td>
309 </tr>
310 <tr>
311 <td class="paramkey"></td>
312 <td></td>
313 <td class="paramtype">hwloc_uint64_t *</td> <td class="paramname"><span class="paramname"><em>value</em></span>&#160;)</td>
314 </tr>
315 </table>
316 </div><div class="memdoc">
317
318 <p>Return the best initiator for the given attribute and target NUMA node. </p>
319 <p>If <code class="param">value</code> is non <code>NULL</code>, the corresponding value is returned there.</p>
320 <p>If multiple initiators have the same attribute values, only one is returned (and there is no way to clarify how that one is chosen). Applications that want to detect initiators with identical/similar values, or that want to look at values for multiple attributes, should rather get all values using <a class="el" href="#ga297e4a9adc2272446a4c7449dacef0df" title="Return an attribute value for a specific target NUMA node.">hwloc_memattr_get_value()</a> and manually select the initiator they consider the best.</p>
321 <p>The returned initiator should not be modified or freed, it belongs to the topology.</p>
322 <p><code class="param">target_node</code> cannot be <code>NULL</code>.</p>
323 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
324 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
325 <dd>
326 -1 with errno set to <code>ENOENT</code> if there are no matching initiators. </dd>
327 <dd>
328 -1 with errno set to <code>EINVAL</code> if the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>). </dd></dl>
329
330 </div>
331 </div>
332 <a id="ga884d1f2ad745c2fa69c1583c82d28f10" name="ga884d1f2ad745c2fa69c1583c82d28f10"></a>
333 <h2 class="memtitle"><span class="permalink"><a href="#ga884d1f2ad745c2fa69c1583c82d28f10">&#9670;&#160;</a></span>hwloc_memattr_get_best_target()</h2>
334
335 <div class="memitem">
336 <div class="memproto">
337 <table class="memname">
338 <tr>
339 <td class="memname">int hwloc_memattr_get_best_target </td>
340 <td>(</td>
341 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
342 </tr>
343 <tr>
344 <td class="paramkey"></td>
345 <td></td>
346 <td class="paramtype"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
347 </tr>
348 <tr>
349 <td class="paramkey"></td>
350 <td></td>
351 <td class="paramtype">struct <a class="el" href="a00300.html">hwloc_location</a> *</td> <td class="paramname"><span class="paramname"><em>initiator</em></span>, </td>
352 </tr>
353 <tr>
354 <td class="paramkey"></td>
355 <td></td>
356 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
357 </tr>
358 <tr>
359 <td class="paramkey"></td>
360 <td></td>
361 <td class="paramtype"><a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> *</td> <td class="paramname"><span class="paramname"><em>best_target</em></span>, </td>
362 </tr>
363 <tr>
364 <td class="paramkey"></td>
365 <td></td>
366 <td class="paramtype">hwloc_uint64_t *</td> <td class="paramname"><span class="paramname"><em>value</em></span>&#160;)</td>
367 </tr>
368 </table>
369 </div><div class="memdoc">
370
371 <p>Return the best target NUMA node for the given attribute and initiator. </p>
372 <p>If the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>), location <code class="param">initiator</code> is ignored and may be <code>NULL</code>.</p>
373 <p>If <code class="param">value</code> is non <code>NULL</code>, the corresponding value is returned there.</p>
374 <p>If multiple targets have the same attribute values, only one is returned (and there is no way to clarify how that one is chosen). Applications that want to detect targets with identical/similar values, or that want to look at values for multiple attributes, should rather get all values using <a class="el" href="#ga297e4a9adc2272446a4c7449dacef0df" title="Return an attribute value for a specific target NUMA node.">hwloc_memattr_get_value()</a> and manually select the target they consider the best.</p>
375 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
376 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
377 <dd>
378 -1 with errno set to <code>ENOENT</code> if there are no matching targets. </dd>
379 <dd>
380 -1 with errno set to <code>EINVAL</code> if flags are invalid, or no such attribute exists.</dd></dl>
381 <dl class="section note"><dt>Note</dt><dd>The initiator <code class="param">initiator</code> should be of type <a class="el" href="#gga33099ba58f607fc70925da3777688586a7135318a86361ad75fd1648e6bf6d174" title="Location is given as a cpuset, in the location cpuset union field.">HWLOC_LOCATION_TYPE_CPUSET</a> when refering to accesses performed by CPU cores. <a class="el" href="#gga33099ba58f607fc70925da3777688586af637c39b23d48cff15ddb008644aaa84" title="Location is given as an object, in the location object union field.">HWLOC_LOCATION_TYPE_OBJECT</a> is currently unused internally by hwloc, but users may for instance use it to provide custom information about host memory accesses performed by GPUs. </dd></dl>
382
383 </div>
384 </div>
385 <a id="ga79f44f8e1cfd2f97a19171417a75a137" name="ga79f44f8e1cfd2f97a19171417a75a137"></a>
386 <h2 class="memtitle"><span class="permalink"><a href="#ga79f44f8e1cfd2f97a19171417a75a137">&#9670;&#160;</a></span>hwloc_memattr_get_by_name()</h2>
387
388 <div class="memitem">
389 <div class="memproto">
390 <table class="memname">
391 <tr>
392 <td class="memname">int hwloc_memattr_get_by_name </td>
393 <td>(</td>
394 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
395 </tr>
396 <tr>
397 <td class="paramkey"></td>
398 <td></td>
399 <td class="paramtype">const char *</td> <td class="paramname"><span class="paramname"><em>name</em></span>, </td>
400 </tr>
401 <tr>
402 <td class="paramkey"></td>
403 <td></td>
404 <td class="paramtype"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> *</td> <td class="paramname"><span class="paramname"><em>id</em></span>&#160;)</td>
405 </tr>
406 </table>
407 </div><div class="memdoc">
408
409 <p>Return the identifier of the memory attribute with the given name. </p>
410 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
411 <dd>
412 -1 with errno set to <code>EINVAL</code> if no such attribute exists. </dd></dl>
413
414 </div>
415 </div>
416 <a id="ga049aaa860dcbbf0792f0fd4251a99ec0" name="ga049aaa860dcbbf0792f0fd4251a99ec0"></a>
417 <h2 class="memtitle"><span class="permalink"><a href="#ga049aaa860dcbbf0792f0fd4251a99ec0">&#9670;&#160;</a></span>hwloc_memattr_get_initiators()</h2>
418
419 <div class="memitem">
420 <div class="memproto">
421 <table class="memname">
422 <tr>
423 <td class="memname">int hwloc_memattr_get_initiators </td>
424 <td>(</td>
425 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
426 </tr>
427 <tr>
428 <td class="paramkey"></td>
429 <td></td>
430 <td class="paramtype"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
431 </tr>
432 <tr>
433 <td class="paramkey"></td>
434 <td></td>
435 <td class="paramtype"><a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a></td> <td class="paramname"><span class="paramname"><em>target_node</em></span>, </td>
436 </tr>
437 <tr>
438 <td class="paramkey"></td>
439 <td></td>
440 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
441 </tr>
442 <tr>
443 <td class="paramkey"></td>
444 <td></td>
445 <td class="paramtype">unsigned *</td> <td class="paramname"><span class="paramname"><em>nr</em></span>, </td>
446 </tr>
447 <tr>
448 <td class="paramkey"></td>
449 <td></td>
450 <td class="paramtype">struct <a class="el" href="a00300.html">hwloc_location</a> *</td> <td class="paramname"><span class="paramname"><em>initiators</em></span>, </td>
451 </tr>
452 <tr>
453 <td class="paramkey"></td>
454 <td></td>
455 <td class="paramtype">hwloc_uint64_t *</td> <td class="paramname"><span class="paramname"><em>values</em></span>&#160;)</td>
456 </tr>
457 </table>
458 </div><div class="memdoc">
459
460 <p>Return the initiators that have values for a given attribute for a specific target NUMA node. </p>
461 <p>Return initiators for the given attribute and target node in the <code class="param">initiators</code> array. If <code class="param">values</code> is not <code>NULL</code>, the corresponding attribute values are stored in the array it points to.</p>
462 <p>On input, <code class="param">nr</code> points to the number of initiators that may be stored in the array <code class="param">initiators</code> (and <code class="param">values</code>). On output, <code class="param">nr</code> 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 (<code>0</code>). The caller may find out by comparing the value pointed by <code class="param">nr</code> before and after the function call.</p>
463 <p>The returned initiators should not be modified or freed, they belong to the topology.</p>
464 <p><code class="param">target_node</code> cannot be <code>NULL</code>.</p>
465 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
466 <p>If the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>), no initiator is returned.</p>
467 <dl class="section return"><dt>Returns</dt><dd>0 on success or -1 on error.</dd></dl>
468 <dl class="section note"><dt>Note</dt><dd>This function is meant for tools and debugging (listing internal information) rather than for application queries. Applications should rather select useful NUMA nodes with <a class="el" href="#ga569e80c5be7ef27649b0ef5aa52ffcdc" title="Return an array of local NUMA nodes.">hwloc_get_local_numanode_objs()</a> and then look at their attribute values for some relevant initiators. </dd></dl>
469
470 </div>
471 </div>
472 <a id="gac8c06c1c89ab352c5db8e04a75033513" name="gac8c06c1c89ab352c5db8e04a75033513"></a>
473 <h2 class="memtitle"><span class="permalink"><a href="#gac8c06c1c89ab352c5db8e04a75033513">&#9670;&#160;</a></span>hwloc_memattr_get_targets()</h2>
474
475 <div class="memitem">
476 <div class="memproto">
477 <table class="memname">
478 <tr>
479 <td class="memname">int hwloc_memattr_get_targets </td>
480 <td>(</td>
481 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
482 </tr>
483 <tr>
484 <td class="paramkey"></td>
485 <td></td>
486 <td class="paramtype"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
487 </tr>
488 <tr>
489 <td class="paramkey"></td>
490 <td></td>
491 <td class="paramtype">struct <a class="el" href="a00300.html">hwloc_location</a> *</td> <td class="paramname"><span class="paramname"><em>initiator</em></span>, </td>
492 </tr>
493 <tr>
494 <td class="paramkey"></td>
495 <td></td>
496 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
497 </tr>
498 <tr>
499 <td class="paramkey"></td>
500 <td></td>
501 <td class="paramtype">unsigned *</td> <td class="paramname"><span class="paramname"><em>nr</em></span>, </td>
502 </tr>
503 <tr>
504 <td class="paramkey"></td>
505 <td></td>
506 <td class="paramtype"><a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> *</td> <td class="paramname"><span class="paramname"><em>targets</em></span>, </td>
507 </tr>
508 <tr>
509 <td class="paramkey"></td>
510 <td></td>
511 <td class="paramtype">hwloc_uint64_t *</td> <td class="paramname"><span class="paramname"><em>values</em></span>&#160;)</td>
512 </tr>
513 </table>
514 </div><div class="memdoc">
515
516 <p>Return the target NUMA nodes that have some values for a given attribute. </p>
517 <p>Return targets for the given attribute in the <code class="param">targets</code> array (for the given initiator if any). If <code class="param">values</code> is not <code>NULL</code>, the corresponding attribute values are stored in the array it points to.</p>
518 <p>On input, <code class="param">nr</code> points to the number of targets that may be stored in the array <code class="param">targets</code> (and <code class="param">values</code>). On output, <code class="param">nr</code> 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 (<code>0</code>). The caller may find out by comparing the value pointed by <code class="param">nr</code> before and after the function call.</p>
519 <p>The returned targets should not be modified or freed, they belong to the topology.</p>
520 <p>Argument <code class="param">initiator</code> is ignored if the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>). Otherwise <code class="param">initiator</code> may be non <code>NULL</code> to report only targets that have a value for that initiator.</p>
521 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
522 <dl class="section note"><dt>Note</dt><dd>This function is meant for tools and debugging (listing internal information) rather than for application queries. Applications should rather select useful NUMA nodes with <a class="el" href="#ga569e80c5be7ef27649b0ef5aa52ffcdc" title="Return an array of local NUMA nodes.">hwloc_get_local_numanode_objs()</a> and then look at their attribute values.</dd></dl>
523 <dl class="section return"><dt>Returns</dt><dd>0 on success or -1 on error.</dd></dl>
524 <dl class="section note"><dt>Note</dt><dd>The initiator <code class="param">initiator</code> should be of type <a class="el" href="#gga33099ba58f607fc70925da3777688586a7135318a86361ad75fd1648e6bf6d174" title="Location is given as a cpuset, in the location cpuset union field.">HWLOC_LOCATION_TYPE_CPUSET</a> when referring to accesses performed by CPU cores. <a class="el" href="#gga33099ba58f607fc70925da3777688586af637c39b23d48cff15ddb008644aaa84" title="Location is given as an object, in the location object union field.">HWLOC_LOCATION_TYPE_OBJECT</a> is currently unused internally by hwloc, but users may for instance use it to provide custom information about host memory accesses performed by GPUs. </dd></dl>
525
526 </div>
527 </div>
528 <a id="ga297e4a9adc2272446a4c7449dacef0df" name="ga297e4a9adc2272446a4c7449dacef0df"></a>
529 <h2 class="memtitle"><span class="permalink"><a href="#ga297e4a9adc2272446a4c7449dacef0df">&#9670;&#160;</a></span>hwloc_memattr_get_value()</h2>
530
531 <div class="memitem">
532 <div class="memproto">
533 <table class="memname">
534 <tr>
535 <td class="memname">int hwloc_memattr_get_value </td>
536 <td>(</td>
537 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
538 </tr>
539 <tr>
540 <td class="paramkey"></td>
541 <td></td>
542 <td class="paramtype"><a class="el" href="#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
543 </tr>
544 <tr>
545 <td class="paramkey"></td>
546 <td></td>
547 <td class="paramtype"><a class="el" href="a00168.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a></td> <td class="paramname"><span class="paramname"><em>target_node</em></span>, </td>
548 </tr>
549 <tr>
550 <td class="paramkey"></td>
551 <td></td>
552 <td class="paramtype">struct <a class="el" href="a00300.html">hwloc_location</a> *</td> <td class="paramname"><span class="paramname"><em>initiator</em></span>, </td>
553 </tr>
554 <tr>
555 <td class="paramkey"></td>
556 <td></td>
557 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
558 </tr>
559 <tr>
560 <td class="paramkey"></td>
561 <td></td>
562 <td class="paramtype">hwloc_uint64_t *</td> <td class="paramname"><span class="paramname"><em>value</em></span>&#160;)</td>
563 </tr>
564 </table>
565 </div><div class="memdoc">
566
567 <p>Return an attribute value for a specific target NUMA node. </p>
568 <p>If the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="a00196.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" title="The value returned for this memory attribute depends on the given initiator. For instance Bandwidth a...">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a>), location <code class="param">initiator</code> is ignored and may be <code>NULL</code>.</p>
569 <p><code class="param">target_node</code> cannot be <code>NULL</code>. If <code class="param">attribute</code> is <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80eaa1cfa3ff3d56ff00ecabf7da4f5642cc" title="The &quot;Capacity&quot; is returned in bytes (local_memory attribute in objects).">HWLOC_MEMATTR_ID_CAPACITY</a>, <code class="param">target_node</code> must be a NUMA node. If it is <a class="el" href="#ggab4bde745db676fc2ea4b47011cd9a80ea9334e3a4c30a67f491c6523255134efe" title="The &quot;Locality&quot; is returned as the number of PUs in that locality (e.g. the weight of its cpuset).">HWLOC_MEMATTR_ID_LOCALITY</a>, <code class="param">target_node</code> must have a CPU set.</p>
570 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
571 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
572 <dd>
573 -1 on error, for instance with errno set to <code>EINVAL</code> if flags are invalid or no such attribute exists.</dd></dl>
574 <dl class="section note"><dt>Note</dt><dd>The initiator <code class="param">initiator</code> should be of type <a class="el" href="#gga33099ba58f607fc70925da3777688586a7135318a86361ad75fd1648e6bf6d174" title="Location is given as a cpuset, in the location cpuset union field.">HWLOC_LOCATION_TYPE_CPUSET</a> when refering to accesses performed by CPU cores. <a class="el" href="#gga33099ba58f607fc70925da3777688586af637c39b23d48cff15ddb008644aaa84" title="Location is given as an object, in the location object union field.">HWLOC_LOCATION_TYPE_OBJECT</a> is currently unused internally by hwloc, but users may for instance use it to provide custom information about host memory accesses performed by GPUs. </dd></dl>
575
576 </div>
577 </div>
578 <a id="gae7ff5d6f04d3bb71a3259cf1ff3afaed" name="gae7ff5d6f04d3bb71a3259cf1ff3afaed"></a>
579 <h2 class="memtitle"><span class="permalink"><a href="#gae7ff5d6f04d3bb71a3259cf1ff3afaed">&#9670;&#160;</a></span>hwloc_topology_get_default_nodeset()</h2>
580
581 <div class="memitem">
582 <div class="memproto">
583 <table class="memname">
584 <tr>
585 <td class="memname">int hwloc_topology_get_default_nodeset </td>
586 <td>(</td>
587 <td class="paramtype"><a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a></td> <td class="paramname"><span class="paramname"><em>topology</em></span>, </td>
588 </tr>
589 <tr>
590 <td class="paramkey"></td>
591 <td></td>
592 <td class="paramtype"><a class="el" href="a00166.html#ga37e35730fa7e775b5bb0afe893d6d508">hwloc_nodeset_t</a></td> <td class="paramname"><span class="paramname"><em>nodeset</em></span>, </td>
593 </tr>
594 <tr>
595 <td class="paramkey"></td>
596 <td></td>
597 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>&#160;)</td>
598 </tr>
599 </table>
600 </div><div class="memdoc">
601
602 <p>Return the set of default NUMA nodes. </p>
603 <p>In machines with heterogeneous memory, some NUMA nodes are considered the default ones, i.e. where basic allocations should be made from. These are usually DRAM nodes.</p>
604 <p>Other nodes may be reserved for specific use (I/O device memory, e.g. GPU memory), small but high performance (HBM), large but slow memory (NVM), etc. Buffers should usually not be allocated from there unless explicitly required.</p>
605 <p>This function fills <code class="param">nodeset</code> with the bits of NUMA nodes considered default.</p>
606 <p>It is guaranteed that these nodes have non-intersecting CPU sets, i.e. cores may not have multiple local NUMA nodes anymore. Hence this may be used to iterate over the platform divided into separate NUMA localities, for instance for binding one task per NUMA domain.</p>
607 <p>Any core that had some local NUMA node(s) in the initial topology should still have one in the default nodeset. Corner cases where this would be wrong consist in asymmetric platforms with missing DRAM nodes, or topologies that were already restricted to less NUMA nodes.</p>
608 <p>The returned nodeset may be passed to <a class="el" href="a00177.html#ga6db81ed13ac0a9d70cc80372ab537815" title="Restrict the topology to the given CPU set or nodeset.">hwloc_topology_restrict()</a> with <a class="el" href="a00177.html#gga9d80f08eb25b7ac22f1b998dc8bf521fae4c5b1b87232f2d8a60559e77ac65a68" title="Restrict by nodeset instead of CPU set. Only keep objects whose nodeset is included or partially incl...">HWLOC_RESTRICT_FLAG_BYNODESET</a> to remove all non-default nodes from the topology. The resulting topology will be easier to use when iterating over (now homogeneous) NUMA nodes.</p>
609 <p>The heuristics for finding default nodes relies on memory tiers and subtypes (see <a class="el" href="a00379.html">Heterogeneous Memory</a>) as well as the assumption that hardware vendors list default nodes first in hardware tables.</p>
610 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
611 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
612 <dd>
613 -1 on error.</dd></dl>
614 <dl class="section note"><dt>Note</dt><dd>The returned nodeset usually contains all nodes from a single memory tier, likely the DRAM one.</dd>
615 <dd>
616 The returned nodeset is included in the list of available nodes returned by <a class="el" href="a00185.html#ga3fd37303e99ace8b0d0ea03f95f8c514" title="Get topology node set.">hwloc_topology_get_topology_nodeset()</a>. It is strictly smaller if the machine has heterogeneous memory.</dd>
617 <dd>
618 The heuristics may return a suboptimal set of nodes if hwloc could not guess memory types and/or if some default nodes were removed earlier from the topology (e.g. with <a class="el" href="a00177.html#ga6db81ed13ac0a9d70cc80372ab537815" title="Restrict the topology to the given CPU set or nodeset.">hwloc_topology_restrict()</a>). </dd></dl>
619
620 </div>
621 </div>
622 </div><!-- contents -->
623 <!-- start footer part -->
624 <hr class="footer"/><address class="footer"><small>
625 Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.15.0
626 </small></address>
627 </div><!-- doc-content -->
628 </body>
629 </html>