| 1 |
! { dg-additional-sources my-usleep.c } |
| 2 |
! { dg-additional-options -Wno-complain-wrong-lang } |
| 3 |
|
| 4 |
program main |
| 5 |
implicit none |
| 6 |
interface |
| 7 |
subroutine usleep(t) bind(C, name="my_usleep") |
| 8 |
use iso_c_binding |
| 9 |
integer(c_int), value :: t |
| 10 |
end subroutine |
| 11 |
end interface |
| 12 |
|
| 13 |
integer :: a(128) |
| 14 |
integer :: i |
| 15 |
|
| 16 |
!$omp parallel num_threads(8) |
| 17 |
!$omp barrier |
| 18 |
!$omp do schedule (dynamic, 2) order(reproducible:concurrent) |
| 19 |
do i = 1, 128 |
| 20 |
a(i) = i |
| 21 |
if (i == 1) then |
| 22 |
call usleep (20) |
| 23 |
else if (i == 18) then |
| 24 |
call usleep (40) |
| 25 |
end if |
| 26 |
end do |
| 27 |
!$omp end do nowait |
| 28 |
!$omp do schedule (dynamic, 2) order(reproducible:concurrent) |
| 29 |
do i = 1, 128 |
| 30 |
a(i) = a(i) + i |
| 31 |
end do |
| 32 |
!$omp end do nowait |
| 33 |
!$omp end parallel |
| 34 |
do i = 1, 128 |
| 35 |
if (a(i) /= 2 * i) & |
| 36 |
stop |
| 37 |
end do |
| 38 |
end program main |