From patchwork Thu Oct 13 18:10:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1689673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MpHfB2hKlz23k6 for ; Fri, 14 Oct 2022 05:11:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C10C83857B88 for ; Thu, 13 Oct 2022 18:11:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 787AE3858C55 for ; Thu, 13 Oct 2022 18:11:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 787AE3858C55 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.95,182,1661846400"; d="diff'?scan'208";a="87477696" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 13 Oct 2022 10:11:25 -0800 IronPort-SDR: 0tI2AN5nfMnRRjmbs/fVb0ULurQi+1AFLliH3qXzIJxMZPU2wIgSz8OcTWSMJpxZ1t4sgeZ8kS fbi6Q1rYzTHqAYlXRIDY5invgUeeYLpH67d2W5+9NoRK57mYPeio4dx67pSmg3dZ7xHC08xqqD WsQcNg7L/d0gXm5650qHWrTJTma8xoMGxwIGuGriHyp5hTsjeqIepVQUk8Hwhm4DtA9YOznfTq xD6T2l4FcZo6nIa/IFLqGlR1O0HgcZQy2N/w3CHprn47F4m+eCUQv7D6wXcoS6QJtqzSAEWD2e Iaw= Message-ID: Date: Thu, 13 Oct 2022 20:10:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Content-Language: en-US To: gcc-patches , Jakub Jelinek From: Tobias Burnus Subject: [Patch] libgomp: Add Fortran testcases for omp_in_explicit_task X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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. 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