public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: nu quaquaraqua <nuquaquaraqua@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Re: [OpenMP] 40% slow down when setting OMP_PLACES="sockets"
Date: Mon, 4 Jan 2021 22:58:55 +0100	[thread overview]
Message-ID: <CAM4+LxoHU7DhNbrngABCpPOFXVktG6CvULE=H0_94qRdrzTE=g@mail.gmail.com> (raw)
In-Reply-To: <CAM4+LxrTC0132Us+2vL62OgpyNugxdtOCDdPkwYVo41nJAzSSA@mail.gmail.com>

okay, I think I can already answer myself why Clang is unaffected by this
setting. The environment variables in libgomp are parsed in

static void __attribute__((constructor))
initialize_env (void)

this is attribute is GCC specific and basically ignored by Clang. And
therefore all env. vars for openmp are ignored when linking the library
with Clang, great.

The other issue I suspect it is because these OMP env. vars are mere
wrappers to pthread,  that is, they affect all threads in the program,
rather than only the threads handled by openmp. Again, great.

Yours,
quack

On Mon, 4 Jan 2021 at 22:28, nu quaquaraqua <nuquaquaraqua@gmail.com> wrote:

> Hey there,
> I have a multi-threaded experiment that runs with 60+ logical threads on a
> dual-socket 40-cores-in total machine. When setting the env. var.
> OMP_PLACES="sockets", the experiment is 40% slower. While the program is
> indeed linked with -fopenmp, it does not use it any opemp clause in the
> experiment nor before. Also this seems specific to GCC, as exporting the
> env. var. does not cause any slow down when compiling the program with
> Clang, despite both being linked to the same libgomp.
>
> Can someone explain what it is occurring here?
>
> Linux 5.0.17, Fedora 30, gcc v10.2
>
> Yours,
> quack
>

  reply	other threads:[~2021-01-04 21:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 21:28 nu quaquaraqua
2021-01-04 21:58 ` nu quaquaraqua [this message]
2021-01-04 22:08   ` Florian Weimer

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='CAM4+LxoHU7DhNbrngABCpPOFXVktG6CvULE=H0_94qRdrzTE=g@mail.gmail.com' \
    --to=nuquaquaraqua@gmail.com \
    --cc=gcc-help@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: link
Be 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).