OpenMPI
0.1.1
|
It is often useful to call hwloc_bitmap_singlify() first so that a single CPU remains in the set. More...
Enumerations | |
enum | hwloc_cpubind_flags_t { HWLOC_CPUBIND_PROCESS, HWLOC_CPUBIND_THREAD, HWLOC_CPUBIND_STRICT, HWLOC_CPUBIND_NOMEMBIND } |
Process/Thread binding flags. More... | |
Functions | |
HWLOC_DECLSPEC int | hwloc_set_cpubind (hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags) |
Bind current process or thread on cpus given in physical bitmap set . More... | |
HWLOC_DECLSPEC int | hwloc_get_cpubind (hwloc_topology_t topology, hwloc_cpuset_t set, int flags) |
Get current process or thread binding. More... | |
HWLOC_DECLSPEC 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 physical bitmap set . More... | |
HWLOC_DECLSPEC int | hwloc_get_proc_cpubind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags) |
Get the current physical binding of process pid . More... | |
HWLOC_DECLSPEC int | hwloc_get_last_cpu_location (hwloc_topology_t topology, hwloc_cpuset_t set, int flags) |
Get the last physical CPU where the current process or thread ran. More... | |
HWLOC_DECLSPEC int | hwloc_get_proc_last_cpu_location (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags) |
Get the last physical CPU where a process ran. More... | |
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
as it just binds the current program, assuming it is single-threaded, or
which binds the current thread of the current program (which may be multithreaded).
Running lstopo –top can be a very convenient tool to check how binding actually happened.
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.
Enumerator | |
---|---|
HWLOC_CPUBIND_PROCESS |
Bind all threads of the current (possibly) multithreaded process. |
HWLOC_CPUBIND_THREAD |
Bind current thread of current process. |
HWLOC_CPUBIND_STRICT |
Request for strict binding from the OS. By default, when the designated CPUs are all busy while other CPUs are idle, operating systems may execute the thread/process on those other CPUs instead of the designated CPUs, to let them progress anyway. Strict binding means that the thread/process will never execute on other cpus than the designated CPUs, even when those are busy with other tasks and other CPUs are idle.
When retrieving the binding of a process, this flag checks whether all its threads actually have the same binding. If the flag is not given, the binding of each thread will be accumulated.
|
HWLOC_CPUBIND_NOMEMBIND |
Avoid any effect on memory binding. On some operating systems, some CPU binding function would also bind the memory on the corresponding NUMA node. It is often not a problem for the application, but if it is, setting this flag will make hwloc avoid using OS functions that would also bind memory. This will however reduce the support of CPU bindings, i.e. potentially return -1 with errno set to ENOSYS in some cases. This flag is only meaningful when used with functions that set the CPU binding. It is ignored when used with functions that get CPU binding information. |
HWLOC_DECLSPEC int hwloc_get_cpubind | ( | hwloc_topology_t | topology, |
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get current process or thread binding.
Writes into set
the physical cpuset which the process or thread (according to flags) was last bound to.
References HWLOC_CPUBIND_PROCESS, and HWLOC_CPUBIND_THREAD.
Referenced by ompi_mpi_init().
HWLOC_DECLSPEC int hwloc_get_last_cpu_location | ( | hwloc_topology_t | topology, |
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the last physical 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.
References HWLOC_CPUBIND_PROCESS, and HWLOC_CPUBIND_THREAD.
HWLOC_DECLSPEC int hwloc_get_proc_cpubind | ( | hwloc_topology_t | topology, |
hwloc_pid_t | pid, | ||
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the current physical binding of process pid
.
hwloc_pid_t
is pid_t
on Unix platforms, and HANDLE
on native Windows platforms.flags
.HWLOC_DECLSPEC int hwloc_get_proc_last_cpu_location | ( | hwloc_topology_t | topology, |
hwloc_pid_t | pid, | ||
hwloc_cpuset_t | set, | ||
int | flags | ||
) |
Get the last physical 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.
hwloc_pid_t
is pid_t
on Unix platforms, and HANDLE
on native Windows platforms.flags
.HWLOC_DECLSPEC int hwloc_set_cpubind | ( | hwloc_topology_t | topology, |
hwloc_const_cpuset_t | set, | ||
int | flags | ||
) |
Bind current process or thread on cpus given in physical bitmap set
.
References HWLOC_CPUBIND_PROCESS, and HWLOC_CPUBIND_THREAD.
Referenced by ompi_mpi_init().
HWLOC_DECLSPEC 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 physical bitmap set
.
hwloc_pid_t
is pid_t
on Unix platforms, and HANDLE
on native Windows platforms.flags
.