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/106894] [13 regression] multiple libgomp failures after r13-2545-g9f2fca56593a2b
Date: Fri, 09 Sep 2022 14:55:21 +0000	[thread overview]
Message-ID: <bug-106894-4-eyJ1YjM7u4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106894-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106894

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ah, sorry about icv-6.c, I did debug just one of the testcases and after fixing
it tested all the mentioned tests and all passed, so thought it is fixed.
I can now reproduce it though.
The thing is,
make check
or
make check RUNTESTFLAGS="c.exp='icv-6.c' c++.exp='icv-6.c'"
in libgomp obj dir work fine, but
make -j32 -k check RUNTESTFLAGS="c.exp='icv-6.c' c++.exp='icv-6.c'"
fails.
The thing is that the testcase as written relies on OMP_NUM_THREADS not being
set in environment (as it takes priority over OMP_NUM_THREADS_ALL for the
host).
So, if either a user has OMP_NUM_THREADS=42 in the environment by himself, or
when doing make check with -jN, we trigger:
          if test $$num_cpus -gt 8 && test -z "$$OMP_NUM_THREADS"; then \
            OMP_NUM_THREADS=8; export OMP_NUM_THREADS; \
            echo @@@ libgomp OMP_NUM_THREADS adjusted to 8 because of parallel
make check and too many CPUs; \
          fi; \
in libgomp/testsuite/Makefile.am and so the test fails.

So, I think we need something like:
--- libgomp/testsuite/libgomp.c-c++-common/icv-6.c.jj   2022-09-08
20:22:07.903182970 +0200
+++ libgomp/testsuite/libgomp.c-c++-common/icv-6.c      2022-09-09
16:49:29.442195701 +0200
@@ -17,6 +17,7 @@

 #include <omp.h>
 #include <stdlib.h>
+#include <string.h>

 int
 main ()
@@ -25,21 +26,28 @@ main ()
   int chunk_size;
   omp_get_schedule(&kind, &chunk_size);

-  if (omp_get_max_teams () != 42
-      || !omp_get_dynamic ()
-      || kind != 3 || chunk_size != 4
-      || omp_get_teams_thread_limit () != 44
-      || omp_get_thread_limit () != 45
-      || omp_get_max_threads () != 46
-      || omp_get_proc_bind () != omp_proc_bind_spread
-      || omp_get_max_active_levels () != 47)
+  if ((!getenv ("OMP_NUM_TEAMS") && omp_get_max_teams () != 42)
+      || (!getenv ("OMP_DYNAMIC") && !omp_get_dynamic ())
+      || (!getenv ("OMP_SCHEDULE") && (kind != 3 || chunk_size != 4))
+      || (!getenv ("OMP_TEAMS_THREAD_LIMIT") && omp_get_teams_thread_limit ()
!= 44)
+      || (!getenv ("OMP_THREAD_LIMIT") && omp_get_thread_limit () != 45)
+      || (!getenv ("OMP_NUM_THREADS") && omp_get_max_threads () != 46)
+      || (!getenv ("OMP_PROC_BIND") && omp_get_proc_bind () !=
omp_proc_bind_spread)
+      || (!getenv ("OMP_MAX_ACTIVE_LEVELS") && omp_get_max_active_levels () !=
47))
     abort ();

   int num_devices = omp_get_num_devices () > 3 ? 3 : omp_get_num_devices ();
-  for (int i=0; i < num_devices; i++)
+  for (int i = 0; i < num_devices; i++)
+    {
+      char name[sizeof ("OMP_NUM_TEAMS_DEV_0")];
+      strcpy (name, "OMP_NUM_TEAMS_DEV_0");
+      name[sizeof ("OMP_NUM_TEAMS_DEV_0") - 2] = '0' + i;
+      if (getenv (name))
+       continue;
     #pragma omp target device (i)
       if (omp_get_max_teams () != 43)
        abort ();
+    }

   return 0;
 }
or if we say users are on their own if they make check with any OMP_*
environment variables,
then at least do that for OMP_NUM_THREADS because we set it ourselves.

  parent reply	other threads:[~2022-09-09 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 22:48 [Bug libgomp/106894] New: " seurer at gcc dot gnu.org
2022-09-09  7:41 ` [Bug libgomp/106894] " rguenth at gcc dot gnu.org
2022-09-09 11:34 ` jakub at gcc dot gnu.org
2022-09-09 11:47 ` cvs-commit at gcc dot gnu.org
2022-09-09 11:51 ` jakub at gcc dot gnu.org
2022-09-09 12:45 ` marcel at codesourcery dot com
2022-09-09 14:55 ` jakub at gcc dot gnu.org [this message]
2022-09-09 14:55 ` jakub at gcc dot gnu.org
2022-09-12  8:49 ` cvs-commit at gcc dot gnu.org
2022-09-12  9:14 ` jakub at gcc dot gnu.org

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-106894-4-eyJ1YjM7u4@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: 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).