forked from sandialabs/qthreads
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.affinity
28 lines (23 loc) · 1.55 KB
/
README.affinity
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
CPU affinity is on by default, but depends on the available affinity and
topology libraries. Essentially, the more information available about the
machine, the better decisions can be made about affinity.
The best-supported library is hwloc, which provides a full set of topology
querying and thread- and memory-pinning functions on the widest variety of
platforms, including Linux, BSD, HP-UX, and more. When using hwloc, the default
arrangement is to pin each worker thread to a PU (the lowest level
computational processing unit), and to group them (for the Sherwood scheduler)
by the top-level cache.
Binders is a low level affinity layer for precise control over where workers and
shepherds are allocated. It is implemented as a colon-seperated list of
cpustrings, where each cpustring is a shepherd. It is controlled by the
environment variable QT_CPUBIND. See src/affinity/README.binders for more details.
Failing that, other APIs are also supported, but since they provide less
information, they're used primarily for querying the number of cores and
pinning worker threads to them in a round-robin fashion (libnuma also supports
pinning memory).
Unless such an affinity library is available, worker threads are NOT pinned,
especially on Linux. Unfortunately, the usual sched_setaffinity() function that
Linux provides is not portable, and the differences in arguments across
different versions of Linux are difficult to detect.
There are several environment variables that can be used to control CPU
affinity and parallelism. See the qthread_initialize() man page for details.