@@ -104,6 +104,9 @@ end function check_suite
104104 ! !
105105 subroutine test_host (retval , test_suites )
106106
107+ #ifdef _OPENMP
108+ use omp_lib
109+ #endif
107110 use test_host_mod, only: ncols, num_time_steps
108111 use test_host_ccpp_cap, only: test_host_ccpp_physics_register
109112 use test_host_ccpp_cap, only: test_host_ccpp_physics_initialize
@@ -120,6 +123,7 @@ subroutine test_host(retval, test_suites)
120123
121124 logical :: check
122125 integer :: col_start, col_end
126+ integer :: thread_num, num_threads
123127 integer :: index, sind
124128 integer :: time_step
125129 integer :: num_suites
@@ -196,35 +200,55 @@ subroutine test_host(retval, test_suites)
196200 end if
197201 end do
198202
199- do col_start = 1 , ncols, 5
200- if (errflg /= 0 ) then
201- exit
202- end if
203- col_end = MIN (col_start + 4 , ncols)
204-
205- do sind = 1 , num_suites
203+ run_phase_if_no_error: if (errflg == 0 ) then
204+ #ifdef _OPENMP
205+ num_threads = omp_get_max_threads()
206+ #else
207+ num_threads = 1
208+ #endif
209+ ! $OMP parallel num_threads (num_threads) &
210+ ! $OMP default (none) &
211+ ! $OMP shared (num_threads, num_suites, test_suites) &
212+ ! $OMP private (thread_num, col_start, col_end, errmsg) &
213+ ! $OMP reduction (+:errflg)
214+ #ifdef _OPENMP
215+ thread_num = omp_get_thread_num()
216+ #else
217+ thread_num = 0
218+ #endif
219+ ! $OMP do
220+ do col_start = 1 , ncols, 5
206221 if (errflg /= 0 ) then
207- exit
222+ continue
208223 end if
209- do index = 1 , size (test_suites(sind)% suite_parts)
224+ col_end = MIN (col_start + 4 , ncols)
225+ do sind = 1 , num_suites
210226 if (errflg /= 0 ) then
211- exit
227+ continue
212228 end if
213- if (errflg == 0 ) then
229+ do index = 1 , size (test_suites(sind)% suite_parts)
230+ if (errflg /= 0 ) then
231+ continue
232+ end if
233+ write (0 ,' (a,i0,a,i0,5a,i0,a,i0)' ) ' Thread ' , thread_num, ' /' , num_threads, &
234+ ' : calling run phase for suite ' , trim (test_suites(sind)% suite_name), &
235+ ' part ' , trim (test_suites(sind)% suite_parts(index)), &
236+ ' columns ' , col_start, ' :' , col_end
214237 call test_host_ccpp_physics_run( &
215238 test_suites(sind)% suite_name, &
216239 test_suites(sind)% suite_parts(index), &
217240 col_start, col_end, errmsg, errflg)
218- end if
219- if (errflg /= 0 ) then
220- write (6 , ' (5a)' ) trim (test_suites(sind)% suite_name), &
221- ' /' , trim (test_suites(sind)% suite_parts(index)), &
222- ' : ' , trim (errmsg)
223- exit
224- end if
241+ if (errflg /= 0 ) then
242+ write (6 , ' (5a)' ) trim (test_suites(sind)% suite_name), &
243+ ' /' , trim (test_suites(sind)% suite_parts(index)), &
244+ ' : ' , trim (errmsg)
245+ end if
246+ end do
225247 end do
226248 end do
227- end do
249+ ! $OMP end do
250+ ! $OMP end parallel
251+ end if run_phase_if_no_error
228252
229253 do sind = 1 , num_suites
230254 if (errflg /= 0 ) then
0 commit comments