llvm-capstone/flang/test/Semantics/omp-nested-distribute.f90
Ivan Zhechev 6c1ac141d3 [Flang] Ported test_errors.sh to Python
To enable Flang testing on Windows, shell scripts have to be ported to Python. In this patch the "test_errors.sh" script is ported to python ("test_errors.py"). The RUN line of existing tests was changed to make use of the python script.

Used python regex in place of awk/sed.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D107575
2021-09-06 08:19:42 +00:00

105 lines
2.3 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang -fopenmp
! Check OpenMP clause validity for the following directives:
! 2.10 Device constructs
program main
real(8) :: arrayA(256), arrayB(256)
integer :: N
arrayA = 1.414
arrayB = 3.14
N = 256
!$omp task
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
!$omp distribute
do i = 1, N
a = 3.14
enddo
!$omp end distribute
!$omp end task
!$omp teams
do i = 1, N
!ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp task
do k = 1, N
a = 3.14
enddo
!$omp end task
enddo
!$omp end teams
!$omp teams
do i = 1, N
!$omp parallel
do k = 1, N
a = 3.14
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.14
enddo
!$omp end distribute
!$omp end parallel
!$omp teams
!ERROR: Only `DISTRIBUTE` or `PARALLEL` 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 teams
!ERROR: Only `DISTRIBUTE` or `PARALLEL` 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
end program main