-
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.
- Loading branch information
Showing
115 changed files
with
5,712 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,35 @@ | ||
! RUN: %python %S/../test_errors.py %s %flang -fopenmp | ||
! Check OpenMP MAP clause validity. Section 5.8.3 OpenMP 5.2. | ||
|
||
subroutine sb(arr) | ||
implicit none | ||
real(8) :: arr(*) | ||
real :: a | ||
integer:: b, c, i | ||
common /var/ b, c | ||
|
||
!ERROR: Assumed-size whole arrays may not appear on the MAP clause | ||
!$omp target map(arr) | ||
do i = 1, 100 | ||
a = 3.14 | ||
enddo | ||
!$omp end target | ||
|
||
!ERROR: Assumed-size array 'arr' must have explicit final subscript upper bound value | ||
!$omp target map(arr(:)) | ||
do i = 1, 100 | ||
a = 3.14 | ||
enddo | ||
!$omp end target | ||
|
||
!$omp target map(arr(3:5)) | ||
do i = 1, 100 | ||
a = 3.14 | ||
enddo | ||
!$omp end target | ||
|
||
!$omp target map(tofrom: /var/) | ||
b = 1 | ||
c = 2 | ||
!$omp end target | ||
end subroutine |
35 changes: 35 additions & 0 deletions
35
flang/test/SemanticsChecked/OpenMP/modfile-threadprivate.f90
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,35 @@ | ||
! RUN: %python %S/../test_modfile.py %s %flang_fc1 -fopenmp | ||
! Check correct modfile generation for OpenMP threadprivate directive. | ||
|
||
module m | ||
implicit none | ||
type :: my_type(kind_param, len_param) | ||
integer, KIND :: kind_param | ||
integer, LEN :: len_param | ||
integer :: t_i | ||
integer :: t_arr(10) | ||
end type | ||
type(my_type(kind_param=2, len_param=4)) :: t | ||
real, dimension(3) :: thrtest | ||
real :: x | ||
common /blk/ x | ||
|
||
!$omp threadprivate(thrtest, t, /blk/) | ||
end | ||
|
||
!Expect: m.mod | ||
!module m | ||
!type::my_type(kind_param,len_param) | ||
!integer(4),kind::kind_param | ||
!integer(4),len::len_param | ||
!integer(4)::t_i | ||
!integer(4)::t_arr(1_8:10_8) | ||
!end type | ||
!type(my_type(kind_param=2_4,len_param=4_4))::t | ||
!!$omp threadprivate(t) | ||
!real(4)::thrtest(1_8:3_8) | ||
!!$omp threadprivate(thrtest) | ||
!real(4)::x | ||
!!$omp threadprivate(x) | ||
!common/blk/x | ||
!end |
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,166 @@ | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp | ||
! OpenMP Version 4.5 | ||
! Various checks with the nesting of BARRIER construct | ||
|
||
program omp_nest_barrier | ||
integer i, k, j | ||
k = 0; | ||
|
||
!$omp do | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
|
||
!$omp do simd | ||
do i = 1, 10 | ||
k = k + 1 | ||
!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: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
|
||
!$omp parallel do | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
|
||
!$omp parallel do simd | ||
do i = 1, 10 | ||
k = k + 1 | ||
!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: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
|
||
!$omp parallel | ||
do i = 1, 10 | ||
k = k + 1 | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end parallel | ||
|
||
!$omp task | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end task | ||
|
||
!$omp taskloop | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end taskloop | ||
|
||
!$omp critical | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end critical | ||
|
||
!$omp master | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end master | ||
|
||
!$omp ordered | ||
do i = 1, 10 | ||
k = k + 1 | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end ordered | ||
|
||
!$omp ordered | ||
do i = 1, 10 | ||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute | ||
do k =1, 10 | ||
print *, "hello" | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end distribute | ||
end do | ||
!$omp end ordered | ||
|
||
!$omp master | ||
do i = 1, 10 | ||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute | ||
do k =1, 10 | ||
print *, "hello" | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end distribute | ||
end do | ||
!$omp end master | ||
|
||
!$omp critical | ||
do i = 1, 10 | ||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute | ||
do k =1, 10 | ||
print *, "hello" | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end distribute | ||
end do | ||
!$omp end critical | ||
|
||
!$omp taskloop | ||
do i = 1, 10 | ||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute | ||
do k =1, 10 | ||
print *, "hello" | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end distribute | ||
end do | ||
!$omp end taskloop | ||
|
||
!$omp task | ||
do i = 1, 10 | ||
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. | ||
!$omp distribute | ||
do k =1, 10 | ||
print *, "hello" | ||
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. | ||
!$omp barrier | ||
j = j -1 | ||
end do | ||
!$omp end distribute | ||
end do | ||
!$omp end task | ||
|
||
end program omp_nest_barrier |
Oops, something went wrong.