public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/102320] Set cpu affinity error Date: Tue, 14 Sep 2021 12:32:19 +0000 [thread overview] Message-ID: <bug-102320-4-C0UNAMNtAI@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102320-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2021-09-14 12:32 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-14 9:22 [Bug libgomp/102320] New: " zhuguanghong at uniontech dot com 2021-09-14 12:05 ` [Bug libgomp/102320] " zhuguanghong at uniontech dot com 2021-09-14 12:10 ` jakub at gcc dot gnu.org 2021-09-14 12:16 ` zhuguanghong at uniontech dot com 2021-09-14 12:19 ` zhuguanghong at uniontech dot com 2021-09-14 12:20 ` zhuguanghong at uniontech dot com 2021-09-14 12:32 ` jakub at gcc dot gnu.org [this message] 2021-09-14 12:35 ` zhuguanghong at uniontech dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-102320-4-C0UNAMNtAI@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).