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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
|
<!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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Locality (hwloc): Memory binding</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 style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Hardware Locality (hwloc)
 <span id="projectnumber">2.4.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<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:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(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">Memory binding</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gac9764f79505775d06407b40f5e4661e8"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> { <br />
  <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a18675bb80ebc1bce5b652e9de8f3998c">HWLOC_MEMBIND_DEFAULT</a>
, <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0">HWLOC_MEMBIND_FIRSTTOUCH</a>
, <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8ad811fa4b2a6002c4d63695a408ffde2c">HWLOC_MEMBIND_BIND</a>
, <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8ae370075e5af016d42310f87ea5af236b">HWLOC_MEMBIND_INTERLEAVE</a>
, <br />
  <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8aecdd4164d647708fbb51a00d98dbb138">HWLOC_MEMBIND_NEXTTOUCH</a>
, <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a3185bd869b67817fb2bd5164bf360402">HWLOC_MEMBIND_MIXED</a>
<br />
}</td></tr>
<tr class="separator:gac9764f79505775d06407b40f5e4661e8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab00475fd98815bf4fb9aaf752030e7d2"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gab00475fd98815bf4fb9aaf752030e7d2">hwloc_membind_flags_t</a> { <br />
  <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4">HWLOC_MEMBIND_PROCESS</a>
, <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298">HWLOC_MEMBIND_THREAD</a>
, <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a>
, <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2aa6e49e54f52827cb143cc869cfd748af">HWLOC_MEMBIND_MIGRATE</a>
, <br />
  <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2aad6b9eaf2ee324ca58dc8f58094b9997">HWLOC_MEMBIND_NOCPUBIND</a>
, <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256">HWLOC_MEMBIND_BYNODESET</a>
<br />
}</td></tr>
<tr class="separator:gab00475fd98815bf4fb9aaf752030e7d2"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga020951efa0ce3862bd4faec295501a7f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#ga020951efa0ce3862bd4faec295501a7f">hwloc_set_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> policy, int flags)</td></tr>
<tr class="separator:ga020951efa0ce3862bd4faec295501a7f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gae21f0a1a884929c784bebf070252aa56"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gae21f0a1a884929c784bebf070252aa56">hwloc_get_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> *policy, int flags)</td></tr>
<tr class="separator:gae21f0a1a884929c784bebf070252aa56"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gabc91ff16f7e41047924e3a4ae6d9da7e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gabc91ff16f7e41047924e3a4ae6d9da7e">hwloc_set_proc_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, hwloc_pid_t pid, <a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> policy, int flags)</td></tr>
<tr class="separator:gabc91ff16f7e41047924e3a4ae6d9da7e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1730ceb18ec6ee3b7bd3d0db81f07dc8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#ga1730ceb18ec6ee3b7bd3d0db81f07dc8">hwloc_get_proc_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, hwloc_pid_t pid, <a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> *policy, int flags)</td></tr>
<tr class="separator:ga1730ceb18ec6ee3b7bd3d0db81f07dc8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf881faefe20701229f07dd7dbd0125ed"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gaf881faefe20701229f07dd7dbd0125ed">hwloc_set_area_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const void *addr, size_t len, <a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> policy, int flags)</td></tr>
<tr class="separator:gaf881faefe20701229f07dd7dbd0125ed"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa87e0a6946ff145914fdf0b1c60567f8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gaa87e0a6946ff145914fdf0b1c60567f8">hwloc_get_area_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const void *addr, size_t len, <a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> *policy, int flags)</td></tr>
<tr class="separator:gaa87e0a6946ff145914fdf0b1c60567f8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga537c7508a4e2d1db05673ec5be6e805c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#ga537c7508a4e2d1db05673ec5be6e805c">hwloc_get_area_memlocation</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const void *addr, size_t len, <a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> set, int flags)</td></tr>
<tr class="separator:ga537c7508a4e2d1db05673ec5be6e805c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga972b335a86a7d5e7b34bce2b243c41bc"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#ga972b335a86a7d5e7b34bce2b243c41bc">hwloc_alloc</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, size_t len)</td></tr>
<tr class="separator:ga972b335a86a7d5e7b34bce2b243c41bc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga04736461780fadcf193af218c0122273"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#ga04736461780fadcf193af218c0122273">hwloc_alloc_membind</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, size_t len, <a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> policy, int flags)</td></tr>
<tr class="separator:ga04736461780fadcf193af218c0122273"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab1b77b8408bacaf03c7e8878f7577922"><td class="memItemLeft" align="right" valign="top">static void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#gab1b77b8408bacaf03c7e8878f7577922">hwloc_alloc_membind_policy</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, size_t len, <a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> set, <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> policy, int flags)</td></tr>
<tr class="separator:gab1b77b8408bacaf03c7e8878f7577922"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga32dbd4f54e9e4a7179f2dde37ffe6ad7"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00197.html#ga32dbd4f54e9e4a7179f2dde37ffe6ad7">hwloc_free</a> (<a class="el" href="a00192.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, void *addr, size_t len)</td></tr>
<tr class="separator:ga32dbd4f54e9e4a7179f2dde37ffe6ad7"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Memory binding can be done three ways:</p>
<ul>
<li>explicit memory allocation thanks to <a class="el" href="a00197.html#ga04736461780fadcf193af218c0122273" title="Allocate some memory on NUMA memory nodes specified by set.">hwloc_alloc_membind()</a> and friends: the binding will have effect on the memory allocated by these functions.</li>
<li>implicit memory binding through binding policy: <a class="el" href="a00197.html#ga020951efa0ce3862bd4faec295501a7f" title="Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) spe...">hwloc_set_membind()</a> and friends only define the current policy of the process, which will be applied to the subsequent calls to malloc() and friends.</li>
<li>migration of existing memory ranges, thanks to <a class="el" href="a00197.html#gaf881faefe20701229f07dd7dbd0125ed" title="Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) specified by set.">hwloc_set_area_membind()</a> and friends, which move already-allocated data.</li>
</ul>
<p>Not all operating systems support all three ways. <a class="el" href="a00199.html#gab8c76173c4a8ce1a9a9366012b1388e6" title="Retrieve the topology support.">hwloc_topology_get_support()</a> may be used to query about the actual memory binding support in the currently used operating system.</p>
<p>When the requested binding operation is not available and the <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> flag was passed, the function returns -1. <code>errno</code> will be set to <code>ENOSYS</code> when the system does support the specified action or policy (e.g., some systems only allow binding memory on a per-thread basis, whereas other systems only allow binding memory for all threads in a process). <code>errno</code> will be set to EXDEV when the requested set can not be enforced (e.g., some systems only allow binding memory to a single NUMA node).</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> was not passed, the function may fail as well, or the operating system may use a slightly different operation (with side-effects, smaller binding set, etc.) when the requested operation is not exactly supported.</p>
<p>The most portable form that should be preferred over the others whenever possible is as follows. It allocates some memory hopefully bound to the specified set. To do so, hwloc will possibly have to change the current memory binding policy in order to actually get the memory bound, if the OS does not provide any other way to simply allocate bound memory without changing the policy for all allocations. That is the difference with <a class="el" href="a00197.html#ga04736461780fadcf193af218c0122273" title="Allocate some memory on NUMA memory nodes specified by set.">hwloc_alloc_membind()</a>, which will never change the current memory binding policy.</p>
<div class="fragment"><div class="line"><a class="code" href="a00197.html#gab1b77b8408bacaf03c7e8878f7577922">hwloc_alloc_membind_policy</a>(topology, size, set,</div>
<div class="line"> <a class="code" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8ad811fa4b2a6002c4d63695a408ffde2c">HWLOC_MEMBIND_BIND</a>, 0);</div>
<div class="ttc" id="aa00197_html_gab1b77b8408bacaf03c7e8878f7577922"><div class="ttname"><a href="a00197.html#gab1b77b8408bacaf03c7e8878f7577922">hwloc_alloc_membind_policy</a></div><div class="ttdeci">static void * hwloc_alloc_membind_policy(hwloc_topology_t topology, size_t len, hwloc_const_bitmap_t set, hwloc_membind_policy_t policy, int flags)</div><div class="ttdoc">Allocate some memory on NUMA memory nodes specified by set.</div></div>
<div class="ttc" id="aa00197_html_ggac9764f79505775d06407b40f5e4661e8ad811fa4b2a6002c4d63695a408ffde2c"><div class="ttname"><a href="a00197.html#ggac9764f79505775d06407b40f5e4661e8ad811fa4b2a6002c4d63695a408ffde2c">HWLOC_MEMBIND_BIND</a></div><div class="ttdeci">@ HWLOC_MEMBIND_BIND</div><div class="ttdoc">Allocate memory on the specified nodes.</div><div class="ttdef"><b>Definition:</b> hwloc.h:1403</div></div>
</div><!-- fragment --><p>Each hwloc memory binding function takes a bitmap argument that is a CPU set by default, or a NUMA memory node set if the flag <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified. See <a class="el" href="a00189.html">Object Sets (hwloc_cpuset_t and hwloc_nodeset_t)</a> and <a class="el" href="a00211.html">The bitmap API</a> for a discussion of CPU sets and NUMA memory node sets. It is also possible to convert between CPU set and node set using <a class="el" href="a00209.html#ga185751c1653fedbeb7cc480840f38cde" title="Convert a CPU set into a NUMA node set.">hwloc_cpuset_to_nodeset()</a> or <a class="el" href="a00209.html#gad5ee8691e08a3538ea7633344c00456d" title="Convert a NUMA node set into a CPU set.">hwloc_cpuset_from_nodeset()</a>.</p>
<p>Memory binding by CPU set cannot work for CPU-less NUMA memory nodes. Binding by nodeset should therefore be preferred whenever possible.</p>
<dl class="section see"><dt>See also</dt><dd>Some example codes are available under doc/examples/ in the source tree.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>On some operating systems, memory binding affects the CPU binding; see <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2aad6b9eaf2ee324ca58dc8f58094b9997" title="Avoid any effect on CPU binding.">HWLOC_MEMBIND_NOCPUBIND</a> </dd></dl>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gab00475fd98815bf4fb9aaf752030e7d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab00475fd98815bf4fb9aaf752030e7d2">◆ </a></span>hwloc_membind_flags_t</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="a00197.html#gab00475fd98815bf4fb9aaf752030e7d2">hwloc_membind_flags_t</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Memory binding flags. </p>
<p>These flags can be used to refine the binding policy. All flags can be logically OR'ed together with the exception of <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> and <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a>; these two flags are mutually exclusive.</p>
<p>Not all systems support all kinds of binding. <a class="el" href="a00199.html#gab8c76173c4a8ce1a9a9366012b1388e6" title="Retrieve the topology support.">hwloc_topology_get_support()</a> may be used to query about the actual memory binding support in the currently used operating system. See the "Detailed Description" section of <a class="el" href="a00197.html">Memory binding</a> for a description of errors that can occur. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4"></a>HWLOC_MEMBIND_PROCESS </td><td class="fielddoc"><p>Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually exclusive with <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298"></a>HWLOC_MEMBIND_THREAD </td><td class="fielddoc"><p>Set policy for a specific thread of the current process. This flag is mutually exclusive with <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6"></a>HWLOC_MEMBIND_STRICT </td><td class="fielddoc"><p>Request strict binding from the OS. The function will fail if the binding can not be guaranteed / completely enforced.</p>
<p>This flag has slightly different meanings depending on which function it is used with. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab00475fd98815bf4fb9aaf752030e7d2aa6e49e54f52827cb143cc869cfd748af"></a>HWLOC_MEMBIND_MIGRATE </td><td class="fielddoc"><p>Migrate existing allocated memory. If the memory cannot be migrated and the <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> flag is passed, an error will be returned. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab00475fd98815bf4fb9aaf752030e7d2aad6b9eaf2ee324ca58dc8f58094b9997"></a>HWLOC_MEMBIND_NOCPUBIND </td><td class="fielddoc"><p>Avoid any effect on CPU binding. </p>
<p>On some operating systems, some underlying memory binding functions also bind the application to the corresponding CPU(s). Using this flag will cause hwloc to avoid using OS functions that could potentially affect CPU bindings. Note, however, that using NOCPUBIND may reduce hwloc's overall memory binding support. Specifically: some of hwloc's memory binding functions may fail with errno set to ENOSYS when used with NOCPUBIND. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256"></a>HWLOC_MEMBIND_BYNODESET </td><td class="fielddoc"><p>Consider the bitmap argument as a nodeset. </p>
<p>The bitmap argument is considered a nodeset if this flag is given, or a cpuset otherwise by default.</p>
<p>Memory binding by CPU set cannot work for CPU-less NUMA memory nodes. Binding by nodeset should therefore be preferred whenever possible. </p>
</td></tr>
</table>
</div>
</div>
<a id="gac9764f79505775d06407b40f5e4661e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac9764f79505775d06407b40f5e4661e8">◆ </a></span>hwloc_membind_policy_t</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Memory binding policy. </p>
<p>These constants can be used to choose the binding policy. Only one policy can be used at a time (i.e., the values cannot be OR'ed together).</p>
<p>Not all systems support all kinds of binding. <a class="el" href="a00199.html#gab8c76173c4a8ce1a9a9366012b1388e6" title="Retrieve the topology support.">hwloc_topology_get_support()</a> may be used to query about the actual memory binding policy support in the currently used operating system. See the "Detailed Description" section of <a class="el" href="a00197.html">Memory binding</a> for a description of errors that can occur. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggac9764f79505775d06407b40f5e4661e8a18675bb80ebc1bce5b652e9de8f3998c"></a>HWLOC_MEMBIND_DEFAULT </td><td class="fielddoc"><p>Reset the memory allocation policy to the system default. Depending on the operating system, this may correspond to <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0" title="Allocate each memory page individually on the local NUMA node of the thread that touches it.">HWLOC_MEMBIND_FIRSTTOUCH</a> (Linux, FreeBSD), or <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8ad811fa4b2a6002c4d63695a408ffde2c" title="Allocate memory on the specified nodes.">HWLOC_MEMBIND_BIND</a> (AIX, HP-UX, Solaris, Windows). This policy is never returned by get membind functions. The nodeset argument is ignored. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0"></a>HWLOC_MEMBIND_FIRSTTOUCH </td><td class="fielddoc"><p>Allocate each memory page individually on the local NUMA node of the thread that touches it. </p>
<p>The given nodeset should usually be <a class="el" href="a00208.html#ga3fd37303e99ace8b0d0ea03f95f8c514" title="Get topology node set.">hwloc_topology_get_topology_nodeset()</a> so that the touching thread may run and allocate on any node in the system.</p>
<p>On AIX, if the nodeset is smaller, pages are allocated locally (if the local node is in the nodeset) or from a random non-local node (otherwise). </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac9764f79505775d06407b40f5e4661e8ad811fa4b2a6002c4d63695a408ffde2c"></a>HWLOC_MEMBIND_BIND </td><td class="fielddoc"><p>Allocate memory on the specified nodes. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac9764f79505775d06407b40f5e4661e8ae370075e5af016d42310f87ea5af236b"></a>HWLOC_MEMBIND_INTERLEAVE </td><td class="fielddoc"><p>Allocate memory on the given nodes in an interleaved / round-robin manner. The precise layout of the memory across multiple NUMA nodes is OS/system specific. Interleaving can be useful when threads distributed across the specified NUMA nodes will all be accessing the whole memory range concurrently, since the interleave will then balance the memory references. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac9764f79505775d06407b40f5e4661e8aecdd4164d647708fbb51a00d98dbb138"></a>HWLOC_MEMBIND_NEXTTOUCH </td><td class="fielddoc"><p>For each page bound with this policy, by next time it is touched (and next time only), it is moved from its current location to the local NUMA node of the thread where the memory reference occurred (if it needs to be moved at all). </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac9764f79505775d06407b40f5e4661e8a3185bd869b67817fb2bd5164bf360402"></a>HWLOC_MEMBIND_MIXED </td><td class="fielddoc"><p>Returned by get_membind() functions when multiple threads or parts of a memory area have differing memory binding policies. Also returned when binding is unknown because binding hooks are empty when the topology is loaded from XML without HWLOC_THISSYSTEM=1, etc. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga972b335a86a7d5e7b34bce2b243c41bc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga972b335a86a7d5e7b34bce2b243c41bc">◆ </a></span>hwloc_alloc()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* hwloc_alloc </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate some memory. </p>
<p>This is equivalent to malloc(), except that it tries to allocate page-aligned memory from the OS.</p>
<dl class="section note"><dt>Note</dt><dd>The allocated memory should be freed with <a class="el" href="a00197.html#ga32dbd4f54e9e4a7179f2dde37ffe6ad7" title="Free memory that was previously allocated by hwloc_alloc() or hwloc_alloc_membind().">hwloc_free()</a>. </dd></dl>
</div>
</div>
<a id="ga04736461780fadcf193af218c0122273"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga04736461780fadcf193af218c0122273">◆ </a></span>hwloc_alloc_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* hwloc_alloc_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Allocate some memory on NUMA memory nodes specified by <code>set</code>. </p>
<dl class="section return"><dt>Returns</dt><dd>NULL with errno set to ENOSYS if the action is not supported and <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is given </dd>
<dd>
NULL with errno set to EXDEV if the binding cannot be enforced and <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is given </dd>
<dd>
NULL with errno set to ENOMEM if the memory allocation failed even before trying to bind.</dd></dl>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<dl class="section note"><dt>Note</dt><dd>The allocated memory should be freed with <a class="el" href="a00197.html#ga32dbd4f54e9e4a7179f2dde37ffe6ad7" title="Free memory that was previously allocated by hwloc_alloc() or hwloc_alloc_membind().">hwloc_free()</a>. </dd></dl>
</div>
</div>
<a id="gab1b77b8408bacaf03c7e8878f7577922"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab1b77b8408bacaf03c7e8878f7577922">◆ </a></span>hwloc_alloc_membind_policy()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void* hwloc_alloc_membind_policy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate some memory on NUMA memory nodes specified by <code>set</code>. </p>
<p>This is similar to hwloc_alloc_membind_nodeset() except that it is allowed to change the current memory binding policy, thus providing more binding support, at the expense of changing the current state.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset. </p>
</div>
</div>
<a id="ga32dbd4f54e9e4a7179f2dde37ffe6ad7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga32dbd4f54e9e4a7179f2dde37ffe6ad7">◆ </a></span>hwloc_free()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_free </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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">void * </td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Free memory that was previously allocated by <a class="el" href="a00197.html#ga972b335a86a7d5e7b34bce2b243c41bc" title="Allocate some memory.">hwloc_alloc()</a> or <a class="el" href="a00197.html#ga04736461780fadcf193af218c0122273" title="Allocate some memory on NUMA memory nodes specified by set.">hwloc_alloc_membind()</a>. </p>
</div>
</div>
<a id="gaa87e0a6946ff145914fdf0b1c60567f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa87e0a6946ff145914fdf0b1c60567f8">◆ </a></span>hwloc_get_area_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_get_area_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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 void * </td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> * </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Query the CPUs near the physical NUMA node(s) and binding policy of the memory identified by (<code>addr</code>, <code>len</code> ). </p>
<p>This function has two output parameters: <code>set</code> and <code>policy</code>. The values returned in these parameters depend on both the <code>flags</code> passed in and the memory binding policies and nodesets of the pages in the address range.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is specified, the target pages are first checked to see if they all have the same memory binding policy and nodeset. If they do not, -1 is returned and errno is set to EXDEV. If they are identical across all pages, the set and policy are returned in <code>set</code> and <code>policy</code>, respectively.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is not specified, the union of all NUMA node(s) containing pages in the address range is calculated. If all pages in the target have the same policy, it is returned in <code>policy</code>. Otherwise, <code>policy</code> is set to <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a3185bd869b67817fb2bd5164bf360402" title="Returned by get_membind() functions when multiple threads or parts of a memory area have differing me...">HWLOC_MEMBIND_MIXED</a>.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<p>If any other flags are specified, -1 is returned and errno is set to EINVAL.</p>
<p>If <code>len</code> is 0, -1 is returned and errno is set to EINVAL. </p>
</div>
</div>
<a id="ga537c7508a4e2d1db05673ec5be6e805c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga537c7508a4e2d1db05673ec5be6e805c">◆ </a></span>hwloc_get_area_memlocation()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_get_area_memlocation </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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 void * </td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Get the NUMA nodes where memory identified by (<code>addr</code>, <code>len</code> ) is physically allocated. </p>
<p>Fills <code>set</code> according to the NUMA nodes where the memory area pages are physically allocated. If no page is actually allocated yet, <code>set</code> may be empty.</p>
<p>If pages spread to multiple nodes, it is not specified whether they spread equitably, or whether most of them are on a single node, etc.</p>
<p>The operating system may move memory pages from one processor to another at any time according to their binding, so this function may return something that is already outdated.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified in <code>flags</code>, set is considered a nodeset. Otherwise it's a cpuset.</p>
<p>If <code>len</code> is 0, <code>set</code> is emptied. </p>
</div>
</div>
<a id="gae21f0a1a884929c784bebf070252aa56"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae21f0a1a884929c784bebf070252aa56">◆ </a></span>hwloc_get_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_get_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> * </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Query the default memory binding policy and physical locality of the current process or thread. </p>
<p>This function has two output parameters: <code>set</code> and <code>policy</code>. The values returned in these parameters depend on both the <code>flags</code> passed in and the current memory binding policies and nodesets in the queried target.</p>
<p>Passing the <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> flag specifies that the query target is the current policies and nodesets for all the threads in the current process. Passing <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a> specifies that the query target is the current policy and nodeset for only the thread invoking this function.</p>
<p>If neither of these flags are passed (which is the most portable method), the process is assumed to be single threaded. This allows hwloc to use either process-based OS functions or thread-based OS functions, depending on which are available.</p>
<p><a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is only meaningful when <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> is also specified. In this case, hwloc will check the default memory policies and nodesets for all threads in the process. If they are not identical, -1 is returned and errno is set to EXDEV. If they are identical, the values are returned in <code>set</code> and <code>policy</code>.</p>
<p>Otherwise, if <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> is specified (and <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is <em>not</em> specified), the default set from each thread is logically OR'ed together. If all threads' default policies are the same, <code>policy</code> is set to that policy. If they are different, <code>policy</code> is set to <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a3185bd869b67817fb2bd5164bf360402" title="Returned by get_membind() functions when multiple threads or parts of a memory area have differing me...">HWLOC_MEMBIND_MIXED</a>.</p>
<p>In the <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a> case (or when neither <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> or <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a> is specified), there is only one set and policy; they are returned in <code>set</code> and <code>policy</code>, respectively.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<p>If any other flags are specified, -1 is returned and errno is set to EINVAL. </p>
</div>
</div>
<a id="ga1730ceb18ec6ee3b7bd3d0db81f07dc8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1730ceb18ec6ee3b7bd3d0db81f07dc8">◆ </a></span>hwloc_get_proc_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_get_proc_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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">hwloc_pid_t </td>
<td class="paramname"><em>pid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gaa3c2bf4c776d603dcebbb61b0c923d84">hwloc_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> * </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Query the default memory binding policy and physical locality of the specified process. </p>
<p>This function has two output parameters: <code>set</code> and <code>policy</code>. The values returned in these parameters depend on both the <code>flags</code> passed in and the current memory binding policies and nodesets in the queried target.</p>
<p>Passing the <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> flag specifies that the query target is the current policies and nodesets for all the threads in the specified process. If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> is not specified (which is the most portable method), the process is assumed to be single threaded. This allows hwloc to use either process-based OS functions or thread-based OS functions, depending on which are available.</p>
<p>Note that it does not make sense to pass <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a> to this function.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a0335311a0ee04166df2888d52b4a42c6">HWLOC_MEMBIND_STRICT</a> is specified, hwloc will check the default memory policies and nodesets for all threads in the specified process. If they are not identical, -1 is returned and errno is set to EXDEV. If they are identical, the values are returned in <code>set</code> and <code>policy</code>.</p>
<p>Otherwise, <code>set</code> is set to the logical OR of all threads' default set. If all threads' default policies are the same, <code>policy</code> is set to that policy. If they are different, <code>policy</code> is set to <a class="el" href="a00197.html#ggac9764f79505775d06407b40f5e4661e8a3185bd869b67817fb2bd5164bf360402" title="Returned by get_membind() functions when multiple threads or parts of a memory area have differing me...">HWLOC_MEMBIND_MIXED</a>.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<p>If any other flags are specified, -1 is returned and errno is set to EINVAL.</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></dl>
</div>
</div>
<a id="gaf881faefe20701229f07dd7dbd0125ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf881faefe20701229f07dd7dbd0125ed">◆ </a></span>hwloc_set_area_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_set_area_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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 void * </td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) specified by <code>set</code>. </p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<dl class="section return"><dt>Returns</dt><dd>0 if <code>len</code> is 0. </dd>
<dd>
-1 with errno set to ENOSYS if the action is not supported </dd>
<dd>
-1 with errno set to EXDEV if the binding cannot be enforced </dd></dl>
</div>
</div>
<a id="ga020951efa0ce3862bd4faec295501a7f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga020951efa0ce3862bd4faec295501a7f">◆ </a></span>hwloc_set_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_set_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) specified by <code>set</code>. </p>
<p>If neither <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1b1b74aef138f64aff214a8cbdfe8eb4" title="Set policy for all threads of the specified (possibly multithreaded) process. This flag is mutually e...">HWLOC_MEMBIND_PROCESS</a> nor <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a1dc7dd5cdcd5796893a325a524555298" title="Set policy for a specific thread of the current process. This flag is mutually exclusive with HWLOC_M...">HWLOC_MEMBIND_THREAD</a> is specified, the current process is assumed to be single-threaded. This is the most portable form as it permits hwloc to use either process-based OS functions or thread-based OS functions, depending on which are available.</p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<dl class="section return"><dt>Returns</dt><dd>-1 with errno set to ENOSYS if the action is not supported </dd>
<dd>
-1 with errno set to EXDEV if the binding cannot be enforced </dd></dl>
</div>
</div>
<a id="gabc91ff16f7e41047924e3a4ae6d9da7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabc91ff16f7e41047924e3a4ae6d9da7e">◆ </a></span>hwloc_set_proc_membind()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_set_proc_membind </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00192.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">hwloc_pid_t </td>
<td class="paramname"><em>pid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00211.html#gae991a108af01d408be2776c5b2c467b2">hwloc_const_bitmap_t</a> </td>
<td class="paramname"><em>set</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00197.html#gac9764f79505775d06407b40f5e4661e8">hwloc_membind_policy_t</a> </td>
<td class="paramname"><em>policy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </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>Set the default memory binding policy of the specified process to prefer the NUMA node(s) specified by <code>set</code>. </p>
<p>If <a class="el" href="a00197.html#ggab00475fd98815bf4fb9aaf752030e7d2a71f19fe4505f1c083dc8e6f7bdea6256" title="Consider the bitmap argument as a nodeset.">HWLOC_MEMBIND_BYNODESET</a> is specified, set is considered a nodeset. Otherwise it's a cpuset.</p>
<dl class="section return"><dt>Returns</dt><dd>-1 with errno set to ENOSYS if the action is not supported </dd>
<dd>
-1 with errno set to EXDEV if the binding cannot be enforced</dd></dl>
<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></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.1
</small></address>
</body>
</html>
|