public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] libgomp: Add Fortran testcases for omp_in_explicit_task
@ 2022-10-13 18:10 Tobias Burnus
  2022-10-13 18:22 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2022-10-13 18:10 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

Rather obvious patch as it is a straight conversion from C.

OK for mainline?

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Attachment #2: omp-task-in-explicit-fortran.diff --]
[-- Type: text/x-patch, Size: 8329 bytes --]

libgomp: Add Fortran testcases for omp_in_explicit_task

Fortranized testcases of commits r13-3257-ga58a965eb73
and r13-3258-g0ec4e93fb9f.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/task-7.f90: New test.
	* testsuite/libgomp.fortran/task-8.f90: New test.
	* testsuite/libgomp.fortran/task-in-explicit-1.f90: New test.
	* testsuite/libgomp.fortran/task-in-explicit-2.f90: New test.
	* testsuite/libgomp.fortran/task-in-explicit-3.f90: New test.
	* testsuite/libgomp.fortran/task-reduction-17.f90: New test.
	* testsuite/libgomp.fortran/task-reduction-18.f90: New test.

 libgomp/testsuite/libgomp.fortran/task-7.f90       |  22 ++++
 libgomp/testsuite/libgomp.fortran/task-8.f90       |  13 +++
 .../libgomp.fortran/task-in-explicit-1.f90         | 113 +++++++++++++++++++++
 .../libgomp.fortran/task-in-explicit-2.f90         |  21 ++++
 .../libgomp.fortran/task-in-explicit-3.f90         |  31 ++++++
 .../libgomp.fortran/task-reduction-17.f90          |  32 ++++++
 .../libgomp.fortran/task-reduction-18.f90          |  15 +++
 7 files changed, 247 insertions(+)

