-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable the rest of "do" OpenMP tests
- Loading branch information
Showing
20 changed files
with
1,418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
! RUN: %python %S/../test_symbols.py %s %flang_fc1 -fopenmp | ||
! OpenMP Version 4.5 | ||
! 2.7.1 Do Loop Constructs | ||
|
||
!DEF: /omp_do1 MainProgram | ||
program omp_do1 | ||
!DEF: /omp_do1/i ObjectEntity INTEGER(4) | ||
!DEF: /omp_do1/j ObjectEntity INTEGER(4) | ||
!DEF: /omp_do1/k (OmpThreadprivate) ObjectEntity INTEGER(4) | ||
!DEF: /omp_do1/n (OmpThreadprivate) ObjectEntity INTEGER(4) | ||
integer i, j, k, n | ||
!$omp threadprivate (k,n) | ||
!$omp do | ||
!DEF: /omp_do1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) | ||
do i=1,10 | ||
!REF: /omp_do1/j | ||
do j=1,10 | ||
print *, "Hello" | ||
end do | ||
end do | ||
!$omp end do | ||
end program omp_do1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp | ||
! OpenMP Version 4.5 | ||
! 2.7.1 Loop Construct | ||
! The loop iteration variable may not appear in a threadprivate directive. | ||
|
||
|
||
subroutine omp_do | ||
integer, save:: i, j, k,n | ||
!$omp threadprivate(k,j,i) | ||
!$omp do collapse(2) | ||
!ERROR: Loop iteration variable i is not allowed in THREADPRIVATE. | ||
do i = 1, 10 | ||
!ERROR: Loop iteration variable j is not allowed in THREADPRIVATE. | ||
do j = 1, 10 | ||
print *, "Hello" | ||
end do | ||
end do | ||
!$omp end do | ||
end subroutine omp_do | ||
|
||
subroutine omp_do1 | ||
integer, save :: i, j, k | ||
!$omp threadprivate(k,j,i) | ||
!$omp do | ||
!ERROR: Loop iteration variable i is not allowed in THREADPRIVATE. | ||
do i = 1, 10 | ||
do j = 1, 10 | ||
print *, "Hello" | ||
end do | ||
end do | ||
!$omp end do | ||
|
||
end subroutine omp_do1 | ||
|
||
subroutine omp_do2 | ||
integer, save :: k, j | ||
!$omp threadprivate(k) | ||
!$omp threadprivate(j) | ||
call compute() | ||
contains | ||
subroutine compute() | ||
!$omp do ordered(1) collapse(1) | ||
!ERROR: Loop iteration variable k is not allowed in THREADPRIVATE. | ||
foo: do k = 1, 10 | ||
do i = 1, 10 | ||
print *, "Hello" | ||
end do | ||
end do foo | ||
!$omp end do | ||
end subroutine | ||
|
||
end subroutine omp_do2 | ||
|
||
subroutine omp_do3 | ||
integer, save :: i | ||
!$omp threadprivate(i) | ||
!$omp parallel | ||
print *, "parallel" | ||
!$omp end parallel | ||
!$omp do | ||
!ERROR: Loop iteration variable i is not allowed in THREADPRIVATE. | ||
do i = 1, 10 | ||
do j = 1, 10 | ||
print *, "Hello" | ||
end do | ||
end do | ||
!$omp end do | ||
|
||
end subroutine omp_do3 | ||
|
||
module tp | ||
!integer i,j | ||
integer, save:: i, j, k,n | ||
!$omp threadprivate(i) | ||
!$omp threadprivate(j) | ||
end module tp | ||
|
||
module usetp | ||
use tp | ||
end module usetp | ||
|
||
subroutine main | ||
use usetp | ||
!$omp do | ||
!ERROR: Loop iteration variable i is not allowed in THREADPRIVATE. | ||
do i = 1, 10 | ||
do j = 1, 10 | ||
print *, "Hello" | ||
end do | ||
end do | ||
!$omp end do | ||
end subroutine | ||
|
||
subroutine main1 | ||
use tp | ||
!$omp do | ||
!ERROR: Loop iteration variable j is not allowed in THREADPRIVATE. | ||
do j = 1, 10 | ||
do i = 1, 10 | ||
print *, "Hello" | ||
end do | ||
end do | ||
!$omp end do | ||
end subroutine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
! RUN: %python %S/../test_symbols.py %s %flang_fc1 -fopenmp | ||
! OpenMP Version 4.5 | ||
! 2.7.1 Loop Construct restrictions on single directive. | ||
! A positive case | ||
|
||
!DEF: /omp_do MainProgram | ||
program omp_do | ||
!DEF: /omp_do/i ObjectEntity INTEGER(4) | ||
!DEF: /omp_do/n ObjectEntity INTEGER(4) | ||
integer i,n | ||
!$omp parallel | ||
!DEF: /omp_do/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) | ||
do i=1,10 | ||
!$omp single | ||
print *, "hello" | ||
!$omp end single | ||
end do | ||
!$omp end parallel | ||
|
||
!$omp parallel default(shared) | ||
!$omp do | ||
!DEF: /omp_do/OtherConstruct2/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) | ||
!REF: /omp_do/n | ||
do i=1,n | ||
!$omp parallel | ||
!$omp single | ||
!DEF: /work EXTERNAL (Subroutine) ProcEntity | ||
!REF: /omp_do/OtherConstruct2/OtherConstruct1/i | ||
call work(i, 1) | ||
!$omp end single | ||
!$omp end parallel | ||
end do | ||
!$omp end do | ||
!$omp end parallel | ||
|
||
!$omp parallel private(i) | ||
!DEF: /omp_do/OtherConstruct3/i (OmpPrivate) HostAssoc INTEGER(4) | ||
do i=1,10 | ||
!$omp single | ||
print *, "hello" | ||
!$omp end single | ||
end do | ||
!$omp end parallel | ||
|
||
end program omp_do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
! RUN: %python %S/../test_errors.py %s %flang -fopenmp | ||
! OpenMP Version 4.5 | ||
! 2.7.1 Loop Construct restrictions on single directive. | ||
|
||
|
||
program omp_do | ||
|
||
integer n | ||
integer i,j,k | ||
!$omp do | ||
do i=1,10 | ||
if( i == 5 ) then | ||
cycle | ||
end if | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end do | ||
|
||
!$omp parallel do | ||
do i=1,10 | ||
if( i == 9 ) then | ||
end if | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end parallel do | ||
|
||
!$omp parallel do simd | ||
do i=1,10 | ||
if( i == 5 ) then | ||
cycle | ||
end if | ||
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end parallel do simd | ||
|
||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute parallel do | ||
do i=1,10 | ||
if( i == 3 ) then | ||
cycle | ||
end if | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end distribute parallel do | ||
|
||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute parallel do simd | ||
do i=1,10 | ||
if( i == 3 ) then | ||
cycle | ||
end if | ||
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end distribute parallel do simd | ||
|
||
!$omp target parallel do | ||
do i=1,10 | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end target parallel do | ||
|
||
!$omp target parallel do simd | ||
do i=1,10 | ||
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end target parallel do simd | ||
|
||
!$omp target teams distribute parallel do | ||
do i=1,10 | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end target teams distribute parallel do | ||
|
||
!$omp target teams distribute parallel do simd | ||
do i=1,10 | ||
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end target teams distribute parallel do simd | ||
|
||
!$omp do | ||
do i=1,10 | ||
!$omp task | ||
do j=1,10 | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do k=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end task | ||
end do | ||
!$omp end do | ||
|
||
!$omp do | ||
do i=1,10 | ||
!$omp parallel | ||
do j=1,10 | ||
!$omp single | ||
do k=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end parallel | ||
end do | ||
!$omp end do | ||
|
||
!$omp do | ||
do i=1,10 | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do j=1,10 | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do k=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
end do | ||
!$omp end single | ||
|
||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
do k=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end single | ||
|
||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp do | ||
do k=1,10 | ||
print *,"hello" | ||
end do | ||
!$omp end do | ||
end do | ||
!$omp end do | ||
|
||
!$omp parallel default(shared) | ||
!$omp do | ||
do i = 1, n | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
call work(i, 1) | ||
!$omp end single | ||
end do | ||
!$omp end do | ||
!$omp end parallel | ||
|
||
!$omp parallel default(shared) | ||
!$omp do | ||
do i = 1, n | ||
!$omp task | ||
do j=1,10 | ||
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region | ||
!$omp single | ||
call work(i, 1) | ||
!$omp end single | ||
end do | ||
!$omp end task | ||
end do | ||
!$omp end do | ||
!$omp end parallel | ||
|
||
end program omp_do |
Oops, something went wrong.