https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102320
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That is just a wrong expectation. GOMP_CPU_AFFINITY is IMHO clearly documented what it does: Binds threads to specific CPUs. The variable should contain a space-separated or comma-separated list of CPUs. This list may contain different kinds of entries: either single CPU numbers in any order, a range of CPUs (M-N) or a range with some stride (M-N:S). CPU numbers are zero based. For example, @code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} will bind the initial thread to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12, and 14 respectively and then start assigning back from the beginning of the list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0. So, if you use 0-7, the first thread (initial thread) goes to cpu 0, second to 1, etc. up to 7 and then again from the beginning of the list. If you want something else, you can use the standard OMP_PLACES variable, which allows you to define a place as having a set of CPUs and then bind threads to selected places.