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 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
<!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): Changing the Source of Topology Discovery</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">Changing the Source of Topology Discovery</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:ga949f656c779208a36790feba24048b7e" id="r_ga949f656c779208a36790feba24048b7e"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00172.html#ga949f656c779208a36790feba24048b7e">hwloc_topology_components_flag_e</a> { <a class="el" href="a00172.html#gga949f656c779208a36790feba24048b7ea33eec25d29253a2aba21dd3c731b416e">HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST</a>
}</td></tr>
<tr class="separator:ga949f656c779208a36790feba24048b7e"><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:ga341fc17b5867a4715570baab131f68cd" id="r_ga341fc17b5867a4715570baab131f68cd"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00172.html#ga341fc17b5867a4715570baab131f68cd">hwloc_topology_set_pid</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict topology, hwloc_pid_t pid)</td></tr>
<tr class="separator:ga341fc17b5867a4715570baab131f68cd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4fab186bb6181a00bcf585825fddd38d" id="r_ga4fab186bb6181a00bcf585825fddd38d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00172.html#ga4fab186bb6181a00bcf585825fddd38d">hwloc_topology_set_synthetic</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict topology, const char *restrict description)</td></tr>
<tr class="separator:ga4fab186bb6181a00bcf585825fddd38d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga879439b7ee99407ee911b3ac64e9a25e" id="r_ga879439b7ee99407ee911b3ac64e9a25e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00172.html#ga879439b7ee99407ee911b3ac64e9a25e">hwloc_topology_set_xml</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict topology, const char *restrict xmlpath)</td></tr>
<tr class="separator:ga879439b7ee99407ee911b3ac64e9a25e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga2745616b65595e1c1e579ecc7e461fa8" id="r_ga2745616b65595e1c1e579ecc7e461fa8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00172.html#ga2745616b65595e1c1e579ecc7e461fa8">hwloc_topology_set_xmlbuffer</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict topology, const char *restrict buffer, int size)</td></tr>
<tr class="separator:ga2745616b65595e1c1e579ecc7e461fa8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9ad41adf418cee1c0ee32ba9bd4a3d36" id="r_ga9ad41adf418cee1c0ee32ba9bd4a3d36"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00172.html#ga9ad41adf418cee1c0ee32ba9bd4a3d36">hwloc_topology_set_components</a> (<a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict topology, unsigned long flags, const char *restrict name)</td></tr>
<tr class="separator:ga9ad41adf418cee1c0ee32ba9bd4a3d36"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>These functions must be called between <a class="el" href="a00166.html#ga03fd4a16d8b9ee1ffc32b25fd2f6bdfa" title="Allocate a topology context.">hwloc_topology_init()</a> and <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a>. Otherwise, they will return -1 with errno set to <code>EBUSY</code>.</p>
<p>If none of the functions below is called, the default is to detect all the objects of the machine that the caller is allowed to access.</p>
<p>This default behavior may also be modified through environment variables if the application did not modify it already. Setting HWLOC_XMLFILE in the environment enforces the discovery from a XML file as if <a class="el" href="a00172.html#ga879439b7ee99407ee911b3ac64e9a25e" title="Enable XML-file based topology.">hwloc_topology_set_xml()</a> had been called. Setting HWLOC_SYNTHETIC enforces a synthetic topology as if <a class="el" href="a00172.html#ga4fab186bb6181a00bcf585825fddd38d" title="Enable synthetic topology.">hwloc_topology_set_synthetic()</a> had been called.</p>
<p>Finally, HWLOC_THISSYSTEM enforces the return value of <a class="el" href="a00173.html#ga68ffdcfd9175cdf40709801092f18017" title="Does the topology context come from this system?">hwloc_topology_is_thissystem()</a>. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga949f656c779208a36790feba24048b7e" name="ga949f656c779208a36790feba24048b7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga949f656c779208a36790feba24048b7e">◆ </a></span>hwloc_topology_components_flag_e</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="a00172.html#ga949f656c779208a36790feba24048b7e">hwloc_topology_components_flag_e</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Flags to be passed to <a class="el" href="a00172.html#ga9ad41adf418cee1c0ee32ba9bd4a3d36" title="Prevent a discovery component from being used for a topology.">hwloc_topology_set_components()</a> </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga949f656c779208a36790feba24048b7ea33eec25d29253a2aba21dd3c731b416e" name="gga949f656c779208a36790feba24048b7ea33eec25d29253a2aba21dd3c731b416e"></a>HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST </td><td class="fielddoc"><p>Blacklist the target component from being used. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga9ad41adf418cee1c0ee32ba9bd4a3d36" name="ga9ad41adf418cee1c0ee32ba9bd4a3d36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9ad41adf418cee1c0ee32ba9bd4a3d36">◆ </a></span>hwloc_topology_set_components()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_set_components </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict </td>
<td class="paramname"><em>topology</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">const char *restrict </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>Prevent a discovery component from being used for a topology. </p>
<p><code>name</code> is the name of the discovery component that should not be used when loading topology <code>topology</code>. The name is a string such as "cuda".</p>
<p>For components with multiple phases, it may also be suffixed with the name of a phase, for instance "linux:io".</p>
<p><code>flags</code> should be <a class="el" href="a00172.html#gga949f656c779208a36790feba24048b7ea33eec25d29253a2aba21dd3c731b416e" title="Blacklist the target component from being used.">HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST</a>.</p>
<p>This may be used to avoid expensive parts of the discovery process. For instance, CUDA-specific discovery may be expensive and unneeded while generic I/O discovery could still be useful.</p>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 on error, for instance if flags are invalid. </dd></dl>
</div>
</div>
<a id="ga341fc17b5867a4715570baab131f68cd" name="ga341fc17b5867a4715570baab131f68cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga341fc17b5867a4715570baab131f68cd">◆ </a></span>hwloc_topology_set_pid()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_set_pid </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">hwloc_pid_t </td>
<td class="paramname"><em>pid</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change which process the topology is viewed from. </p>
<p>On some systems, processes may have different views of the machine, for instance the set of allowed CPUs. By default, hwloc exposes the view from the current process. Calling <a class="el" href="a00172.html#ga341fc17b5867a4715570baab131f68cd" title="Change which process the topology is viewed from.">hwloc_topology_set_pid()</a> permits to make it expose the topology of the machine from the point of view of another process.</p>
<dl class="section note"><dt>Note</dt><dd><code>hwloc_pid_t</code> is <code>pid_t</code> on Unix platforms, and <code>HANDLE</code> on native Windows platforms.</dd>
<dd>
-1 is returned and errno is set to <code>ENOSYS</code> on platforms that do not support this feature.</dd>
<dd>
The PID will not actually be used until <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a>. If the corresponding process exits in the meantime, hwloc will ignore the PID. If another process reuses the PID, the view of that process will be used.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error. </dd></dl>
</div>
</div>
<a id="ga4fab186bb6181a00bcf585825fddd38d" name="ga4fab186bb6181a00bcf585825fddd38d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4fab186bb6181a00bcf585825fddd38d">◆ </a></span>hwloc_topology_set_synthetic()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_set_synthetic </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *restrict </td>
<td class="paramname"><em>description</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable synthetic topology. </p>
<p>Gather topology information from the given <code>description</code>, a space-separated string of <type:number> describing the object type and arity at each level. All types may be omitted (space-separated string of numbers) so that hwloc chooses all types according to usual topologies. See also the <a class="el" href="a00377.html">Synthetic topologies</a>.</p>
<p>Setting the environment variable HWLOC_SYNTHETIC may also result in this behavior.</p>
<p>If <code>description</code> was properly parsed and describes a valid topology configuration, this function returns 0. Otherwise -1 is returned and errno is set to <code>EINVAL</code>.</p>
<p>Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a> to actually load the topology information.</p>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 with errno set to <code>EINVAL</code> if the description was invalid.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>For convenience, this backend provides empty binding hooks which just return success.</dd>
<dd>
On success, the synthetic component replaces the previously enabled component (if any), but the topology is not actually modified until <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a>. </dd></dl>
</div>
</div>
<a id="ga879439b7ee99407ee911b3ac64e9a25e" name="ga879439b7ee99407ee911b3ac64e9a25e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga879439b7ee99407ee911b3ac64e9a25e">◆ </a></span>hwloc_topology_set_xml()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_set_xml </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *restrict </td>
<td class="paramname"><em>xmlpath</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable XML-file based topology. </p>
<p>Gather topology information from the XML file given at <code>xmlpath</code>. Setting the environment variable HWLOC_XMLFILE may also result in this behavior. This file may have been generated earlier with <a class="el" href="a00186.html#ga333f79975b4eeb28a3d8fad3373583ce" title="Export the topology into an XML file.">hwloc_topology_export_xml()</a> in <a class="el" href="a00104_source.html">hwloc/export.h</a>, or lstopo file.xml.</p>
<p>Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a> to actually load the topology information.</p>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 with errno set to <code>EINVAL</code> on failure to read the XML file.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>See also <a class="el" href="a00186.html#ga5ac6917ea7289955fb1ffda4353af9b0" title="Set the application-specific callback for importing userdata.">hwloc_topology_set_userdata_import_callback()</a> for importing application-specific object userdata.</dd>
<dd>
For convenience, this backend provides empty binding hooks which just return success. To have hwloc still actually call OS-specific hooks, the <a class="el" href="a00173.html#ggada025d3ec20b4b420f8038d23d6e7bdea6ecb6abc6a0bb75e81564f8bca85783b" title="Assume that the selected backend provides the topology for the system on which we are running.">HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM</a> has to be set to assert that the loaded file is really the underlying system.</dd>
<dd>
On success, the XML component replaces the previously enabled component (if any), but the topology is not actually modified until <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a>.</dd>
<dd>
If an invalid XML input file is given, the error may be reported either here or later by <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a> depending on the XML library used by hwloc. </dd></dl>
</div>
</div>
<a id="ga2745616b65595e1c1e579ecc7e461fa8" name="ga2745616b65595e1c1e579ecc7e461fa8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2745616b65595e1c1e579ecc7e461fa8">◆ </a></span>hwloc_topology_set_xmlbuffer()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_set_xmlbuffer </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> restrict </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *restrict </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable XML based topology using a memory buffer (instead of a file, as with <a class="el" href="a00172.html#ga879439b7ee99407ee911b3ac64e9a25e" title="Enable XML-file based topology.">hwloc_topology_set_xml()</a>). </p>
<p>Gather topology information from the XML memory buffer given at <code>buffer</code> and of length <code>size</code> (including an ending <code>\0</code>). This buffer may have been filled earlier with <a class="el" href="a00186.html#gad33b7f7c11db10459505a3b1634fd3f1" title="Export the topology into a newly-allocated XML memory buffer.">hwloc_topology_export_xmlbuffer()</a> in <a class="el" href="a00104_source.html">hwloc/export.h</a>.</p>
<p>Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a> to actually load the topology information.</p>
<dl class="section return"><dt>Returns</dt><dd>0 on success. </dd>
<dd>
-1 with errno set to <code>EINVAL</code> on failure to read the XML buffer.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>See also <a class="el" href="a00186.html#ga5ac6917ea7289955fb1ffda4353af9b0" title="Set the application-specific callback for importing userdata.">hwloc_topology_set_userdata_import_callback()</a> for importing application-specific object userdata.</dd>
<dd>
For convenience, this backend provides empty binding hooks which just return success. To have hwloc still actually call OS-specific hooks, the <a class="el" href="a00173.html#ggada025d3ec20b4b420f8038d23d6e7bdea6ecb6abc6a0bb75e81564f8bca85783b" title="Assume that the selected backend provides the topology for the system on which we are running.">HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM</a> has to be set to assert that the loaded file is really the underlying system.</dd>
<dd>
On success, the XML component replaces the previously enabled component (if any), but the topology is not actually modified until <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a>.</dd>
<dd>
If an invalid XML input file is given, the error may be reported either here or later by <a class="el" href="a00166.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology.">hwloc_topology_load()</a> depending on the XML library used by hwloc. </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>
|