d6d9be7c6b
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.
31 lines
580 B
Fortran
31 lines
580 B
Fortran
! { dg-do run }
|
|
|
|
program collapse1
|
|
integer :: i, j, k, a(1:3, 4:6, 5:7)
|
|
logical :: l
|
|
l = .false.
|
|
a(:, :, :) = 0
|
|
!$acc parallel
|
|
!$acc loop collapse(4 - 1)
|
|
do i = 1, 3
|
|
do j = 4, 6
|
|
do k = 5, 7
|
|
a(i, j, k) = i + j + k
|
|
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
|
|
do k = 5, 7
|
|
if (a(i, j, k) .ne. (i + j + k)) l = .true.
|
|
end do
|
|
end do
|
|
end do
|
|
!$acc end parallel
|
|
if (l) STOP 1
|
|
end program collapse1
|