libgomp: GOMP_CPU_AFFINITY
1
1 3.15 'GOMP_CPU_AFFINITY' - Bind threads to specific CPUs
1 ========================================================
1
1 _Description_:
1 Binds threads to specific CPUs. The variable should contain a
1 space-separated or comma-separated list of CPUs. This list may
1 contain different kinds of entries: either single CPU numbers in
1 any order, a range of CPUs (M-N) or a range with some stride
1 (M-N:S). CPU numbers are zero based. For example,
1 'GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"' will bind the initial thread
1 to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to
1 CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8,
1 10, 12, and 14 respectively and then start assigning back from the
1 beginning of the list. 'GOMP_CPU_AFFINITY=0' binds all threads to
1 CPU 0.
1
1 There is no libgomp library routine to determine whether a CPU
1 affinity specification is in effect. As a workaround,
1 language-specific library functions, e.g., 'getenv' in C or
1 'GET_ENVIRONMENT_VARIABLE' in Fortran, may be used to query the
1 setting of the 'GOMP_CPU_AFFINITY' environment variable. A defined
1 CPU affinity on startup cannot be changed or disabled during the
1 runtime of the application.
1
1 If both 'GOMP_CPU_AFFINITY' and 'OMP_PROC_BIND' are set,
1 'OMP_PROC_BIND' has a higher precedence. If neither has been set
1 and 'OMP_PROC_BIND' is unset, or when 'OMP_PROC_BIND' is set to
1 'FALSE', the host system will handle the assignment of threads to
1 CPUs.
1
1 _See also_:
1 ⇒OMP_PLACES, ⇒OMP_PROC_BIND
1