| 1 |
! PR middle-end/102972 |
| 2 |
|
| 3 |
module m |
| 4 |
implicit none (type, external) |
| 5 |
interface |
| 6 |
subroutine omp_set_num_teams (num_teams); integer :: num_teams; end |
| 7 |
subroutine omp_set_teams_thread_limit (thread_limit); integer :: thread_limit; end |
| 8 |
subroutine omp_set_num_teams_8 (num_teams); integer(8) :: num_teams; end |
| 9 |
subroutine omp_set_num_teams_9 (num_teams); integer :: num_teams; end |
| 10 |
subroutine omp_set_teams_thread_limit_8 (thread_limit); integer(8) :: thread_limit; end |
| 11 |
integer function omp_get_num_teams (); end |
| 12 |
integer function omp_get_team_size (level); integer :: level; end |
| 13 |
integer function omp_get_team_num (); end |
| 14 |
integer function omp_get_max_teams (); end |
| 15 |
integer function omp_get_teams_thread_limit (); end |
| 16 |
logical function omp_is_initial_device (); end |
| 17 |
integer function omp_get_num_threads (); end |
| 18 |
end interface |
| 19 |
|
| 20 |
contains |
| 21 |
|
| 22 |
subroutine valid () |
| 23 |
integer :: i, n |
| 24 |
!$omp teams |
| 25 |
!$omp distribute |
| 26 |
do i = 1, 64 |
| 27 |
end do |
| 28 |
|
| 29 |
n = omp_get_num_teams () |
| 30 |
if (n >= omp_get_team_num ()) & |
| 31 |
error stop |
| 32 |
|
| 33 |
!$omp parallel do |
| 34 |
do i = 1, 64 |
| 35 |
if (.not.omp_is_initial_device () .or. omp_get_num_threads () < 0) & |
| 36 |
error stop |
| 37 |
end do |
| 38 |
|
| 39 |
!$omp loop |
| 40 |
do i = 1, 64 |
| 41 |
end do |
| 42 |
!$omp end teams |
| 43 |
end |
| 44 |
|
| 45 |
subroutine invalid_nest () |
| 46 |
integer :: i, n |
| 47 |
!$omp teams |
| 48 |
!$omp distribute parallel do simd |
| 49 |
do i = 1, 64 |
| 50 |
end do |
| 51 |
|
| 52 |
n = 0 |
| 53 |
n = n + omp_get_team_size (0) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_team_size\[^\n\r]*' strictly nested in a 'teams' region" } |
| 54 |
n = n + omp_get_num_teams () |
| 55 |
n = n + omp_get_team_num () |
| 56 |
call omp_set_num_teams (n) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_set_num_teams\[^\n\r]*' strictly nested in a 'teams' region" } |
| 57 |
call omp_set_num_teams_8 (4_8) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_set_num_teams_8\[^\n\r]*' strictly nested in a 'teams' region" } |
| 58 |
call omp_set_num_teams_9 (4) ! OK - but misnamed user function |
| 59 |
n = n + omp_get_max_teams () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_max_teams\[^\n\r]*' strictly nested in a 'teams' region" } |
| 60 |
n = n + omp_get_teams_thread_limit () ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_teams_thread_limit\[^\n\r]*' strictly nested in a 'teams' region" } |
| 61 |
call omp_set_teams_thread_limit (n) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_set_teams_thread_limit'\[^\n\r]* strictly nested in a 'teams' region" } |
| 62 |
call omp_set_teams_thread_limit_8 (3_8) ! { dg-error "OpenMP runtime API call '\[^\n\r]*omp_set_teams_thread_limit_8'\[^\n\r]* strictly nested in a 'teams' region" } |
| 63 |
!$omp end teams |
| 64 |
end |
| 65 |
end module |