1 ! { dg-set-target-env-var OMP_NUM_TEAMS_ALL "3" }
2 ! { dg-set-target-env-var OMP_NUM_TEAMS_DEV "4" }
3 ! { dg-set-target-env-var OMP_NUM_TEAMS "5" }
4 ! { dg-set-target-env-var OMP_NUM_TEAMS_DEV_0 "6" }
5 ! { dg-set-target-env-var OMP_NUM_TEAMS_DEV_1 "7" }
6 ! { dg-set-target-env-var OMP_NUM_TEAMS_DEV_2 "8" }
7 ! { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_ALL "2" }
8 ! { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_DEV "3" }
9 ! { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT "4" }
10 ! { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_DEV_0 "5" }
11 ! { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_DEV_1 "6" }
12 ! { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_DEV_2 "7" }
15 implicit none (type, external)
16 integer :: num_devices
, i
, large_num_teams
, large_threads_limit
19 if (omp_get_num_devices () > 3) then
22 num_devices
= omp_get_num_devices ()
28 if (env_is_set_dev ("OMP_NUM_TEAMS_DEV_", i
, 6 + i
)) then
30 !$omp target device(i) map(tofrom: err)
31 if (omp_get_max_teams () /= 6 + i
) err
= .true
.
36 !$omp target device(i) map(tofrom: err)
38 if (omp_get_num_teams () > 6 + i
.or
. omp_get_team_num () >= 6 + i
) &
45 !$omp target device(i) map(tofrom: err)
46 call omp_set_num_teams (5 + i
)
47 if (omp_get_max_teams () /= 5 + i
) err
= .true
.
52 !$omp target device(i) map(tofrom: err)
53 if (omp_get_max_teams () /= 5 + i
) err
= .true
.
58 !$omp target device(i) map(tofrom: err)
60 if (omp_get_num_teams () > 5 + i
.or
. omp_get_team_num () >= 5 + i
) &
67 !$omp target device(i) map(tofrom: err)
68 !$omp teams num_teams(6 + i)
69 if (omp_get_num_teams () > 6 + i
.or
. omp_get_team_num () >= 6 + i
) &
76 !$omp target device(i) map(tofrom: err)
77 !$omp teams num_teams(4 + i)
78 if (omp_get_num_teams () > 4 + i
.or
. omp_get_team_num () >= 4 + i
) &
84 large_num_teams
= 66000
86 !$omp target device(i) map(tofrom: err)
87 call omp_set_num_teams (large_num_teams
+ i
)
88 if (omp_get_max_teams () /= large_num_teams
+ i
) err
= .true
.
93 !$omp target device(i) map(tofrom: err)
94 if (omp_get_max_teams () /= large_num_teams
+ i
) err
= .true
.
99 !$omp target device(i) map(tofrom: err)
101 if (omp_get_num_teams () > large_num_teams
+ i
&
102 .or
. omp_get_team_num () >= large_num_teams
+ i
) err
= .true
.
108 ! Testing TEAMS-THREAD-LIMIT
109 if (env_is_set_dev ("OMP_TEAMS_THREAD_LIMIT_DEV_", i
, 5 + i
)) then
111 !$omp target device(i) map(tofrom: err)
112 if (omp_get_teams_thread_limit () /= 5 + i
) err
= .true
.
117 !$omp target device(i) map(tofrom: err)
120 if (omp_get_thread_limit () > 5 + i
.or
. omp_get_thread_num () >= 5 + i
) &
128 !$omp target device(i) map(tofrom: err)
129 call omp_set_teams_thread_limit (4 + i
)
130 if (omp_get_teams_thread_limit () /= 4 + i
) err
= .true
.
135 !$omp target device(i) map(tofrom: err)
136 if (omp_get_teams_thread_limit () /= 4 + i
) err
= .true
.
141 !$omp target device(i) map(tofrom: err)
144 if (omp_get_thread_limit () > 4 + i
.or
. omp_get_thread_num () >= 4 + i
) &
152 !$omp target device(i) map(tofrom: err)
153 !$omp teams thread_limit(5 + i)
155 if (omp_get_thread_limit () > 5 + i
.or
. omp_get_thread_num () >= 5 + i
) &
163 !$omp target device(i) map(tofrom: err)
164 !$omp teams thread_limit(3 + i)
166 if (omp_get_thread_limit () > 3 + i
.or
. omp_get_thread_num () >= 3 + i
) &
173 large_threads_limit
= 67000
175 !$omp target device(i) map(tofrom: err)
176 call omp_set_teams_thread_limit (large_threads_limit
+ i
)
177 if (omp_get_teams_thread_limit () /= large_threads_limit
+ i
) err
= .true
.
182 !$omp target device(i) map(tofrom: err)
183 if (omp_get_teams_thread_limit () /= large_threads_limit
+ i
) err
= .true
.
188 !$omp target device(i) map(tofrom: err)
191 if (omp_get_thread_limit () > large_threads_limit
+ i
&
192 .or
. omp_get_thread_num () >= large_threads_limit
+ i
) err
= .true
.
202 logical function env_is_set (name
, val
)
203 character(len
=*) :: name
, val
204 character(len
=40) :: val2
206 call get_environment_variable (name
, val2
, status
=stat
)
208 if (val
== val2
) then
212 else if (stat
/= 1) then
217 logical function env_is_set_dev (name
, dev_num
, val
)
218 character(len
=*) :: name
219 integer :: dev_num
, val
220 character(len
=64) :: dev_num_str
, env_var
, val_str
221 dev_num_str
= ADJUSTL(dev_num_str
)
222 env_var
= name
// dev_num_str
223 val_str
= ADJUSTL(val_str
)
224 env_is_set_dev
= env_is_set (TRIM(env_var
), TRIM(val_str
))