diff --git a/libgomp/testsuite/libgomp.fortran/task-7.f90 b/libgomp/testsuite/libgomp.fortran/task-7.f90
new file mode 100644
index 00000000000..e806bd79663
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-7.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+
+program main
+  use omp_lib
+  implicit none
+
+  !$omp task final (.true.)
+    if (.not. omp_in_final ()) &
+      error stop
+    !$omp task
+      if (.not. omp_in_final ()) &
+        error stop
+      !$omp target nowait
+      if (omp_in_final ()) &
+        error stop
+      !$omp end target
+      if (.not. omp_in_final ()) &
+        error stop
+      !$omp taskwait
+    !$omp end task
+  !$omp end task
+end
diff --git a/libgomp/testsuite/libgomp.fortran/task-8.f90 b/libgomp/testsuite/libgomp.fortran/task-8.f90
new file mode 100644
index 00000000000..037c63b8fa3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-8.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+
+program main
+  implicit none
+  integer :: i
+  i = 0
+  !$omp task
+    !$omp target nowait private (i)
+      i = 1
+    !$omp end target
+    !$omp taskwait
+  !$omp end task
+end
diff --git a/libgomp/testsuite/libgomp.fortran/task-in-explicit-1.f90 b/libgomp/testsuite/libgomp.fortran/task-in-explicit-1.f90
new file mode 100644
index 00000000000..b6fa21b2c22
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-in-explicit-1.f90
@@ -0,0 +1,113 @@
+! { dg-do run }
+
+program main
+  use omp_lib
+  implicit none
+  integer :: i
+
+  if (omp_in_explicit_task ()) &
+    error stop
+  !$omp task
+  if (.not. omp_in_explicit_task ()) &
+    error stop
+  !$omp end task
+
+  !$omp task final (.true.)
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp task
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp end task
+  !$omp end task
+
+  !$omp parallel
+    if (omp_in_explicit_task ()) &
+      error stop
+    !$omp task if (.false.)
+        if (.not. omp_in_explicit_task ()) &
+          error stop
+        !$omp task if (.false.)
+          if (.not. omp_in_explicit_task ()) &
+            error stop
+        !$omp end task
+    !$omp end task
+    !$omp task final (.true.)
+      if (.not. omp_in_explicit_task ()) &
+        error stop
+    !$omp end task
+    !$omp barrier
+    if (omp_in_explicit_task ()) &
+      error stop
+    !$omp taskloop num_tasks (24)
+    do i = 1, 32
+      if (.not. omp_in_explicit_task ()) &
+        error stop
+    end do
+    !$omp masked
+    !$omp task
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp end task
+    !$omp end masked
+    !$omp barrier
+    if (omp_in_explicit_task ()) &
+      error stop
+  !$omp end parallel
+
+  !$omp target
+    if (omp_in_explicit_task ()) &
+      error stop
+    !$omp task if (.false.)
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp end task
+    !$omp task
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp end task
+  !$omp end target
+
+  !$omp target teams
+    !$omp distribute
+    do i = 1, 4
+      if (omp_in_explicit_task ()) then
+        error stop
+      else
+          !$omp parallel
+            if (omp_in_explicit_task ()) &
+              error stop
+            !$omp task
+            if (.not. omp_in_explicit_task ()) &
+              error stop
+            !$omp end task
+            !$omp barrier
+            if (omp_in_explicit_task ()) &
+              error stop
+          !$omp end parallel
+      end if
+    end do
+  !$omp end target teams
+
+  !$omp teams
+    !$omp distribute
+    do i = 1, 4
+      if (omp_in_explicit_task ()) then
+        error stop
+      else
+          !$omp parallel
+            if (omp_in_explicit_task ()) &
+              error stop
+            !$omp task
+            if (.not. omp_in_explicit_task ()) &
+              error stop
+            !$omp end task
+            !$omp barrier
+            if (omp_in_explicit_task ()) &
+              error stop
+          !$omp end parallel
+      end if
+    end do
+    !$omp end distribute
+  !$omp end teams
+end
diff --git a/libgomp/testsuite/libgomp.fortran/task-in-explicit-2.f90 b/libgomp/testsuite/libgomp.fortran/task-in-explicit-2.f90
new file mode 100644
index 00000000000..c615ff62dae
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-in-explicit-2.f90
@@ -0,0 +1,21 @@
+! { dg-do run }
+
+program main
+  use omp_lib
+  implicit none
+  !$omp task
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp task
+      if (.not. omp_in_explicit_task ()) &
+        error stop
+      !$omp target nowait
+        if (omp_in_explicit_task ()) &
+          error stop
+      !$omp end target
+      if (.not. omp_in_explicit_task ()) &
+        error stop
+      !$omp taskwait
+    !$omp end task
+  !$omp end task
+end
diff --git a/libgomp/testsuite/libgomp.fortran/task-in-explicit-3.f90 b/libgomp/testsuite/libgomp.fortran/task-in-explicit-3.f90
new file mode 100644
index 00000000000..629c5676c05
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-in-explicit-3.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+
+module m
+  integer :: a
+end module m
+
+program main
+  use omp_lib
+  use m
+  implicit none
+  !$omp task
+    if (.not. omp_in_explicit_task ()) &
+      error stop
+    !$omp task
+      if (.not. omp_in_explicit_task ()) &
+        error stop
+      !$omp taskgroup task_reduction (+: a)
+        if (.not. omp_in_explicit_task ()) &
+          error stop
+	!$omp task in_reduction (+: a)
+          a = a + 1
+          if (.not. omp_in_explicit_task ()) &
+            error stop
+	!$omp end task
+      !$omp end taskgroup
+      if (.not. omp_in_explicit_task ()) &
+        error stop
+      !$omp taskwait
+    !$omp end task
+  !$omp end task
+end
diff --git a/libgomp/testsuite/libgomp.fortran/task-reduction-17.f90 b/libgomp/testsuite/libgomp.fortran/task-reduction-17.f90
new file mode 100644
index 00000000000..12a896269d3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-reduction-17.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+
+module m
+  integer a
+end module m
+
+program main
+  use omp_lib
+  use m
+  implicit none
+
+  !$omp task final (.true.)
+    if (.not. omp_in_final ()) &
+      error stop
+    !$omp task
+      if (.not. omp_in_final ()) &
+        error stop
+      !$omp taskgroup task_reduction (+: a)
+        if (.not. omp_in_final ()) &
+          error stop
+        !$omp task in_reduction (+: a)
+          a = a + 1
+          if (.not. omp_in_final ()) &
+            error stop
+        !$omp end task
+      !$omp end taskgroup
+      if (.not. omp_in_final ()) &
+        error stop
+      !$omp taskwait
+    !$omp end task
+  !$omp end task
+end
diff --git a/libgomp/testsuite/libgomp.fortran/task-reduction-18.f90 b/libgomp/testsuite/libgomp.fortran/task-reduction-18.f90
new file mode 100644
index 00000000000..0cbd4718322
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/task-reduction-18.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+
+module m
+  integer :: a = 0
+end module m
+
+program main
+  !$omp task
+    !$omp taskgroup task_reduction (+: a)
+      !$omp task in_reduction (+: a)
+        a = a + 1
+      !$omp end task
+    !$omp end taskgroup
+  !$omp end task
+end

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

* Re: [Patch] libgomp: Add Fortran testcases for omp_in_explicit_task
  2022-10-13 18:10 [Patch] libgomp: Add Fortran testcases for omp_in_explicit_task Tobias Burnus
@ 2022-10-13 18:22 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-10-13 18:22 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc-patches

On Thu, Oct 13, 2022 at 08:10:47PM +0200, Tobias Burnus wrote:
> Rather obvious patch as it is a straight conversion from C.
> 
> OK for mainline?
> 
> Tobias
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

> libgomp: Add Fortran testcases for omp_in_explicit_task
> 
> Fortranized testcases of commits r13-3257-ga58a965eb73
> and r13-3258-g0ec4e93fb9f.
> 
> libgomp/ChangeLog:
> 
> 	* testsuite/libgomp.fortran/task-7.f90: New test.
> 	* testsuite/libgomp.fortran/task-8.f90: New test.
> 	* testsuite/libgomp.fortran/task-in-explicit-1.f90: New test.
> 	* testsuite/libgomp.fortran/task-in-explicit-2.f90: New test.
> 	* testsuite/libgomp.fortran/task-in-explicit-3.f90: New test.
> 	* testsuite/libgomp.fortran/task-reduction-17.f90: New test.
> 	* testsuite/libgomp.fortran/task-reduction-18.f90: New test.

LGTM, thanks.

	Jakub


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

end of thread, other threads:[~2022-10-13 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 18:10 [Patch] libgomp: Add Fortran testcases for omp_in_explicit_task Tobias Burnus
2022-10-13 18:22 ` Jakub Jelinek

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