Debian Codegraph @

doc/doxygen-doc/html/a00196.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): Managing memory attributes</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="#enum-members">Enumerations</a> &#124;
47 <a href="#func-members">Functions</a> </div>
48 <div class="headertitle"><div class="title">Managing memory attributes </div></div>
49 </div><!--header-->
50 <div class="contents">
51 <table class="memberdecls">
52 <tr class="heading"><td colspan="2"><h2 id="header-enum-members" class="groupheader"><a id="enum-members" name="enum-members"></a>
53 Enumerations</h2></td></tr>
54 <tr class="memitem:ga78aceb4cac4d614c0f5e82dbfeb779e5" id="r_ga78aceb4cac4d614c0f5e82dbfeb779e5"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga78aceb4cac4d614c0f5e82dbfeb779e5">hwloc_memattr_flag_e</a> { <a class="el" href="#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a> = (1UL&lt;&lt;0)
55 , <a class="el" href="#gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf">HWLOC_MEMATTR_FLAG_LOWER_FIRST</a> = (1UL&lt;&lt;1)
56 , <a class="el" href="#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a> = (1UL&lt;&lt;2)
57 }</td></tr>
58 </table><table class="memberdecls">
59 <tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
60 Functions</h2></td></tr>
61 <tr class="memitem:ga5300e9be1abdea2e00c18492148aecd0" id="r_ga5300e9be1abdea2e00c18492148aecd0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga5300e9be1abdea2e00c18492148aecd0">hwloc_memattr_get_name</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, const char **name)</td></tr>
62 <tr class="memitem:ga4c62b626085adeaffb233e5f2a03a5eb" id="r_ga4c62b626085adeaffb233e5f2a03a5eb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga4c62b626085adeaffb233e5f2a03a5eb">hwloc_memattr_get_flags</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, unsigned long *flags)</td></tr>
63 <tr class="memitem:ga770657d1e44b09e93e09f623936c1e5f" id="r_ga770657d1e44b09e93e09f623936c1e5f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga770657d1e44b09e93e09f623936c1e5f">hwloc_memattr_register</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const char *name, unsigned long flags, <a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> *id)</td></tr>
64 <tr class="memitem:ga960529c08b25cf15825e0f72ecceb504" id="r_ga960529c08b25cf15825e0f72ecceb504"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ga960529c08b25cf15825e0f72ecceb504">hwloc_memattr_set_value</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00195.html#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>
65 </table>
66 <a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
67 <p>Memory attribues are identified by an ID (<a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888" title="A memory attribute identifier.">hwloc_memattr_id_t</a>) and a name. <a class="el" href="#ga5300e9be1abdea2e00c18492148aecd0" title="Return the name of a memory attribute.">hwloc_memattr_get_name()</a> and <a class="el" href="a00195.html#ga79f44f8e1cfd2f97a19171417a75a137" title="Return the identifier of the memory attribute with the given name.">hwloc_memattr_get_by_name()</a> convert between them (or return error if the attribute does not exist).</p>
68 <p>The set of valid <a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888" title="A memory attribute identifier.">hwloc_memattr_id_t</a> is a contigous set starting at <code>0</code>. It first contains predefined attributes, as listed in <a class="el" href="a00195.html#gab4bde745db676fc2ea4b47011cd9a80e" title="Predefined memory attribute IDs. See hwloc_memattr_id_t for the generic definition of IDs for predefi...">hwloc_memattr_id_e</a> (from <code>0</code> to <code>HWLOC_MEMATTR_ID_MAX-1</code>). Then custom attributes may be dynamically registered with <a class="el" href="#ga770657d1e44b09e93e09f623936c1e5f" title="Register a new memory attribute.">hwloc_memattr_register()</a>. They will get the following IDs (<code>HWLOC_MEMATTR_ID_MAX</code> for the first one, etc.).</p>
69 <p>To iterate over all valid attributes (either predefined or dynamically registered custom ones), one may iterate over IDs starting from <code>0</code> until <a class="el" href="#ga5300e9be1abdea2e00c18492148aecd0" title="Return the name of a memory attribute.">hwloc_memattr_get_name()</a> or <a class="el" href="#ga4c62b626085adeaffb233e5f2a03a5eb" title="Return the flags of the given attribute.">hwloc_memattr_get_flags()</a> returns an error.</p>
70 <p>The values for an existing attribute or for custom dynamically registered ones may be set or modified with <a class="el" href="#ga960529c08b25cf15825e0f72ecceb504" title="Set an attribute value for a specific target NUMA node.">hwloc_memattr_set_value()</a>. </p>
71 <a name="doc-enum-members" id="doc-enum-members"></a><h2 id="header-doc-enum-members" class="groupheader">Enumeration Type Documentation</h2>
72 <a id="ga78aceb4cac4d614c0f5e82dbfeb779e5" name="ga78aceb4cac4d614c0f5e82dbfeb779e5"></a>
73 <h2 class="memtitle"><span class="permalink"><a href="#ga78aceb4cac4d614c0f5e82dbfeb779e5">&#9670;&#160;</a></span>hwloc_memattr_flag_e</h2>
74
75 <div class="memitem">
76 <div class="memproto">
77 <table class="memname">
78 <tr>
79 <td class="memname">enum <a class="el" href="#ga78aceb4cac4d614c0f5e82dbfeb779e5">hwloc_memattr_flag_e</a></td>
80 </tr>
81 </table>
82 </div><div class="memdoc">
83
84 <p>Memory attribute flags. Given to <a class="el" href="#ga770657d1e44b09e93e09f623936c1e5f" title="Register a new memory attribute.">hwloc_memattr_register()</a> and returned by <a class="el" href="#ga4c62b626085adeaffb233e5f2a03a5eb" title="Return the flags of the given attribute.">hwloc_memattr_get_flags()</a>. </p>
85 <table class="fieldtable">
86 <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" name="gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815"></a>HWLOC_MEMATTR_FLAG_HIGHER_FIRST&#160;</td><td class="fielddoc"><p>The best nodes for this memory attribute are those with the higher values. For instance Bandwidth. </p>
87 </td></tr>
88 <tr><td class="fieldname"><a id="gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf" name="gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf"></a>HWLOC_MEMATTR_FLAG_LOWER_FIRST&#160;</td><td class="fielddoc"><p>The best nodes for this memory attribute are those with the lower values. For instance Latency. </p>
89 </td></tr>
90 <tr><td class="fieldname"><a id="gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" name="gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96"></a>HWLOC_MEMATTR_FLAG_NEED_INITIATOR&#160;</td><td class="fielddoc"><p>The value returned for this memory attribute depends on the given initiator. For instance Bandwidth and Latency, but not Capacity. </p>
91 </td></tr>
92 </table>
93
94 </div>
95 </div>
96 <a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
97 <a id="ga4c62b626085adeaffb233e5f2a03a5eb" name="ga4c62b626085adeaffb233e5f2a03a5eb"></a>
98 <h2 class="memtitle"><span class="permalink"><a href="#ga4c62b626085adeaffb233e5f2a03a5eb">&#9670;&#160;</a></span>hwloc_memattr_get_flags()</h2>
99
100 <div class="memitem">
101 <div class="memproto">
102 <table class="memname">
103 <tr>
104 <td class="memname">int hwloc_memattr_get_flags </td>
105 <td>(</td>
106 <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>
107 </tr>
108 <tr>
109 <td class="paramkey"></td>
110 <td></td>
111 <td class="paramtype"><a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
112 </tr>
113 <tr>
114 <td class="paramkey"></td>
115 <td></td>
116 <td class="paramtype">unsigned long *</td> <td class="paramname"><span class="paramname"><em>flags</em></span>&#160;)</td>
117 </tr>
118 </table>
119 </div><div class="memdoc">
120
121 <p>Return the flags of the given attribute. </p>
122 <p>Flags are a OR'ed set of <a class="el" href="#ga78aceb4cac4d614c0f5e82dbfeb779e5" title="Memory attribute flags. Given to hwloc_memattr_register() and returned by hwloc_memattr_get_flags().">hwloc_memattr_flag_e</a>.</p>
123 <p>The output pointer <code class="param">flags</code> cannot be <code>NULL</code>.</p>
124 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
125 <dd>
126 -1 with errno set to <code>EINVAL</code> if the attribute does not exist. </dd></dl>
127
128 </div>
129 </div>
130 <a id="ga5300e9be1abdea2e00c18492148aecd0" name="ga5300e9be1abdea2e00c18492148aecd0"></a>
131 <h2 class="memtitle"><span class="permalink"><a href="#ga5300e9be1abdea2e00c18492148aecd0">&#9670;&#160;</a></span>hwloc_memattr_get_name()</h2>
132
133 <div class="memitem">
134 <div class="memproto">
135 <table class="memname">
136 <tr>
137 <td class="memname">int hwloc_memattr_get_name </td>
138 <td>(</td>
139 <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>
140 </tr>
141 <tr>
142 <td class="paramkey"></td>
143 <td></td>
144 <td class="paramtype"><a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
145 </tr>
146 <tr>
147 <td class="paramkey"></td>
148 <td></td>
149 <td class="paramtype">const char **</td> <td class="paramname"><span class="paramname"><em>name</em></span>&#160;)</td>
150 </tr>
151 </table>
152 </div><div class="memdoc">
153
154 <p>Return the name of a memory attribute. </p>
155 <p>The output pointer <code class="param">name</code> cannot be <code>NULL</code>.</p>
156 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
157 <dd>
158 -1 with errno set to <code>EINVAL</code> if the attribute does not exist. </dd></dl>
159
160 </div>
161 </div>
162 <a id="ga770657d1e44b09e93e09f623936c1e5f" name="ga770657d1e44b09e93e09f623936c1e5f"></a>
163 <h2 class="memtitle"><span class="permalink"><a href="#ga770657d1e44b09e93e09f623936c1e5f">&#9670;&#160;</a></span>hwloc_memattr_register()</h2>
164
165 <div class="memitem">
166 <div class="memproto">
167 <table class="memname">
168 <tr>
169 <td class="memname">int hwloc_memattr_register </td>
170 <td>(</td>
171 <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>
172 </tr>
173 <tr>
174 <td class="paramkey"></td>
175 <td></td>
176 <td class="paramtype">const char *</td> <td class="paramname"><span class="paramname"><em>name</em></span>, </td>
177 </tr>
178 <tr>
179 <td class="paramkey"></td>
180 <td></td>
181 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
182 </tr>
183 <tr>
184 <td class="paramkey"></td>
185 <td></td>
186 <td class="paramtype"><a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> *</td> <td class="paramname"><span class="paramname"><em>id</em></span>&#160;)</td>
187 </tr>
188 </table>
189 </div><div class="memdoc">
190
191 <p>Register a new memory attribute. </p>
192 <p>Add a new custom memory attribute. Flags are a OR'ed set of <a class="el" href="#ga78aceb4cac4d614c0f5e82dbfeb779e5" title="Memory attribute flags. Given to hwloc_memattr_register() and returned by hwloc_memattr_get_flags().">hwloc_memattr_flag_e</a>. It must contain one of <a class="el" href="#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" title="The best nodes for this memory attribute are those with the higher values. For instance Bandwidth.">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a> or <a class="el" href="#gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf" title="The best nodes for this memory attribute are those with the lower values. For instance Latency.">HWLOC_MEMATTR_FLAG_LOWER_FIRST</a> but not both.</p>
193 <p>The new attribute <code class="param">id</code> is immediately after the last existing attribute ID (which is either the ID of the last registered attribute if any, or the ID of the last predefined attribute in <a class="el" href="a00195.html#gab4bde745db676fc2ea4b47011cd9a80e" title="Predefined memory attribute IDs. See hwloc_memattr_id_t for the generic definition of IDs for predefi...">hwloc_memattr_id_e</a>).</p>
194 <dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
195 <dd>
196 -1 with errno set to <code>EINVAL</code> if an invalid set of flags is given. </dd>
197 <dd>
198 -1 with errno set to <code>EBUSY</code> if another attribute already uses this name. </dd></dl>
199
200 </div>
201 </div>
202 <a id="ga960529c08b25cf15825e0f72ecceb504" name="ga960529c08b25cf15825e0f72ecceb504"></a>
203 <h2 class="memtitle"><span class="permalink"><a href="#ga960529c08b25cf15825e0f72ecceb504">&#9670;&#160;</a></span>hwloc_memattr_set_value()</h2>
204
205 <div class="memitem">
206 <div class="memproto">
207 <table class="memname">
208 <tr>
209 <td class="memname">int hwloc_memattr_set_value </td>
210 <td>(</td>
211 <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>
212 </tr>
213 <tr>
214 <td class="paramkey"></td>
215 <td></td>
216 <td class="paramtype"><a class="el" href="a00195.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a></td> <td class="paramname"><span class="paramname"><em>attribute</em></span>, </td>
217 </tr>
218 <tr>
219 <td class="paramkey"></td>
220 <td></td>
221 <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>
222 </tr>
223 <tr>
224 <td class="paramkey"></td>
225 <td></td>
226 <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>
227 </tr>
228 <tr>
229 <td class="paramkey"></td>
230 <td></td>
231 <td class="paramtype">unsigned long</td> <td class="paramname"><span class="paramname"><em>flags</em></span>, </td>
232 </tr>
233 <tr>
234 <td class="paramkey"></td>
235 <td></td>
236 <td class="paramtype">hwloc_uint64_t</td> <td class="paramname"><span class="paramname"><em>value</em></span>&#160;)</td>
237 </tr>
238 </table>
239 </div><div class="memdoc">
240
241 <p>Set an attribute value for a specific target NUMA node. </p>
242 <p>If the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="#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>
243 <p>The initiator will be copied into the topology, the caller should free anything allocated to store the initiator, for instance the cpuset.</p>
244 <p><code class="param">target_node</code> cannot be <code>NULL</code>.</p>
245 <p><code class="param">attribute</code> cannot be <a class="el" href="a00195.html#ggab4bde745db676fc2ea4b47011cd9a80eaa1cfa3ff3d56ff00ecabf7da4f5642cc" title="The &quot;Capacity&quot; is returned in bytes (local_memory attribute in objects).">HWLOC_MEMATTR_ID_CAPACITY</a> or <a class="el" href="a00195.html#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>.</p>
246 <p><code class="param">flags</code> must be <code>0</code> for now.</p>
247 <dl class="section note"><dt>Note</dt><dd>The initiator <code class="param">initiator</code> should be of type <a class="el" href="a00195.html#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="a00195.html#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>
248 <dl class="section return"><dt>Returns</dt><dd>0 on success or -1 on error. </dd></dl>
249
250 </div>
251 </div>
252 </div><!-- contents -->
253 <!-- start footer part -->
254 <hr class="footer"/><address class="footer"><small>
255 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
256 </small></address>
257 </div><!-- doc-content -->
258 </body>
259 </html>