From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id B6D393858281; Mon, 17 Oct 2022 15:02:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6D393858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666018929; bh=8sueA6jMHJRYw9T8k5W0pZrcY021tnGRIN6UVdLTDak=; h=From:To:Subject:Date:From; b=TV22CEizyakAruASD8h4n6BxAp/KWXQ3bgtY2ijT4gVvYmdWuOUxSpeYVJUy+OLVV npbf61RmsC7U9jhj1lwBUHSEaL2zhnbOL/aOXx26NEIaFXV4hTo6LaNIZMOlhlYX49 L0hK1wPxeb7vWXXpMZ+JEMplgw16WYoshvythFm0= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] libgomp: Add Fortran testcases for omp_in_explicit_task X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: 452bb7db311b5a4987558b7fbfc450768a0e167f X-Git-Newrev: fd25efb75770ae6574793761f81767ad5a37a137 Message-Id: <20221017150209.B6D393858281@sourceware.org> Date: Mon, 17 Oct 2022 15:02:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fd25efb75770ae6574793761f81767ad5a37a137 commit fd25efb75770ae6574793761f81767ad5a37a137 Author: Tobias Burnus Date: Mon Oct 17 16:58:21 2022 +0200 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. (cherry picked from commit ab8477af9949a7e6fcaf89c5f1dcf32788accf88) Diff: --- libgomp/ChangeLog.omp | 13 +++ 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 +++ 8 files changed, 260 insertions(+) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index debb77b2150..570aabf82c4 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,16 @@ +2022-10-17 Tobias Burnus + + Backport from mainline: + 2022-10-13 Tobias Burnus + + * 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. + 2022-10-17 Tobias Burnus Backport from mainline: 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