1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Locality (hwloc): Managing memory attributes</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Hardware Locality (hwloc)<span id="projectnumber"> 2.12.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">Managing memory attributes</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga78aceb4cac4d614c0f5e82dbfeb779e5" id="r_ga78aceb4cac4d614c0f5e82dbfeb779e5"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00193.html#ga78aceb4cac4d614c0f5e82dbfeb779e5">hwloc_memattr_flag_e</a> { <a class="el" href="a00193.html#gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815">HWLOC_MEMATTR_FLAG_HIGHER_FIRST</a> = (1UL<<0)
, <a class="el" href="a00193.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf">HWLOC_MEMATTR_FLAG_LOWER_FIRST</a> = (1UL<<1)
, <a class="el" href="a00193.html#gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96">HWLOC_MEMATTR_FLAG_NEED_INITIATOR</a> = (1UL<<2)
}</td></tr>
<tr class="separator:ga78aceb4cac4d614c0f5e82dbfeb779e5"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga5300e9be1abdea2e00c18492148aecd0" id="r_ga5300e9be1abdea2e00c18492148aecd0"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00193.html#ga5300e9be1abdea2e00c18492148aecd0">hwloc_memattr_get_name</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, const char **name)</td></tr>
<tr class="separator:ga5300e9be1abdea2e00c18492148aecd0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4c62b626085adeaffb233e5f2a03a5eb" id="r_ga4c62b626085adeaffb233e5f2a03a5eb"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00193.html#ga4c62b626085adeaffb233e5f2a03a5eb">hwloc_memattr_get_flags</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, unsigned long *flags)</td></tr>
<tr class="separator:ga4c62b626085adeaffb233e5f2a03a5eb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga770657d1e44b09e93e09f623936c1e5f" id="r_ga770657d1e44b09e93e09f623936c1e5f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00193.html#ga770657d1e44b09e93e09f623936c1e5f">hwloc_memattr_register</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const char *name, unsigned long flags, <a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> *id)</td></tr>
<tr class="separator:ga770657d1e44b09e93e09f623936c1e5f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga960529c08b25cf15825e0f72ecceb504" id="r_ga960529c08b25cf15825e0f72ecceb504"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00193.html#ga960529c08b25cf15825e0f72ecceb504">hwloc_memattr_set_value</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> attribute, <a class="el" href="a00165.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> target_node, struct <a class="el" href="a00296.html">hwloc_location</a> *initiator, unsigned long flags, hwloc_uint64_t value)</td></tr>
<tr class="separator:ga960529c08b25cf15825e0f72ecceb504"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Memory attribues are identified by an ID (<a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888" title="A memory attribute identifier.">hwloc_memattr_id_t</a>) and a name. <a class="el" href="a00193.html#ga5300e9be1abdea2e00c18492148aecd0" title="Return the name of a memory attribute.">hwloc_memattr_get_name()</a> and <a class="el" href="a00192.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>
<p>The set of valid <a class="el" href="a00192.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="a00192.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="a00193.html#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>
<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="a00193.html#ga5300e9be1abdea2e00c18492148aecd0" title="Return the name of a memory attribute.">hwloc_memattr_get_name()</a> or <a class="el" href="a00193.html#ga4c62b626085adeaffb233e5f2a03a5eb" title="Return the flags of the given attribute.">hwloc_memattr_get_flags()</a> returns an error.</p>
<p>The values for an existing attribute or for custom dynamically registered ones may be set or modified with <a class="el" href="a00193.html#ga960529c08b25cf15825e0f72ecceb504" title="Set an attribute value for a specific target NUMA node.">hwloc_memattr_set_value()</a>. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga78aceb4cac4d614c0f5e82dbfeb779e5" name="ga78aceb4cac4d614c0f5e82dbfeb779e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga78aceb4cac4d614c0f5e82dbfeb779e5">◆ </a></span>hwloc_memattr_flag_e</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="a00193.html#ga78aceb4cac4d614c0f5e82dbfeb779e5">hwloc_memattr_flag_e</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Memory attribute flags. Given to <a class="el" href="a00193.html#ga770657d1e44b09e93e09f623936c1e5f" title="Register a new memory attribute.">hwloc_memattr_register()</a> and returned by <a class="el" href="a00193.html#ga4c62b626085adeaffb233e5f2a03a5eb" title="Return the flags of the given attribute.">hwloc_memattr_get_flags()</a>. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815" name="gga78aceb4cac4d614c0f5e82dbfeb779e5af29e65444a6ed00f5cc246df06f65815"></a>HWLOC_MEMATTR_FLAG_HIGHER_FIRST </td><td class="fielddoc"><p>The best nodes for this memory attribute are those with the higher values. For instance Bandwidth. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf" name="gga78aceb4cac4d614c0f5e82dbfeb779e5a9601b5b0e1e68635e7e9901f28bd93bf"></a>HWLOC_MEMATTR_FLAG_LOWER_FIRST </td><td class="fielddoc"><p>The best nodes for this memory attribute are those with the lower values. For instance Latency. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96" name="gga78aceb4cac4d614c0f5e82dbfeb779e5a9d16523e285b2e22cfc78cc84dce8c96"></a>HWLOC_MEMATTR_FLAG_NEED_INITIATOR </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>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga4c62b626085adeaffb233e5f2a03a5eb" name="ga4c62b626085adeaffb233e5f2a03a5eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4c62b626085adeaffb233e5f2a03a5eb">◆ </a></span>hwloc_memattr_get_flags()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_memattr_get_flags </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> </td>
<td class="paramname"><em>attribute</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long * </td>
<td class="paramname"><em>flags</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the flags of the given attribute. </p>
<p>Flags are a OR'ed set of <a class="el" href="a00193.html#ga78aceb4cac4d614c0f5e82dbfeb779e5" title="Memory attribute flags. Given to hwloc_memattr_register() and returned by hwloc_memattr_get_flags().">hwloc_memattr_flag_e</a>.</p>
<p>The output pointer <code>flags</code> cannot be <code>NULL</code>.</p>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 with errno set to <code>EINVAL</code> if the attribute does not exist. </dd></dl>
</div>
</div>
<a id="ga5300e9be1abdea2e00c18492148aecd0" name="ga5300e9be1abdea2e00c18492148aecd0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5300e9be1abdea2e00c18492148aecd0">◆ </a></span>hwloc_memattr_get_name()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_memattr_get_name </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> </td>
<td class="paramname"><em>attribute</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char ** </td>
<td class="paramname"><em>name</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the name of a memory attribute. </p>
<p>The output pointer <code>name</code> cannot be <code>NULL</code>.</p>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 with errno set to <code>EINVAL</code> if the attribute does not exist. </dd></dl>
</div>
</div>
<a id="ga770657d1e44b09e93e09f623936c1e5f" name="ga770657d1e44b09e93e09f623936c1e5f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga770657d1e44b09e93e09f623936c1e5f">◆ </a></span>hwloc_memattr_register()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_memattr_register </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> * </td>
<td class="paramname"><em>id</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Register a new memory attribute. </p>
<p>Add a new custom memory attribute. Flags are a OR'ed set of <a class="el" href="a00193.html#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="a00193.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> or <a class="el" href="a00193.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> but not both.</p>
<p>The new attribute <code>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="a00192.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>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 with errno set to <code>EINVAL</code> if an invalid set of flags is given. </dd>
<dd>
-1 with errno set to <code>EBUSY</code> if another attribute already uses this name. </dd></dl>
</div>
</div>
<a id="ga960529c08b25cf15825e0f72ecceb504" name="ga960529c08b25cf15825e0f72ecceb504"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga960529c08b25cf15825e0f72ecceb504">◆ </a></span>hwloc_memattr_set_value()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_memattr_set_value </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00192.html#gacc82003a8610be554615995f0996c888">hwloc_memattr_id_t</a> </td>
<td class="paramname"><em>attribute</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00165.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> </td>
<td class="paramname"><em>target_node</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct <a class="el" href="a00296.html">hwloc_location</a> * </td>
<td class="paramname"><em>initiator</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">hwloc_uint64_t </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set an attribute value for a specific target NUMA node. </p>
<p>If the attribute does not relate to a specific initiator (it does not have the flag <a class="el" href="a00193.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>initiator</code> is ignored and may be <code>NULL</code>.</p>
<p>The initiator will be copied into the topology, the caller should free anything allocated to store the initiator, for instance the cpuset.</p>
<p><code>target_node</code> cannot be <code>NULL</code>.</p>
<p><code>attribute</code> cannot be <a class="el" href="a00192.html#ggab4bde745db676fc2ea4b47011cd9a80eaa1cfa3ff3d56ff00ecabf7da4f5642cc" title="The "Capacity" is returned in bytes (local_memory attribute in objects).">HWLOC_MEMATTR_ID_CAPACITY</a> or <a class="el" href="a00192.html#ggab4bde745db676fc2ea4b47011cd9a80ea9334e3a4c30a67f491c6523255134efe" title="The "Locality" is returned as the number of PUs in that locality (e.g. the weight of its cpuset).">HWLOC_MEMATTR_ID_LOCALITY</a>.</p>
<p><code>flags</code> must be <code>0</code> for now.</p>
<dl class="section note"><dt>Note</dt><dd>The initiator <code>initiator</code> should be of type <a class="el" href="a00192.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="a00192.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>
<dl class="section return"><dt>Returns</dt><dd>0 on success or -1 on error. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
|