public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* [OpenMP] 40% slow down when setting OMP_PLACES="sockets"
@ 2021-01-04 21:28 nu quaquaraqua
  2021-01-04 21:58 ` nu quaquaraqua
  0 siblings, 1 reply; 3+ messages in thread
From: nu quaquaraqua @ 2021-01-04 21:28 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OpenMP] 40% slow down when setting OMP_PLACES="sockets"
  2021-01-04 21:28 [OpenMP] 40% slow down when setting OMP_PLACES="sockets" nu quaquaraqua
@ 2021-01-04 21:58 ` nu quaquaraqua
  2021-01-04 22:08   ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: nu quaquaraqua @ 2021-01-04 21:58 UTC (permalink / raw)
  To: gcc-help

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OpenMP] 40% slow down when setting OMP_PLACES="sockets"
  2021-01-04 21:58 ` nu quaquaraqua
@ 2021-01-04 22:08   ` Florian Weimer
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2021-01-04 22:08 UTC (permalink / raw)
  To: nu quaquaraqua via Gcc-help

* nu quaquaraqua via Gcc-help:

> 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.

Why do you think that?  Clang doesn't ignore it (at least not for GNU
targets such as Fedora).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-04 22:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 21:28 [OpenMP] 40% slow down when setting OMP_PLACES="sockets" nu quaquaraqua
2021-01-04 21:58 ` nu quaquaraqua
2021-01-04 22:08   ` Florian Weimer

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).