.TH "Memory binding" 3 "Sun Nov 2 2014" "Version 1.10.0" "Hardware Locality (hwloc)" \" -*- nroff -*- .ad l .nh .SH NAME Memory binding \- .SS "Enumerations" .in +1c .ti -1c .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_REPLICATE\fP, \fBHWLOC_MEMBIND_NEXTTOUCH\fP, \fBHWLOC_MEMBIND_MIXED\fP }" .br .ti -1c .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 }" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBhwloc_set_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_const_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_set_membind\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_const_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_get_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP *policy, int flags)" .br .ti -1c .RI "int \fBhwloc_get_membind\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP *policy, int flags)" .br .ti -1c .RI "int \fBhwloc_set_proc_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_const_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_set_proc_membind\fP (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_const_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_get_proc_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP *policy, int flags)" .br .ti -1c .RI "int \fBhwloc_get_proc_membind\fP (\fBhwloc_topology_t\fP topology, hwloc_pid_t pid, \fBhwloc_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP *policy, int flags)" .br .ti -1c .RI "int \fBhwloc_set_area_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_const_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_set_area_membind\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_const_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_get_area_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP *policy, int flags)" .br .ti -1c .RI "int \fBhwloc_get_area_membind\fP (\fBhwloc_topology_t\fP topology, const void *addr, size_t len, \fBhwloc_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP *policy, int flags)" .br .ti -1c .RI "void * \fBhwloc_alloc\fP (\fBhwloc_topology_t\fP topology, size_t len)" .br .ti -1c .RI "void * \fBhwloc_alloc_membind_nodeset\fP (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "void * \fBhwloc_alloc_membind\fP (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_cpuset_t\fP cpuset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "static void * \fBhwloc_alloc_membind_policy_nodeset\fP (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_nodeset_t\fP nodeset, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "static void * \fBhwloc_alloc_membind_policy\fP (\fBhwloc_topology_t\fP topology, size_t len, \fBhwloc_const_cpuset_t\fP set, \fBhwloc_membind_policy_t\fP policy, int flags)" .br .ti -1c .RI "int \fBhwloc_free\fP (\fBhwloc_topology_t\fP topology, void *addr, size_t len)" .br .in -1c .SH "Detailed Description" .PP Memory binding can be done three ways: .PP .IP "\(bu" 2 explicit memory allocation thanks to \fBhwloc_alloc_membind()\fP and friends: the binding will have effect on the memory allocated by these functions\&. .IP "\(bu" 2 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\&. .IP "\(bu" 2 migration of existing memory ranges, thanks to \fBhwloc_set_area_membind()\fP and friends, which move already-allocated data\&. .PP .PP 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\&. .PP When the requested binding operation is not available and the \fBHWLOC_MEMBIND_STRICT\fP flag was passed, the function returns -1\&. \fCerrno\fP will be set to \fCENOSYS\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)\&. \fCerrno\fP will be set to EXDEV when the requested cpuset can not be enforced (e\&.g\&., some systems only allow binding memory to a single NUMA node)\&. .PP 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\&. .PP 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\&. .PP .PP .nf hwloc_alloc_membind_policy(topology, size, set, HWLOC_MEMBIND_DEFAULT, 0); .fi .PP .PP Each hwloc memory binding function is available in two forms: one that takes a CPU set argument and another that takes a NUMA memory node set argument (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)\&. The names of the latter form end with _nodeset\&. It is also possible to convert between CPU set and node set using \fBhwloc_cpuset_to_nodeset()\fP or \fBhwloc_cpuset_from_nodeset()\fP\&. .PP \fBSee also:\fP .RS 4 Some example codes are available under doc/examples/ in the source tree\&. .RE .PP \fBNote:\fP .RS 4 On some operating systems, memory binding affects the CPU binding; see \fBHWLOC_MEMBIND_NOCPUBIND\fP .RE .PP .SH "Enumeration Type Documentation" .PP .SS "enum \fBhwloc_membind_flags_t\fP" .PP 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\&. .PP 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\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_MEMBIND_PROCESS \fP\fP Set policy for all threads of the specified (possibly multithreaded) process\&. This flag is mutually exclusive with \fBHWLOC_MEMBIND_THREAD\fP\&. .TP \fB\fIHWLOC_MEMBIND_THREAD \fP\fP Set policy for a specific thread of the current process\&. This flag is mutually exclusive with \fBHWLOC_MEMBIND_PROCESS\fP\&. .TP \fB\fIHWLOC_MEMBIND_STRICT \fP\fP Request strict binding from the OS\&. The function will fail if the binding can not be guaranteed / completely enforced\&. .PP This flag has slightly different meanings depending on which function it is used with\&. .TP \fB\fIHWLOC_MEMBIND_MIGRATE \fP\fP Migrate existing allocated memory\&. If the memory cannot be migrated and the \fBHWLOC_MEMBIND_STRICT\fP flag is passed, an error will be returned\&. .TP \fB\fIHWLOC_MEMBIND_NOCPUBIND \fP\fP 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 ENOSYS when used with NOCPUBIND\&. .SS "enum \fBhwloc_membind_policy_t\fP" .PP 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)\&. .PP 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\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_MEMBIND_DEFAULT \fP\fP Reset the memory allocation policy to the system default\&. .TP \fB\fIHWLOC_MEMBIND_FIRSTTOUCH \fP\fP Allocate memory but do not immediately bind it to a specific locality\&. Instead, each page in the allocation is bound only when it is first touched\&. Pages are individually bound to the local NUMA node of the first thread that touches it\&. If there is not enough memory on the node, allocation may be done in the specified cpuset before allocating on other nodes\&. .TP \fB\fIHWLOC_MEMBIND_BIND \fP\fP Allocate memory on the specified nodes\&. .TP \fB\fIHWLOC_MEMBIND_INTERLEAVE \fP\fP 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\&. .TP \fB\fIHWLOC_MEMBIND_REPLICATE \fP\fP Replicate memory on the given nodes; reads from this memory will attempt to be serviced from the NUMA node local to the reading thread\&. Replicating can be useful when multiple threads from the specified NUMA nodes will be sharing the same read-only data\&. This policy can only be used with existing memory allocations (i\&.e\&., the hwloc_set_*membind*() functions); it cannot be used with functions that allocate new memory (i\&.e\&., the hwloc_alloc*() functions)\&. .TP \fB\fIHWLOC_MEMBIND_NEXTTOUCH \fP\fP 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)\&. .TP \fB\fIHWLOC_MEMBIND_MIXED \fP\fP Returned by get_membind() functions when multiple threads or parts of a memory area have differing memory binding policies\&. .SH "Function Documentation" .PP .SS "void* hwloc_alloc (\fBhwloc_topology_t\fPtopology, size_tlen)" .PP Allocate some memory\&. This is equivalent to malloc(), except that it tries to allocate page-aligned memory from the OS\&. .PP \fBNote:\fP .RS 4 The allocated memory should be freed with \fBhwloc_free()\fP\&. .RE .PP .SS "void* hwloc_alloc_membind (\fBhwloc_topology_t\fPtopology, size_tlen, \fBhwloc_const_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Allocate some memory on memory nodes near the given physical cpuset \fCcpuset\fP\&. .PP \fBReturns:\fP .RS 4 NULL with errno set to ENOSYS if the action is not supported and \fBHWLOC_MEMBIND_STRICT\fP is given .PP NULL with errno set to EXDEV if the binding cannot be enforced and \fBHWLOC_MEMBIND_STRICT\fP is given .PP NULL with errno set to ENOMEM if the memory allocation failed even before trying to bind\&. .RE .PP \fBNote:\fP .RS 4 The allocated memory should be freed with \fBhwloc_free()\fP\&. .RE .PP .SS "void* hwloc_alloc_membind_nodeset (\fBhwloc_topology_t\fPtopology, size_tlen, \fBhwloc_const_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Allocate some memory on the given physical nodeset \fCnodeset\fP\&. .PP \fBReturns:\fP .RS 4 NULL with errno set to ENOSYS if the action is not supported and \fBHWLOC_MEMBIND_STRICT\fP is given .PP NULL with errno set to EXDEV if the binding cannot be enforced and \fBHWLOC_MEMBIND_STRICT\fP is given .PP NULL with errno set to ENOMEM if the memory allocation failed even before trying to bind\&. .RE .PP \fBNote:\fP .RS 4 The allocated memory should be freed with \fBhwloc_free()\fP\&. .RE .PP .SS "static void* hwloc_alloc_membind_policy (\fBhwloc_topology_t\fPtopology, size_tlen, \fBhwloc_const_cpuset_t\fPset, \fBhwloc_membind_policy_t\fPpolicy, intflags)\fC [inline]\fP, \fC [static]\fP" .PP Allocate some memory on the memory nodes near given cpuset \fCcpuset\fP\&. This is similar to hwloc_alloc_membind_policy_nodeset, but for a given cpuset\&. .SS "static void* hwloc_alloc_membind_policy_nodeset (\fBhwloc_topology_t\fPtopology, size_tlen, \fBhwloc_const_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fPpolicy, intflags)\fC [inline]\fP, \fC [static]\fP" .PP Allocate some memory on the given nodeset \fCnodeset\fP\&. This is similar to hwloc_alloc_membind 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\&. .SS "int hwloc_free (\fBhwloc_topology_t\fPtopology, void *addr, size_tlen)" .PP Free memory that was previously allocated by \fBhwloc_alloc()\fP or \fBhwloc_alloc_membind()\fP\&. .SS "int hwloc_get_area_membind (\fBhwloc_topology_t\fPtopology, const void *addr, size_tlen, \fBhwloc_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fP *policy, intflags)" .PP Query the CPUs near the physical NUMA node(s) and binding policy of the memory identified by (\fCaddr\fP, \fClen\fP )\&. This function has two output parameters: \fCcpuset\fP and \fCpolicy\fP\&. The values returned in these parameters depend on both the \fCflags\fP passed in and the memory binding policies and nodesets of the pages in the address range\&. .PP 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 EXDEV\&. If they are identical across all pages, the policy is returned in \fCpolicy\fP\&. \fCcpuset\fP is set to the union of CPUs near the NUMA node(s) in the nodeset\&. .PP If \fBHWLOC_MEMBIND_STRICT\fP is not specified, the union of all NUMA node(s) containing pages in the address range is calculated\&. \fCcpuset\fP is then set to the CPUs near the NUMA node(s) in this union\&. If all pages in the target have the same policy, it is returned in \fCpolicy\fP\&. Otherwise, \fCpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&. .PP If any other flags are specified, -1 is returned and errno is set to EINVAL\&. .SS "int hwloc_get_area_membind_nodeset (\fBhwloc_topology_t\fPtopology, const void *addr, size_tlen, \fBhwloc_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fP *policy, intflags)" .PP Query the physical NUMA node(s) and binding policy of the memory identified by (\fCaddr\fP, \fClen\fP )\&. This function has two output parameters: \fCnodeset\fP and \fCpolicy\fP\&. The values returned in these parameters depend on both the \fCflags\fP passed in and the memory binding policies and nodesets of the pages in the address range\&. .PP 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 EXDEV\&. If they are identical across all pages, the nodeset and policy are returned in \fCnodeset\fP and \fCpolicy\fP, respectively\&. .PP If \fBHWLOC_MEMBIND_STRICT\fP is not specified, \fCnodeset\fP is set to the union of all NUMA node(s) containing pages in the address range\&. If all pages in the target have the same policy, it is returned in \fCpolicy\fP\&. Otherwise, \fCpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&. .PP If any other flags are specified, -1 is returned and errno is set to EINVAL\&. .SS "int hwloc_get_membind (\fBhwloc_topology_t\fPtopology, \fBhwloc_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fP *policy, intflags)" .PP Query the default memory binding policy and physical locality of the current process or thread (the locality is returned in \fCcpuset\fP as CPUs near the locality's actual NUMA node(s))\&. This function has two output parameters: \fCcpuset\fP and \fCpolicy\fP\&. The values returned in these parameters depend on both the \fCflags\fP passed in and the current memory binding policies and nodesets in the queried target\&. .PP 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\&. .PP 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\&. .PP \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 EXDEV\&. If they are identical, the policy is returned in \fCpolicy\fP\&. \fCcpuset\fP is set to the union of CPUs near the NUMA node(s) in the nodeset\&. .PP Otherwise, if \fBHWLOC_MEMBIND_PROCESS\fP is specified (and \fBHWLOC_MEMBIND_STRICT\fP is \fInot\fP specified), the default nodeset from each thread is logically OR'ed together\&. \fCcpuset\fP is set to the union of CPUs near the NUMA node(s) in the resulting nodeset\&. If all threads' default policies are the same, \fCpolicy\fP is set to that policy\&. If they are different, \fCpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&. .PP 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 nodeset and policy\&. The policy is returned in \fCpolicy\fP; \fCcpuset\fP is set to the union of CPUs near the NUMA node(s) in the \fCnodeset\fP\&. .PP If any other flags are specified, -1 is returned and errno is set to EINVAL\&. .SS "int hwloc_get_membind_nodeset (\fBhwloc_topology_t\fPtopology, \fBhwloc_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fP *policy, intflags)" .PP Query the default memory binding policy and physical locality of the current process or thread\&. This function has two output parameters: \fCnodeset\fP and \fCpolicy\fP\&. The values returned in these parameters depend on both the \fCflags\fP passed in and the current memory binding policies and nodesets in the queried target\&. .PP 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\&. .PP 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\&. .PP \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 EXDEV\&. If they are identical, the values are returned in \fCnodeset\fP and \fCpolicy\fP\&. .PP Otherwise, if \fBHWLOC_MEMBIND_PROCESS\fP is specified (and \fBHWLOC_MEMBIND_STRICT\fP is \fInot\fP specified), \fCnodeset\fP is set to the logical OR of all threads' default nodeset\&. If all threads' default policies are the same, \fCpolicy\fP is set to that policy\&. If they are different, \fCpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&. .PP 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 nodeset and policy; they are returned in \fCnodeset\fP and \fCpolicy\fP, respectively\&. .PP If any other flags are specified, -1 is returned and errno is set to EINVAL\&. .SS "int hwloc_get_proc_membind (\fBhwloc_topology_t\fPtopology, hwloc_pid_tpid, \fBhwloc_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fP *policy, intflags)" .PP Query the default memory binding policy and physical locality of the specified process (the locality is returned in \fCcpuset\fP as CPUs near the locality's actual NUMA node(s))\&. This function has two output parameters: \fCcpuset\fP and \fCpolicy\fP\&. The values returned in these parameters depend on both the \fCflags\fP passed in and the current memory binding policies and nodesets in the queried target\&. .PP 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\&. .PP Note that it does not make sense to pass \fBHWLOC_MEMBIND_THREAD\fP to this function\&. .PP 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 EXDEV\&. If they are identical, the policy is returned in \fCpolicy\fP\&. \fCcpuset\fP is set to the union of CPUs near the NUMA node(s) in the nodeset\&. .PP Otherwise, the default nodeset from each thread is logically OR'ed together\&. \fCcpuset\fP is set to the union of CPUs near the NUMA node(s) in the resulting nodeset\&. If all threads' default policies are the same, \fCpolicy\fP is set to that policy\&. If they are different, \fCpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&. .PP If any other flags are specified, -1 is returned and errno is set to EINVAL\&. .PP \fBNote:\fP .RS 4 \fChwloc_pid_t\fP is \fCpid_t\fP on Unix platforms, and \fCHANDLE\fP on native Windows platforms\&. .RE .PP .SS "int hwloc_get_proc_membind_nodeset (\fBhwloc_topology_t\fPtopology, hwloc_pid_tpid, \fBhwloc_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fP *policy, intflags)" .PP Query the default memory binding policy and physical locality of the specified process\&. This function has two output parameters: \fCnodeset\fP and \fCpolicy\fP\&. The values returned in these parameters depend on both the \fCflags\fP passed in and the current memory binding policies and nodesets in the queried target\&. .PP 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\&. .PP Note that it does not make sense to pass \fBHWLOC_MEMBIND_THREAD\fP to this function\&. .PP 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 EXDEV\&. If they are identical, the values are returned in \fCnodeset\fP and \fCpolicy\fP\&. .PP Otherwise, \fCnodeset\fP is set to the logical OR of all threads' default nodeset\&. If all threads' default policies are the same, \fCpolicy\fP is set to that policy\&. If they are different, \fCpolicy\fP is set to \fBHWLOC_MEMBIND_MIXED\fP\&. .PP If any other flags are specified, -1 is returned and errno is set to EINVAL\&. .PP \fBNote:\fP .RS 4 \fChwloc_pid_t\fP is \fCpid_t\fP on Unix platforms, and \fCHANDLE\fP on native Windows platforms\&. .RE .PP .SS "int hwloc_set_area_membind (\fBhwloc_topology_t\fPtopology, const void *addr, size_tlen, \fBhwloc_const_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) near physical \fCcpuset\fP\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS if the action is not supported .PP -1 with errno set to EXDEV if the binding cannot be enforced .RE .PP .SS "int hwloc_set_area_membind_nodeset (\fBhwloc_topology_t\fPtopology, const void *addr, size_tlen, \fBhwloc_const_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) in physical \fCnodeset\fP\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS if the action is not supported .PP -1 with errno set to EXDEV if the binding cannot be enforced .RE .PP .SS "int hwloc_set_membind (\fBhwloc_topology_t\fPtopology, \fBhwloc_const_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) near the specified physical \fCcpuset\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\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS if the action is not supported .PP -1 with errno set to EXDEV if the binding cannot be enforced .RE .PP .SS "int hwloc_set_membind_nodeset (\fBhwloc_topology_t\fPtopology, \fBhwloc_const_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) specified by physical \fCnodeset\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\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS if the action is not supported .PP -1 with errno set to EXDEV if the binding cannot be enforced .RE .PP .SS "int hwloc_set_proc_membind (\fBhwloc_topology_t\fPtopology, hwloc_pid_tpid, \fBhwloc_const_cpuset_t\fPcpuset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Set the default memory binding policy of the specified process to prefer the NUMA node(s) near the specified physical \fCcpuset\fP\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS if the action is not supported .PP -1 with errno set to EXDEV if the binding cannot be enforced .RE .PP \fBNote:\fP .RS 4 \fChwloc_pid_t\fP is \fCpid_t\fP on Unix platforms, and \fCHANDLE\fP on native Windows platforms\&. .RE .PP .SS "int hwloc_set_proc_membind_nodeset (\fBhwloc_topology_t\fPtopology, hwloc_pid_tpid, \fBhwloc_const_nodeset_t\fPnodeset, \fBhwloc_membind_policy_t\fPpolicy, intflags)" .PP Set the default memory binding policy of the specified process to prefer the NUMA node(s) specified by physical \fCnodeset\fP\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS if the action is not supported .PP -1 with errno set to EXDEV if the binding cannot be enforced .RE .PP \fBNote:\fP .RS 4 \fChwloc_pid_t\fP is \fCpid_t\fP on Unix platforms, and \fCHANDLE\fP on native Windows platforms\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.