Hardware Locality (hwloc) 1.2
|
Enumerations | |
enum | hwloc_cpubind_flags_t { HWLOC_CPUBIND_PROCESS, HWLOC_CPUBIND_THREAD, HWLOC_CPUBIND_STRICT, HWLOC_CPUBIND_NOMEMBIND } |
Functions | |
int | hwloc_set_cpubind (hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags) |
int | hwloc_get_cpubind (hwloc_topology_t topology, hwloc_cpuset_t set, int flags) |
int | hwloc_set_proc_cpubind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_cpuset_t set, int flags) |
int | hwloc_get_proc_cpubind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags) |
int | hwloc_set_thread_cpubind (hwloc_topology_t topology, hwloc_thread_t tid, hwloc_const_cpuset_t set, int flags) |
int | hwloc_get_thread_cpubind (hwloc_topology_t topology, hwloc_thread_t tid, hwloc_cpuset_t set, int flags) |
int | hwloc_get_last_cpu_location (hwloc_topology_t topology, hwloc_cpuset_t set, int flags) |
int | hwloc_get_proc_last_cpu_location (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags) |
It is often useful to call hwloc_bitmap_singlify() first so that a single CPU remains in the set. This way, the process will not even migrate between different CPUs. Some operating systems also only support that kind of binding.
The most portable version that should be preferred over the others, whenever possible, is
hwloc_set_cpubind(topology, set, 0),
as it just binds the current program, assuming it is single-threaded, or
hwloc_set_cpubind(topology, set, HWLOC_CPUBIND_THREAD),
which binds the current thread of the current program (which may be multithreaded).
Process/Thread binding flags.
These bit flags can be used to refine the binding policy.
The default (0) is to bind the current process, assumed to be single-threaded, in a non-strict way. This is the most portable way to bind as all operating systems usually provide it.
int hwloc_get_cpubind | ( | hwloc_topology_t | topology, |
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get current process or thread binding.
int hwloc_get_last_cpu_location | ( | hwloc_topology_t | topology, |
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the last CPU where the current process or thread ran.
The operating system may move some tasks from one processor to another at any time according to their binding, so this function may return something that is already outdated.
int hwloc_get_proc_cpubind | ( | hwloc_topology_t | topology, |
hwloc_pid_t | pid, | ||
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the current binding of process pid
.
flags
. int hwloc_get_proc_last_cpu_location | ( | hwloc_topology_t | topology, |
hwloc_pid_t | pid, | ||
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the last CPU where a process ran.
The operating system may move some tasks from one processor to another at any time according to their binding, so this function may return something that is already outdated.
flags
. int hwloc_get_thread_cpubind | ( | hwloc_topology_t | topology, |
hwloc_thread_t | tid, | ||
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the current binding of thread tid
.
flags
. int hwloc_set_cpubind | ( | hwloc_topology_t | topology, |
hwloc_const_cpuset_t | set, | ||
int | flags | ||
) |
Bind current process or thread on cpus given in bitmap set
.
int hwloc_set_proc_cpubind | ( | hwloc_topology_t | topology, |
hwloc_pid_t | pid, | ||
hwloc_const_cpuset_t | set, | ||
int | flags | ||
) |
Bind a process pid
on cpus given in bitmap set
.
flags
. int hwloc_set_thread_cpubind | ( | hwloc_topology_t | topology, |
hwloc_thread_t | tid, | ||
hwloc_const_cpuset_t | set, | ||
int | flags | ||
) |
Bind a thread tid
on cpus given in bitmap set
.
flags
.