public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] openmp: Add testsuite coverage for omp_{get_max, set_num}_threads and omp_{s, g}et_teams_thread_limit
@ 2021-10-12 8:06 Tobias Burnus
0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2021-10-12 8:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:040ad3cba6ec27a3bcfc6e32ed7dca336055fcc2
commit 040ad3cba6ec27a3bcfc6e32ed7dca336055fcc2
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Oct 12 09:50:29 2021 +0200
openmp: Add testsuite coverage for omp_{get_max,set_num}_threads and omp_{s,g}et_teams_thread_limit
This adds (C/C++ only) testsuite coverage for these new OpenMP 5.1 APIs.
2021-10-12 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.c-c++-common/icv-3.c: New test.
* testsuite/libgomp.c-c++-common/icv-4.c: New test.
(cherry picked from commit 88f5ad524a152711b7345b6bee2e06c5af0e88bc)
Diff:
---
libgomp/ChangeLog.omp | 8 ++++
libgomp/testsuite/libgomp.c-c++-common/icv-3.c | 54 ++++++++++++++++++++++++++
libgomp/testsuite/libgomp.c-c++-common/icv-4.c | 40 +++++++++++++++++++
3 files changed, 102 insertions(+)
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 829acfa2204..77c813ae0bd 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2021-10-12 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from master:
+ 2021-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.c-c++-common/icv-3.c: New test.
+ * testsuite/libgomp.c-c++-common/icv-4.c: New test.
+
2021-10-12 Tobias Burnus <tobias@codesourcery.com>
Backported from master:
diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-3.c b/libgomp/testsuite/libgomp.c-c++-common/icv-3.c
new file mode 100644
index 00000000000..54cbf99b597
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/icv-3.c
@@ -0,0 +1,54 @@
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ if (getenv ("OMP_NUM_TEAMS") == NULL
+ && omp_get_max_teams () != 0)
+ abort ();
+ omp_set_num_teams (7);
+ if (omp_get_max_teams () != 7)
+ abort ();
+ if (getenv ("OMP_TEAMS_THREAD_LIMIT") == NULL
+ && omp_get_teams_thread_limit () != 0)
+ abort ();
+ omp_set_teams_thread_limit (15);
+ if (omp_get_teams_thread_limit () != 15)
+ abort ();
+ #pragma omp teams
+ {
+ if (omp_get_max_teams () != 7
+ || omp_get_teams_thread_limit () != 15
+ || omp_get_num_teams () < 1
+ || omp_get_num_teams () > 7
+ || omp_get_team_num () < 0
+ || omp_get_team_num () >= omp_get_num_teams ()
+ || omp_get_thread_limit () < 1
+ || omp_get_thread_limit () > 15)
+ abort ();
+ }
+ #pragma omp teams num_teams(5) thread_limit (13)
+ {
+ if (omp_get_max_teams () != 7
+ || omp_get_teams_thread_limit () != 15
+ || omp_get_num_teams () != 5
+ || omp_get_team_num () < 0
+ || omp_get_team_num () >= omp_get_num_teams ()
+ || omp_get_thread_limit () < 1
+ || omp_get_thread_limit () > 13)
+ abort ();
+ }
+ #pragma omp teams num_teams(8) thread_limit (16)
+ {
+ if (omp_get_max_teams () != 7
+ || omp_get_teams_thread_limit () != 15
+ || omp_get_num_teams () != 8
+ || omp_get_team_num () < 0
+ || omp_get_team_num () >= omp_get_num_teams ()
+ || omp_get_thread_limit () < 1
+ || omp_get_thread_limit () > 16)
+ abort ();
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-4.c b/libgomp/testsuite/libgomp.c-c++-common/icv-4.c
new file mode 100644
index 00000000000..6cb671d8ac7
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/icv-4.c
@@ -0,0 +1,40 @@
+/* { dg-set-target-env-var OMP_NUM_TEAMS "6" } */
+/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT "12" } */
+
+#include <omp.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+ if (getenv ("OMP_NUM_TEAMS") != NULL
+ && strcmp (getenv ("OMP_NUM_TEAMS"), "6") == 0)
+ {
+ if (omp_get_max_teams () != 6)
+ abort ();
+ }
+ else
+ omp_set_num_teams (6);
+ if (getenv ("OMP_TEAMS_THREAD_LIMIT") == NULL
+ && strcmp (getenv ("OMP_TEAMS_THREAD_LIMIT"), "12") == 0)
+ {
+ if (omp_get_teams_thread_limit () != 12)
+ abort ();
+ }
+ else
+ omp_set_teams_thread_limit (12);
+ #pragma omp teams
+ {
+ if (omp_get_max_teams () != 6
+ || omp_get_teams_thread_limit () != 12
+ || omp_get_num_teams () < 1
+ || omp_get_num_teams () > 6
+ || omp_get_team_num () < 0
+ || omp_get_team_num () >= omp_get_num_teams ()
+ || omp_get_thread_limit () < 1
+ || omp_get_thread_limit () > 12)
+ abort ();
+ }
+ return 0;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-12 8:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 8:06 [gcc/devel/omp/gcc-11] openmp: Add testsuite coverage for omp_{get_max, set_num}_threads and omp_{s, g}et_teams_thread_limit Tobias Burnus
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).