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: 2242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp413002wrs; Thu, 13 Oct 2022 11:12:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MGOQUCwUemdGMZzQ6ury3sx15S+VPsWc+uWW0rDsMLesN9SAttZ0WD8jBDst1uOuQJnPg X-Received: by 2002:aa7:c6c1:0:b0:459:4591:f42f with SMTP id b1-20020aa7c6c1000000b004594591f42fmr884845eds.318.1665684727056; Thu, 13 Oct 2022 11:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665684727; cv=none; d=google.com; s=arc-20160816; b=FzADJd4QUGw1g6CQ3FW1OwE0WfhnLhuXqOP2PxonBEdE/Lnx5SWjw94gIedq5RKctl t7CiNulcKrqG1s2Za8qDadl2rK8U5BE6N7aQ1DZofzLkA1V2NOj1eu77Fd2UQ5xNYZ6/ U4Z2eLUsxecio71VqIqheOcLzdTZsq8GUn68NzxwHhiuW/icEEn2zD57u11/yRv7vtvj f6OTWvzjgWiF7/DkQft5qgoG07+t7Fx+2ov8U1JA88hDL3lV7IdUaI2pyBV0DmLxFm21 kpIZegcOCFHFhI208XW3yL8dbrkST2uiPcKxs1IgThbENONHzhJZSmLLMZwyZsNtXPZR 3elA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:delivered-to; bh=btXboEnrI0y0iJ9PMcneDJ3s8iyNxQ6GudMQC1PGvGY=; b=PYLT4lrOBSY8yXZI41Rg6duIsvVG1riBEUu37FTrZfmkmoeQT9CWJQCTnq3kAHY/Ay rmKAysUEDijtYjQ0ui9ZrrxhPxT6r6/S0y+jYzf6q0Qqw6wEW13+7eDA91sXHNIhWEmc GzhsSj9VQQ+47T0uwX0p8W41MLgXAYdNJVlRNSmZk79n/4DgbxLwt/j71T599fPsodyU g6AQPEJflEp/HGrv2ni5Ws+G81QXJ24cST34N0u39w/d52cyH5PHkdtwz76b/QsPw2Hm L13mzKZn2GHp8cJTS+uoZ82GM06zkfOqHsrl2LZgNcgkogRkZoMvj6Xkftt/gsmI3IHb p1QQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id jg16-20020a170907971000b0078dcd30bc94si366568ejc.529.2022.10.13.11.12.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D2AC3853839 for ; Thu, 13 Oct 2022 18:11:56 +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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746597028163785999?= X-GMAIL-MSGID: =?utf-8?q?1746597028163785999?= 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