]> gcc.gnu.org Git - gcc.git/commitdiff
openacc: Fix race condition in Fortran loop collapse tests
authorJulian Brown <julian@codesourcery.com>
Thu, 25 Jun 2020 14:40:53 +0000 (07:40 -0700)
committerJulian Brown <julian@codesourcery.com>
Tue, 8 Sep 2020 20:26:42 +0000 (13:26 -0700)
The gangs participating in a gang-partitioned loop are not all guaranteed
to complete before some given gang continues to execute beyond that loop.
This means that two existing test cases contain a race condition,
because a loop that may be gang-partitioned is followed immediately by
another loop.  The fix is to place the loops in separate parallel regions.

2020-09-08  Julian Brown  <julian@codesourcery.com>

libgomp/
* testsuite/libgomp.oacc-fortran/collapse-1.f90: Fix race condition.
* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.

libgomp/testsuite/libgomp.oacc-fortran/collapse-1.f90
libgomp/testsuite/libgomp.oacc-fortran/collapse-2.f90

index 918c5d0d5b1c5b0401e3d11d02748d20fceed2a9..4857752f1b0a3d11b04ecd8cf813d5a385a82c51 100644 (file)
@@ -14,6 +14,9 @@ program collapse1
         end do
       end do
     end do
+  !$acc end parallel
+
+  !$acc parallel
   !$acc loop collapse(2) reduction(.or.:l)
     do i = 1, 3
       do j = 4, 6
index 98b6987750ec89bf6363a4b673f882b507d2e373..0a543909127e6c3097fafc9f9a193f757d96c00c 100644 (file)
@@ -13,6 +13,9 @@ program collapse2
         do 164 k = 5, 7
           a(i, j, k) = i + j + k
 164      end do
+  !$acc end parallel
+
+  !$acc parallel
   !$acc loop collapse(2) reduction(.or.:l)
 firstdo: do i = 1, 3
       do j = 4, 6
This page took 0.056358 seconds and 5 git commands to generate.