53 SUBROUTINE execute (self, task_list, test)
58 class(
link_t),
pointer :: link
61 call trace_begin (
'dispatcher2_t%execute')
62 call task_list%startup
64 self%task_list => task_list
65 task_list%nq = task_list%n
66 task_list%na = task_list%n
67 link => task_list%head
68 do while (
associated(link))
69 call link%task%set (bits%ready)
75 do while (self%task_list%na > 0 .and. wallclock() < io%job_seconds)
76 call self%update (test)
82 call mpi_mesg%diagnostics(1)
83 call toc (
'wall time', timer%n_update, time=start)
84 END SUBROUTINE execute
91 SUBROUTINE activate (self, link, test)
93 class(
link_t),
pointer :: link
96 if (omp%nthreads==1)
then 98 call self%task_list%update (link, test)
104 call self%task_list%check_mpi ()
105 call self%task_list%update (link, test)
109 self%task_list%nq = self%task_list%nq - 1
112 END SUBROUTINE activate
119 SUBROUTINE update (self, test)
123 class(
link_t),
pointer :: link, nbor
126 integer,
save :: itimer=0
128 call trace_begin (
'dispatcher2_t%update', itimer=itimer)
129 link => self%task_list%head
130 do while (
associated(link))
131 if (io%debug(2))
then 132 print *,
'checking link', link%task%id, link%task%state
135 state = link%task%state
140 if (link%task%time > io%end_time)
then 142 self%task_list%na = self%task_list%na - 1
149 do while (
associated(nbor))
151 state = nbor%link%task%state
153 if (io%debug(3))
then 154 print
'(i3,f12.6,a,i6,i3)', omp%thread, wallclock(),
' checking nbor', nbor%link%task%id, state
156 call check_task (nbor%link, ok)
160 call check_task (link, ok)
164 call trace_end (itimer)
177 subroutine check_task (link, ok)
178 class(
link_t),
pointer:: link, nbor
179 class(
task_t),
pointer:: task
186 do while (ok.and.
associated (nbor))
187 ok = ok .and. nbor%task%is_ahead_of(task)
192 state = link%task%state
196 self%task_list%nq = self%task_list%nq + 1
200 call self%activate (link, test)
202 print
'(i3,f12.6,a,i6,i3)', omp%thread, wallclock(),
' found unexpected state', link%task%id, link%task%state
205 end subroutine check_task
206 END SUBROUTINE update
Each thread uses a private timer data type, with arrays for start time and total time for each regist...
Support tic/toc timing, as in MATLAB, and accurate wallclock() function. The timing is generally much...
Module with list handling for generic class task_t objects.
Task list data type, with methods for startup and updates. Message handling is inherited from the tas...
Module with list handling for generic class task_t objects.
A simple task dispatcher, which handles a list of tasks that may be started as background OpenMP task...
Template module for tasks.