From patchwork Fri Oct 1 09:34:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 45671 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 502093857C66 for ; Fri, 1 Oct 2021 09:35:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 020143857C5E for ; Fri, 1 Oct 2021 09:34:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 020143857C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 0aQ1Wg9spa46dgKG4Rr0btE4BDr29kq4690phYLUZJZpAJYm0OEuNws5mz5ID5vU0cRbXciroi k7HtehZwgFUYpUItEnrNBSnGDWJm+0o5kELZvEYWvzJpzDxnsbfu/iFRcLaFKXA8QrKD1vTILr 4AYkeUAfpQNEhz6OUX9nndAV8RouBWlvHP9gTQ8+9uwN3+jPkiLR/+gk16wZ6APdOSMRIk6yQd 0I4m23vI/A1SmYN6InAxJY5UujrSVLQJC0oJQuomjfJjVMdX2dZT8tlgnpqCFyooy/YQk7Z55C yQwHWuBzzb3dSmRkcPKyuHHL X-IronPort-AV: E=Sophos;i="5.85,337,1624348800"; d="diff'?scan'208";a="66710321" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 01 Oct 2021 01:34:21 -0800 IronPort-SDR: wOMyErtScUZk5nKMCmL9RtiK4eHAnPHXNVHj6BRgzp/sBoWNzoR4HaEasEXBdR0pCuP1cCSSEe sG06hMlBxHjkgLmCVN2t2Vqlk37hZx+ptCGX/HndCgu+HWo/XXxqVNYn6i0+mm5+VHsdvxGStR Ws26WaOqLCWwOz3M6j7aEavI1EC1tlol4Avn8DlqaZE6v03seCa4RTRHlcUIQFYxxogo1XIxVH /T/H5o54fqvJanG8FD0Me6YKHl03HalQxaA04Yy1RGY8A92Iux7qw8xsqv8H3gHyOnu4DZ/MMb 20U= Subject: [Patch] Add libgomp.fortran/order-reproducible-*.f90 [Re: [committed] openmp: Differentiate between order(concurrent) and order(reproducible:concurrent)] To: Jakub Jelinek , References: <20211001090348.GI304296@tucnak> From: Tobias Burnus Message-ID: <93c9d8dc-aa2d-b5f8-b201-fd8ac69544a5@codesourcery.com> Date: Fri, 1 Oct 2021 11:34:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211001090348.GI304296@tucnak> Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-11.6 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" On 01.10.21 11:03, Jakub Jelinek wrote: > 2021-10-01 Jakub Jelinek > libgomp/ > * testsuite/libgomp.c-c++-common/order-reproducible-1.c: New test. > * testsuite/libgomp.c-c++-common/order-reproducible-2.c: New test. Attached is the Fortran version of the two patches – the Fortran FE modifications were already in Jakub's patch. 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 Add libgomp.fortran/order-reproducible-*.f90 libgomp/ChangeLog: * testsuite/libgomp.fortran/order-reproducible-1.f90: New test based on libgomp.c-c++-common/order-reproducible-1.c. * testsuite/libgomp.fortran/order-reproducible-2.f90: Likewise. .../libgomp.fortran/order-reproducible-1.f90 | 70 ++++++++++++++++++++++ .../libgomp.fortran/order-reproducible-2.f90 | 36 +++++++++++ 2 files changed, 106 insertions(+) diff --git a/libgomp/testsuite/libgomp.fortran/order-reproducible-1.f90 b/libgomp/testsuite/libgomp.fortran/order-reproducible-1.f90 new file mode 100644 index 00000000000..2b852ebc70b --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/order-reproducible-1.f90 @@ -0,0 +1,70 @@ +program main + implicit none + interface + subroutine usleep(t) bind(C, name="my_usleep") + use iso_c_binding + integer(c_int), value :: t + end subroutine + end interface + + integer :: a(128) + integer :: i + + !$omp teams num_teams(5) + !$omp loop bind(teams) + do i = 1, 128 + a(i) = i + if (i == 0) then + call usleep (20) + else if (i == 17) then + call usleep (40) + end if + end do + !$omp loop bind(teams) + do i = 1, 128 + a(i) = a(i) + i + end do + !$omp end teams + do i = 1, 128 + if (a(i) /= 2 * i) & + stop 1 + end do + !$omp teams num_teams(5) + !$omp loop bind(teams) order(concurrent) + do i = 1, 128 + a(i) = a(i) * 2 + if (i == 1) then + call usleep (20) + else if (i == 13) then + call usleep (40) + end if + end do + !$omp loop bind(teams) order(concurrent) + do i = 1, 128 + a(i) = a(i) + i + end do + !$omp end teams + do i = 1, 128 + if (a(i) /= 5 * i) & + stop 2 + end do + !$omp teams num_teams(5) + !$omp loop bind(teams) order(reproducible:concurrent) + do i = 1, 128 + a(i) = a(i) * 2 + if (i == 3) then + call usleep (20) + else if (i == 106) then + call usleep (40) + end if + end do + !$omp loop bind(teams) order(reproducible:concurrent) + do i = 1, 128 + a(i) = a(i) + i + end do + !$omp end teams + do i = 1, 128 + if (a(i) /= 11 * i) & + stop 3 + end do +end program main diff --git a/libgomp/testsuite/libgomp.fortran/order-reproducible-2.f90 b/libgomp/testsuite/libgomp.fortran/order-reproducible-2.f90 new file mode 100644 index 00000000000..af18c82f700 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/order-reproducible-2.f90 @@ -0,0 +1,36 @@ +! { dg-additional-sources my-usleep.c } +program main + implicit none + interface + subroutine usleep(t) bind(C, name="my_usleep") + use iso_c_binding + integer(c_int), value :: t + end subroutine + end interface + + integer :: a(128) + integer :: i + + !$omp parallel num_threads(8) + !$omp barrier + !$omp do schedule (dynamic, 2) order(reproducible:concurrent) + do i = 1, 128 + a(i) = i + if (i == 1) then + call usleep (20) + else if (i == 18) then + call usleep (40) + end if + end do + !$omp end do nowait + !$omp do schedule (dynamic, 2) order(reproducible:concurrent) + do i = 1, 128 + a(i) = a(i) + i + end do + !$omp end do nowait + !$omp end parallel + do i = 1, 128 + if (a(i) /= 2 * i) & + stop + end do +end program main