Debian Codegraph @

doc/doxygen-doc/man/man3/hwlocality_membinding.3

raw
1 .TH "hwlocality_membinding" 3 "Version 2.14.0" "Hardware Locality (hwloc)" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 hwlocality_membinding \- Memory binding
6 .SH SYNOPSIS
7 .br
8 .PP
9 .SS "Enumerations"
10
11 .in +1c
12 .ti -1c
13 .RI "enum \fBhwloc_membind_policy_t\fP { \fBHWLOC_MEMBIND_DEFAULT\fP, \fBHWLOC_MEMBIND_FIRSTTOUCH\fP, \fBHWLOC_MEMBIND_BIND\fP, \fBHWLOC_MEMBIND_INTERLEAVE\fP, \fBHWLOC_MEMBIND_WEIGHTED_INTERLEAVE\fP, \fBHWLOC_MEMBIND_NEXTTOUCH\fP, \fBHWLOC_MEMBIND_MIXED\fP }"
14 .br
15 .ti -1c
16 .RI "enum \fBhwloc_membind_flags_t\fP { \fBHWLOC_MEMBIND_PROCESS\fP, \fBHWLOC_MEMBIND_THREAD\fP, \fBHWLOC_MEMBIND_STRICT\fP, \fBHWLOC_MEMBIND_MIGRATE\fP, \fBHWLOC_MEMBIND_NOCPUBIND\fP, \fBHWLOC_MEMBIND_BYNODESET\fP }"
17 .br
18 .in -1c
19 .SS "Functions"
20
21 .in +1c
22 .ti -1c
23 .RI "int \fBhwloc_set_membind\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
24 .br
25 .ti -1c
26 .RI "int \fBhwloc_get_membind\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP *policy, int flags)"
27 .br
28 .ti -1c
29 .RI "int \fBhwloc_set_proc_membind\fP (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
30 .br
31 .ti -1c
32 .RI "int \fBhwloc_get_proc_membind\fP (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP *policy, int flags)"
33 .br
34 .ti -1c
35 .RI "int \fBhwloc_set_area_membind\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
36 .br
37 .ti -1c
38 .RI "int \fBhwloc_get_area_membind\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP *policy, int flags)"
39 .br
40 .ti -1c
41 .RI "int \fBhwloc_get_area_memlocation\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_bitmap_t\fP set, int flags)"
42 .br
43 .ti -1c
44 .RI "void * \fBhwloc_alloc\fP (\fBhwloc_topology_t\fP topology, size_t len)"
45 .br
46 .ti -1c
47 .RI "void * \fBhwloc_alloc_membind\fP (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
48 .br
49 .ti -1c
50 .RI "void * \fBhwloc_alloc_membind_policy\fP (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
51 .br
52 .ti -1c
53 .RI "int \fBhwloc_free\fP (\fBhwloc_topology_t\fP topology, void *addr, size_t len)"
54 .br
55 .in -1c
56 .SH "Detailed Description"
57 .PP
58 Memory binding can be done three ways:
59
60 .PP
61 .IP "\(bu" 2
62 explicit memory allocation thanks to \fBhwloc_alloc_membind()\fP and friends: the binding will have effect on the memory allocated by these functions\&.
63 .IP "\(bu" 2
64 implicit memory binding through binding policy: \fBhwloc_set_membind()\fP and friends only define the current policy of the process, which will be applied to the subsequent calls to malloc() and friends\&.
65 .IP "\(bu" 2
66 migration of existing memory ranges, thanks to \fBhwloc_set_area_membind()\fP and friends, which move already-allocated data\&.
67 .PP
68
69 .PP
70 Not all operating systems support all three ways\&. \fBhwloc_topology_get_support()\fP may be used to query about the actual memory binding support in the currently used operating system\&.
71
72 .PP
73 When the requested binding operation is not available and the \fBHWLOC_MEMBIND_STRICT\fP flag was passed, the function returns -1\&. \fRerrno\fP will be set to \fRENOSYS\fP 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)\&. \fRerrno\fP will be set to \fREXDEV\fP when the requested set can not be enforced (e\&.g\&., some systems only allow binding memory to a single NUMA node)\&.
74
75 .PP
76 If \fBHWLOC_MEMBIND_STRICT\fP 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\&.
77
78 .PP
79 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 \fBhwloc_alloc_membind()\fP, which will never change the current memory binding policy\&.
80
81 .PP
82 .PP
83 .nf
84 hwloc_alloc_membind_policy(topology, size, set,
85 HWLOC_MEMBIND_BIND, 0);
86 .fi
87 .PP
88
89 .PP
90 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 \fBHWLOC_MEMBIND_BYNODESET\fP is specified\&. See \fBObject Sets (hwloc_cpuset_t and hwloc_nodeset_t)\fP and \fBThe bitmap API\fP for a discussion of CPU sets and NUMA memory node sets\&. It is also possible to convert between CPU set and node set using \fBhwloc_cpuset_to_nodeset()\fP or \fBhwloc_cpuset_from_nodeset()\fP\&.
91
92 .PP
93 Memory binding by CPU set cannot work for CPU-less NUMA memory nodes\&. Binding by nodeset should therefore be preferred whenever possible\&.
94
95 .PP
96 \fBSee also\fP
97 .RS 4
98 Some example codes are available under doc/examples/ in the source tree\&.
99 .RE
100 .PP
101 \fBNote\fP
102 .RS 4
103 On some operating systems, memory binding affects the CPU binding; see \fBHWLOC_MEMBIND_NOCPUBIND\fP
104 .RE
105 .PP
106
107 .SH "Enumeration Type Documentation"
108 .PP
109 .SS "enum \fBhwloc_membind_flags_t\fP"
110
111 .PP
112 Memory binding flags\&. These flags can be used to refine the binding policy\&. All flags can be logically OR'ed together with the exception of \fBHWLOC_MEMBIND_PROCESS\fP and \fBHWLOC_MEMBIND_THREAD\fP; these two flags are mutually exclusive\&.
113
114 .PP
115 Not all systems support all kinds of binding\&. \fBhwloc_topology_get_support()\fP may be used to query about the actual memory binding support in the currently used operating system\&. See the "Detailed Description" section of \fBMemory binding\fP for a description of errors that can occur\&.
116 .PP
117 \fBEnumerator\fP
118 .in +1c
119 .TP
120 \f(BIHWLOC_MEMBIND_PROCESS \fP
121 Set policy for all threads of the specified (possibly multithreaded) process\&. This flag is mutually exclusive with \fBHWLOC_MEMBIND_THREAD\fP\&.
122 .TP
123 \f(BIHWLOC_MEMBIND_THREAD \fP
124 Set policy for a specific thread of the current process\&. This flag is mutually exclusive with \fBHWLOC_MEMBIND_PROCESS\fP\&.
125 .TP
126 \f(BIHWLOC_MEMBIND_STRICT \fP
127 Request strict binding from the OS\&. The function will fail if the binding can not be guaranteed / completely enforced\&.
128
129 .PP
130 This flag has slightly different meanings depending on which function it is used with\&.
131 .TP
132 \f(BIHWLOC_MEMBIND_MIGRATE \fP
133 Migrate existing allocated memory\&. If the memory cannot be migrated and the \fBHWLOC_MEMBIND_STRICT\fP flag is passed, an error will be returned\&.
134 .TP
135 \f(BIHWLOC_MEMBIND_NOCPUBIND \fP
136 Avoid any effect on CPU binding\&. 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 \fRENOSYS\fP when used with NOCPUBIND\&.
137 .TP
138 \f(BIHWLOC_MEMBIND_BYNODESET \fP
139 Consider the bitmap argument as a nodeset\&. The bitmap argument is considered a nodeset if this flag is given, or a cpuset otherwise by default\&.
140
141 .PP
142 Memory binding by CPU set cannot work for CPU-less NUMA memory nodes\&. Binding by nodeset should therefore be preferred whenever possible\&.
143 .SS "enum \fBhwloc_membind_policy_t\fP"
144
145 .PP
146 Memory binding policy\&. 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)\&.
147
148 .PP
149 Not all systems support all kinds of binding\&. \fBhwloc_topology_get_support()\fP may be used to query about the actual memory binding policy support in the currently used operating system\&. See the "Detailed Description" section of \fBMemory binding\fP for a description of errors that can occur\&.
150 .PP
151 \fBEnumerator\fP
152 .in +1c
153 .TP
154 \f(BIHWLOC_MEMBIND_DEFAULT \fP
155 Reset the memory allocation policy to the system default\&. Depending on the operating system, this may correspond to \fBHWLOC_MEMBIND_FIRSTTOUCH\fP (Linux, FreeBSD), or \fBHWLOC_MEMBIND_BIND\fP (AIX, HP-UX, Solaris, Windows)\&. This policy is never returned by get membind functions\&. The nodeset argument is ignored\&.
156 .TP
157 \f(BIHWLOC_MEMBIND_FIRSTTOUCH \fP
158 Allocate each memory page individually on the local NUMA node of the thread that touches it\&. The given nodeset should usually be \fBhwloc_topology_get_topology_nodeset()\fP so that the touching thread may run and allocate on any node in the system\&.
159
160 .PP
161 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)\&.
162 .TP
163 \f(BIHWLOC_MEMBIND_BIND \fP
164 Allocate memory on the specified nodes\&. The actual behavior may slightly vary between operating systems, especially when (some of) the requested nodes are full\&. On Linux, by default, the MPOL_PREFERRED_MANY (or MPOL_PREFERRED) policy is used\&. However, if the hwloc strict flag is also given, the Linux MPOL_BIND policy is rather used\&.
165 .TP
166 \f(BIHWLOC_MEMBIND_INTERLEAVE \fP
167 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\&.
168 .TP
169 \f(BIHWLOC_MEMBIND_WEIGHTED_INTERLEAVE \fP
170 Allocate memory on the given nodes in an interleaved / weighted manner\&. The precise layout of the memory across multiple NUMA nodes is OS/system specific\&. Weighted interleaving can be useful when threads distributed across the specified NUMA nodes with different bandwidth capabilities will all be accessing the whole memory range concurrently, since the interleave will then balance the memory references\&.
171 .TP
172 \f(BIHWLOC_MEMBIND_NEXTTOUCH \fP
173 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)\&.
174 .TP
175 \f(BIHWLOC_MEMBIND_MIXED \fP
176 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\&.
177 .SH "Function Documentation"
178 .PP
179 .SS "void * hwloc_alloc (\fBhwloc_topology_t\fP topology, size_t len)"
180
181 .PP
182 Allocate some memory\&. This is equivalent to malloc(), except that it tries to allocate page-aligned memory from the OS\&.
183
184 .PP
185 \fBReturns\fP
186 .RS 4
187 a pointer to the allocated area, or \fRNULL\fP on error\&.
188 .RE
189 .PP
190 \fBNote\fP
191 .RS 4
192 The allocated memory should be freed with \fBhwloc_free()\fP\&.
193 .RE
194 .PP
195
196 .SS "void * hwloc_alloc_membind (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
197
198 .PP
199 Allocate some memory on NUMA memory nodes specified by \fRset\fP\&.
200 .PP
201 \fBReturns\fP
202 .RS 4
203 a pointer to the allocated area\&.
204
205 .PP
206 NULL with errno set to \fRENOSYS\fP if the action is not supported and \fBHWLOC_MEMBIND_STRICT\fP is given\&.
207
208 .PP
209 NULL with errno set to \fREXDEV\fP if the binding cannot be enforced and \fBHWLOC_MEMBIND_STRICT\fP is given\&.
210
211 .PP
212 NULL with errno set to \fRENOMEM\fP if the memory allocation failed even before trying to bind\&.
213 .RE
214 .PP
215 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
216
217 .PP
218 \fBNote\fP
219 .RS 4
220 The allocated memory should be freed with \fBhwloc_free()\fP\&.
221 .RE
222 .PP
223
224 .SS "void * hwloc_alloc_membind_policy (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)\fR [inline]\fP"
225
226 .PP
227 Allocate some memory on NUMA memory nodes specified by \fRset\fP\&. First, try to allocate properly with \fBhwloc_alloc_membind()\fP\&. On failure, the current process or thread memory binding policy is changed with \fBhwloc_set_membind()\fP before allocating memory\&. Thus this function works in more cases, at the expense of changing the current state (possibly affecting future allocations that would not specify any policy)\&.
228
229 .PP
230 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
231
232 .PP
233 \fBReturns\fP
234 .RS 4
235 a pointer to the allocated area, or \fRNULL\fP on error\&.
236 .RE
237 .PP
238
239 .SS "int hwloc_free (\fBhwloc_topology_t\fP topology, void * addr, size_t len)"
240
241 .PP
242 Free memory that was previously allocated by \fBhwloc_alloc()\fP or \fBhwloc_alloc_membind()\fP\&.
243 .PP
244 \fBReturns\fP
245 .RS 4
246 0 on success, -1 on error\&.
247 .RE
248 .PP
249
250 .SS "int hwloc_get_area_membind (\fBhwloc_topology_t\fP topology, const void * addr, size_t len, \fBhwloc_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP * policy, int flags)"
251
252 .PP
253 Query the CPUs near the physical NUMA node(s) and binding policy of the memory identified by (\fRaddr\fP, \fRlen\fP )\&. The bitmap \fRset\fP (previously allocated by the caller) is filled with the memory area binding\&.
254
255 .PP
256 This function has two output parameters: \fRset\fP and \fRpolicy\fP\&. The values returned in these parameters depend on both the \fRflags\fP passed in and the memory binding policies and nodesets of the pages in the address range\&.
257
258 .PP
259 If \fBHWLOC_MEMBIND_STRICT\fP 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 \fREXDEV\fP\&. If they are identical across all pages, the set and policy are returned in \fRset\fP and \fRpolicy\fP, respectively\&.
260
261 .PP
262 If \fBHWLOC_MEMBIND_STRICT\fP 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 \fRpolicy\fP\&. Otherwise, \fRpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&.
263
264 .PP
265 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
266
267 .PP
268 If any other flags are specified, -1 is returned and errno is set to \fREINVAL\fP\&.
269
270 .PP
271 \fBReturns\fP
272 .RS 4
273 0 on success\&.
274
275 .PP
276 -1 with errno set to \fREINVAL\fP if \fRlen\fP is 0\&.
277 .RE
278 .PP
279
280 .SS "int hwloc_get_area_memlocation (\fBhwloc_topology_t\fP topology, const void * addr, size_t len, \fBhwloc_bitmap_t\fP set, int flags)"
281
282 .PP
283 Get the NUMA nodes where memory identified by (\fRaddr\fP, \fRlen\fP ) is physically allocated\&. The bitmap \fRset\fP (previously allocated by the caller) is filled according to the NUMA nodes where the memory area pages are physically allocated\&. If no page is actually allocated yet, \fRset\fP may be empty\&.
284
285 .PP
286 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\&.
287
288 .PP
289 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\&.
290
291 .PP
292 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified in \fRflags\fP, set is considered a nodeset\&. Otherwise it's a cpuset\&.
293
294 .PP
295 If \fRlen\fP is 0, \fRset\fP is emptied\&.
296
297 .PP
298 \fBReturns\fP
299 .RS 4
300 0 on success, -1 on error\&.
301 .RE
302 .PP
303
304 .SS "int hwloc_get_membind (\fBhwloc_topology_t\fP topology, \fBhwloc_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP * policy, int flags)"
305
306 .PP
307 Query the default memory binding policy and physical locality of the current process or thread\&. The bitmap \fRset\fP (previously allocated by the caller) is filled with the process or thread memory binding\&.
308
309 .PP
310 This function has two output parameters: \fRset\fP and \fRpolicy\fP\&. The values returned in these parameters depend on both the \fRflags\fP passed in and the current memory binding policies and nodesets in the queried target\&.
311
312 .PP
313 Passing the \fBHWLOC_MEMBIND_PROCESS\fP flag specifies that the query target is the current policies and nodesets for all the threads in the current process\&. Passing \fBHWLOC_MEMBIND_THREAD\fP specifies that the query target is the current policy and nodeset for only the thread invoking this function\&.
314
315 .PP
316 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\&.
317
318 .PP
319 \fBHWLOC_MEMBIND_STRICT\fP is only meaningful when \fBHWLOC_MEMBIND_PROCESS\fP 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 \fREXDEV\fP\&. If they are identical, the values are returned in \fRset\fP and \fRpolicy\fP\&.
320
321 .PP
322 Otherwise, if \fBHWLOC_MEMBIND_PROCESS\fP is specified (and \fBHWLOC_MEMBIND_STRICT\fP is \fInot\fP specified), the default set from each thread is logically OR'ed together\&. If all threads' default policies are the same, \fRpolicy\fP is set to that policy\&. If they are different, \fRpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&.
323
324 .PP
325 In the \fBHWLOC_MEMBIND_THREAD\fP case (or when neither \fBHWLOC_MEMBIND_PROCESS\fP or \fBHWLOC_MEMBIND_THREAD\fP is specified), there is only one set and policy; they are returned in \fRset\fP and \fRpolicy\fP, respectively\&.
326
327 .PP
328 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
329
330 .PP
331 If any other flags are specified, -1 is returned and errno is set to \fREINVAL\fP\&.
332
333 .PP
334 \fBReturns\fP
335 .RS 4
336 0 on success, -1 on error\&.
337 .RE
338 .PP
339
340 .SS "int hwloc_get_proc_membind (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP * policy, int flags)"
341
342 .PP
343 Query the default memory binding policy and physical locality of the specified process\&. The bitmap \fRset\fP (previously allocated by the caller) is filled with the process memory binding\&.
344
345 .PP
346 This function has two output parameters: \fRset\fP and \fRpolicy\fP\&. The values returned in these parameters depend on both the \fRflags\fP passed in and the current memory binding policies and nodesets in the queried target\&.
347
348 .PP
349 Passing the \fBHWLOC_MEMBIND_PROCESS\fP flag specifies that the query target is the current policies and nodesets for all the threads in the specified process\&. If \fBHWLOC_MEMBIND_PROCESS\fP 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\&.
350
351 .PP
352 Note that it does not make sense to pass \fBHWLOC_MEMBIND_THREAD\fP to this function\&.
353
354 .PP
355 If \fBHWLOC_MEMBIND_STRICT\fP 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 \fREXDEV\fP\&. If they are identical, the values are returned in \fRset\fP and \fRpolicy\fP\&.
356
357 .PP
358 Otherwise, \fRset\fP is set to the logical OR of all threads' default set\&. If all threads' default policies are the same, \fRpolicy\fP is set to that policy\&. If they are different, \fRpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&.
359
360 .PP
361 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
362
363 .PP
364 If any other flags are specified, -1 is returned and errno is set to \fREINVAL\fP\&.
365
366 .PP
367 \fBReturns\fP
368 .RS 4
369 0 on success, -1 on error\&.
370 .RE
371 .PP
372 \fBNote\fP
373 .RS 4
374 \fRhwloc_pid_t\fP is \fRpid_t\fP on Unix platforms, and \fRHANDLE\fP on native Windows platforms\&.
375 .RE
376 .PP
377
378 .SS "int hwloc_set_area_membind (\fBhwloc_topology_t\fP topology, const void * addr, size_t len, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
379
380 .PP
381 Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) specified by \fRset\fP\&. If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
382
383 .PP
384 \fBReturns\fP
385 .RS 4
386 0 on success or if \fRlen\fP is 0\&.
387
388 .PP
389 -1 with errno set to \fRENOSYS\fP if the action is not supported\&.
390
391 .PP
392 -1 with errno set to \fREXDEV\fP if the binding cannot be enforced\&.
393 .RE
394 .PP
395
396 .SS "int hwloc_set_membind (\fBhwloc_topology_t\fP topology, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
397
398 .PP
399 Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) specified by \fRset\fP\&. If neither \fBHWLOC_MEMBIND_PROCESS\fP nor \fBHWLOC_MEMBIND_THREAD\fP 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\&.
400
401 .PP
402 If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
403
404 .PP
405 \fBReturns\fP
406 .RS 4
407 0 on success\&.
408
409 .PP
410 -1 with errno set to \fRENOSYS\fP if the action is not supported\&.
411
412 .PP
413 -1 with errno set to \fREXDEV\fP if the binding cannot be enforced\&.
414 .RE
415 .PP
416
417 .SS "int hwloc_set_proc_membind (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_const_bitmap_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)"
418
419 .PP
420 Set the default memory binding policy of the specified process to prefer the NUMA node(s) specified by \fRset\fP\&. If \fBHWLOC_MEMBIND_BYNODESET\fP is specified, set is considered a nodeset\&. Otherwise it's a cpuset\&.
421
422 .PP
423 \fBReturns\fP
424 .RS 4
425 0 on success\&.
426
427 .PP
428 -1 with errno set to \fRENOSYS\fP if the action is not supported\&.
429
430 .PP
431 -1 with errno set to \fREXDEV\fP if the binding cannot be enforced\&.
432 .RE
433 .PP
434 \fBNote\fP
435 .RS 4
436 \fRhwloc_pid_t\fP is \fRpid_t\fP on Unix platforms, and \fRHANDLE\fP on native Windows platforms\&.
437 .RE
438 .PP
439
440 .SH "Author"
441 .PP
442 Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.