| 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): Linux-specific helpers</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"> 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="#func-members">Functions</a> </div> |
| 47 |
<div class="headertitle"><div class="title">Linux-specific helpers </div></div> |
| 48 |
</div><!--header--> |
| 49 |
<div class="contents"> |
| 50 |
<table class="memberdecls"> |
| 51 |
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a> |
| 52 |
Functions</h2></td></tr> |
| 53 |
<tr class="memitem:ga630e699c56b5f3d2e534b475944c216e" id="r_ga630e699c56b5f3d2e534b475944c216e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#ga630e699c56b5f3d2e534b475944c216e">hwloc_linux_set_tid_cpubind</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, pid_t tid, <a class="el" href="a00166.html#ga1f784433e9b606261f62d1134f6a3b25">hwloc_const_cpuset_t</a> set)</td></tr> |
| 54 |
<tr class="memitem:gaddcb985cb56337a4d6693cee72e7bf94" id="r_gaddcb985cb56337a4d6693cee72e7bf94"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#gaddcb985cb56337a4d6693cee72e7bf94">hwloc_linux_get_tid_cpubind</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, pid_t tid, <a class="el" href="a00166.html#ga4bbf39b68b6f568fb92739e7c0ea7801">hwloc_cpuset_t</a> set)</td></tr> |
| 55 |
<tr class="memitem:gacc7945c2d06c6db1e58f8fd953009134" id="r_gacc7945c2d06c6db1e58f8fd953009134"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#gacc7945c2d06c6db1e58f8fd953009134">hwloc_linux_get_tid_last_cpu_location</a> (<a class="el" href="a00169.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, pid_t tid, <a class="el" href="a00188.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> set)</td></tr> |
| 56 |
<tr class="memitem:gaf72d83e273803226ce772973e37b85de" id="r_gaf72d83e273803226ce772973e37b85de"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#gaf72d83e273803226ce772973e37b85de">hwloc_linux_read_path_as_cpumask</a> (const char *path, <a class="el" href="a00188.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> set)</td></tr> |
| 57 |
</table> |
| 58 |
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2> |
| 59 |
<p>This includes helpers for manipulating Linux kernel cpumap files, and hwloc equivalents of the Linux sched_setaffinity and sched_getaffinity system calls. </p> |
| 60 |
<a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2> |
| 61 |
<a id="gaddcb985cb56337a4d6693cee72e7bf94" name="gaddcb985cb56337a4d6693cee72e7bf94"></a> |
| 62 |
<h2 class="memtitle"><span class="permalink"><a href="#gaddcb985cb56337a4d6693cee72e7bf94">◆ </a></span>hwloc_linux_get_tid_cpubind()</h2> |
| 63 |
|
| 64 |
<div class="memitem"> |
| 65 |
<div class="memproto"> |
| 66 |
<table class="memname"> |
| 67 |
<tr> |
| 68 |
<td class="memname">int hwloc_linux_get_tid_cpubind </td> |
| 69 |
<td>(</td> |
| 70 |
<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> |
| 71 |
</tr> |
| 72 |
<tr> |
| 73 |
<td class="paramkey"></td> |
| 74 |
<td></td> |
| 75 |
<td class="paramtype">pid_t</td> <td class="paramname"><span class="paramname"><em>tid</em></span>, </td> |
| 76 |
</tr> |
| 77 |
<tr> |
| 78 |
<td class="paramkey"></td> |
| 79 |
<td></td> |
| 80 |
<td class="paramtype"><a class="el" href="a00166.html#ga4bbf39b68b6f568fb92739e7c0ea7801">hwloc_cpuset_t</a></td> <td class="paramname"><span class="paramname"><em>set</em></span> )</td> |
| 81 |
</tr> |
| 82 |
</table> |
| 83 |
</div><div class="memdoc"> |
| 84 |
|
| 85 |
<p>Get the current binding of thread <code class="param">tid</code>. </p> |
| 86 |
<p>The CPU-set <code class="param">set</code> (previously allocated by the caller) is filled with the list of PUs which the thread was last bound to.</p> |
| 87 |
<p>The behavior is exactly the same as the Linux sched_getaffinity system call, but uses a hwloc cpuset.</p> |
| 88 |
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error.</dd></dl> |
| 89 |
<dl class="section note"><dt>Note</dt><dd>This is equivalent to calling <a class="el" href="a00173.html#gac82de91f788fa82dacf99c6e0d4b7158" title="Get the current physical binding of process pid.">hwloc_get_proc_cpubind()</a> with <a class="el" href="a00173.html#gga217dc8d373f8958cc93c154ebce1c71caf1b6bbad00d7b1017b918e3719f4d421" title="Bind current thread of current process.">HWLOC_CPUBIND_THREAD</a> as flags. </dd></dl> |
| 90 |
|
| 91 |
</div> |
| 92 |
</div> |
| 93 |
<a id="gacc7945c2d06c6db1e58f8fd953009134" name="gacc7945c2d06c6db1e58f8fd953009134"></a> |
| 94 |
<h2 class="memtitle"><span class="permalink"><a href="#gacc7945c2d06c6db1e58f8fd953009134">◆ </a></span>hwloc_linux_get_tid_last_cpu_location()</h2> |
| 95 |
|
| 96 |
<div class="memitem"> |
| 97 |
<div class="memproto"> |
| 98 |
<table class="memname"> |
| 99 |
<tr> |
| 100 |
<td class="memname">int hwloc_linux_get_tid_last_cpu_location </td> |
| 101 |
<td>(</td> |
| 102 |
<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> |
| 103 |
</tr> |
| 104 |
<tr> |
| 105 |
<td class="paramkey"></td> |
| 106 |
<td></td> |
| 107 |
<td class="paramtype">pid_t</td> <td class="paramname"><span class="paramname"><em>tid</em></span>, </td> |
| 108 |
</tr> |
| 109 |
<tr> |
| 110 |
<td class="paramkey"></td> |
| 111 |
<td></td> |
| 112 |
<td class="paramtype"><a class="el" href="a00188.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a></td> <td class="paramname"><span class="paramname"><em>set</em></span> )</td> |
| 113 |
</tr> |
| 114 |
</table> |
| 115 |
</div><div class="memdoc"> |
| 116 |
|
| 117 |
<p>Get the last physical CPU where thread <code class="param">tid</code> ran. </p> |
| 118 |
<p>The CPU-set <code class="param">set</code> (previously allocated by the caller) is filled with the PU which the thread last ran on.</p> |
| 119 |
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error.</dd></dl> |
| 120 |
<dl class="section note"><dt>Note</dt><dd>This is equivalent to calling <a class="el" href="a00173.html#ga910a05c2d47f68a3155bf176b50fa555" title="Get the last physical CPU where a process ran.">hwloc_get_proc_last_cpu_location()</a> with <a class="el" href="a00173.html#gga217dc8d373f8958cc93c154ebce1c71caf1b6bbad00d7b1017b918e3719f4d421" title="Bind current thread of current process.">HWLOC_CPUBIND_THREAD</a> as flags. </dd></dl> |
| 121 |
|
| 122 |
</div> |
| 123 |
</div> |
| 124 |
<a id="gaf72d83e273803226ce772973e37b85de" name="gaf72d83e273803226ce772973e37b85de"></a> |
| 125 |
<h2 class="memtitle"><span class="permalink"><a href="#gaf72d83e273803226ce772973e37b85de">◆ </a></span>hwloc_linux_read_path_as_cpumask()</h2> |
| 126 |
|
| 127 |
<div class="memitem"> |
| 128 |
<div class="memproto"> |
| 129 |
<table class="memname"> |
| 130 |
<tr> |
| 131 |
<td class="memname">int hwloc_linux_read_path_as_cpumask </td> |
| 132 |
<td>(</td> |
| 133 |
<td class="paramtype">const char *</td> <td class="paramname"><span class="paramname"><em>path</em></span>, </td> |
| 134 |
</tr> |
| 135 |
<tr> |
| 136 |
<td class="paramkey"></td> |
| 137 |
<td></td> |
| 138 |
<td class="paramtype"><a class="el" href="a00188.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a></td> <td class="paramname"><span class="paramname"><em>set</em></span> )</td> |
| 139 |
</tr> |
| 140 |
</table> |
| 141 |
</div><div class="memdoc"> |
| 142 |
|
| 143 |
<p>Convert a linux kernel cpumask file <code class="param">path</code> into a hwloc bitmap <code class="param">set</code>. </p> |
| 144 |
<p>Might be used when reading CPU set from sysfs attributes such as topology and caches for processors, or local_cpus for devices.</p> |
| 145 |
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error.</dd></dl> |
| 146 |
<dl class="section note"><dt>Note</dt><dd>This function ignores the HWLOC_FSROOT environment variable. </dd></dl> |
| 147 |
|
| 148 |
</div> |
| 149 |
</div> |
| 150 |
<a id="ga630e699c56b5f3d2e534b475944c216e" name="ga630e699c56b5f3d2e534b475944c216e"></a> |
| 151 |
<h2 class="memtitle"><span class="permalink"><a href="#ga630e699c56b5f3d2e534b475944c216e">◆ </a></span>hwloc_linux_set_tid_cpubind()</h2> |
| 152 |
|
| 153 |
<div class="memitem"> |
| 154 |
<div class="memproto"> |
| 155 |
<table class="memname"> |
| 156 |
<tr> |
| 157 |
<td class="memname">int hwloc_linux_set_tid_cpubind </td> |
| 158 |
<td>(</td> |
| 159 |
<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> |
| 160 |
</tr> |
| 161 |
<tr> |
| 162 |
<td class="paramkey"></td> |
| 163 |
<td></td> |
| 164 |
<td class="paramtype">pid_t</td> <td class="paramname"><span class="paramname"><em>tid</em></span>, </td> |
| 165 |
</tr> |
| 166 |
<tr> |
| 167 |
<td class="paramkey"></td> |
| 168 |
<td></td> |
| 169 |
<td class="paramtype"><a class="el" href="a00166.html#ga1f784433e9b606261f62d1134f6a3b25">hwloc_const_cpuset_t</a></td> <td class="paramname"><span class="paramname"><em>set</em></span> )</td> |
| 170 |
</tr> |
| 171 |
</table> |
| 172 |
</div><div class="memdoc"> |
| 173 |
|
| 174 |
<p>Bind a thread <code class="param">tid</code> on cpus given in cpuset <code class="param">set</code>. </p> |
| 175 |
<p>The behavior is exactly the same as the Linux sched_setaffinity system call, but uses a hwloc cpuset.</p> |
| 176 |
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error.</dd></dl> |
| 177 |
<dl class="section note"><dt>Note</dt><dd>This is equivalent to calling <a class="el" href="a00173.html#ga296db8a3c6d49b51fb83d6f3e45c02a6" title="Bind a process pid on CPUs given in physical bitmap set.">hwloc_set_proc_cpubind()</a> with HWLOC_CPUBIND_THREAD as flags. </dd></dl> |
| 178 |
|
| 179 |
</div> |
| 180 |
</div> |
| 181 |
</div><!-- contents --> |
| 182 |
<!-- start footer part --> |
| 183 |
<hr class="footer"/><address class="footer"><small> |
| 184 |
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.15.0 |
| 185 |
</small></address> |
| 186 |
</div><!-- doc-content --> |
| 187 |
</body> |
| 188 |
</html> |