llvm-project/flang/test/Semantics/OpenMP/nested-distribute.f90
Tarun Prabhu e5f93db6c0
[flang][NFC] Strip trailing whitespace from tests (14 of 14)
Only some fortran source files in flang/test/Semantics/OpenMP have been
modified. This is the last of the commits cleaning up trailing
whitespace in the Fortran files in flang/tests.
2025-12-17 10:24:32 -07:00

125 lines
2.7 KiB
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! Check OpenMP clause validity for the following directives:
! 2.10 Device constructs
subroutine f
integer :: i
!WARNING: `DISTRIBUTE` must be dynamically enclosed in a `TEAMS` region.
!$omp distribute
do i = 1, 100
print *, "hello"
end do
end subroutine
program main
real(8) :: arrayA(256), arrayB(256)
integer :: N
arrayA = 1.414d0
arrayB = 3.14d0
N = 256
!$omp task
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
!$omp distribute
do i = 1, N
a = 3.14d0
enddo
!$omp end distribute
!$omp end task
!$omp teams
do i = 1, N
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp task
do k = 1, N
a = 3.14d0
enddo
!$omp end task
enddo
!$omp end teams
!$omp teams
do i = 1, N
!$omp parallel
do k = 1, N
a = 3.14d0
enddo
!$omp end parallel
enddo
!$omp end teams
!$omp parallel
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
!$omp distribute
do i = 1, N
a = 3.14d0
enddo
!$omp end distribute
!$omp end parallel
!$omp teams
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp target
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
!$omp distribute
do i = 1, 10
j = j + 1
end do
!$omp end distribute
!$omp end target
!$omp end teams
!$omp teams
!$omp parallel
do k = 1,10
print *, "hello"
end do
!$omp end parallel
!$omp distribute firstprivate(a)
do i = 1, 10
j = j + 1
end do
!$omp end distribute
!$omp end teams
!$omp target teams
!$omp distribute
do i = 1, 10
end do
!$omp end distribute
!$omp end target teams
!$omp teams
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp task
do k = 1,10
print *, "hello"
end do
!$omp end task
!$omp distribute firstprivate(a)
do i = 1, 10
j = j + 1
end do
!$omp end distribute
!$omp end teams
!$omp task
!$omp parallel
do k = 1,10
print *, "hello"
end do
!$omp end parallel
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
!$omp distribute firstprivate(a)
do i = 1, 10
j = j + 1
end do
!$omp end distribute
!$omp end task
!$omp teams
call foo
!$omp end teams
end program main