Skip to content

Commit 625cc0a

Browse files
committed
fix: detection of when mailbox entries can be freed was broken on first assignment
1 parent 4031272 commit 625cc0a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/image_s.f90

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,16 @@ function assign_task(dag) result(tasks_left)
141141
! check which task the image just finished, that's task A
142142
! for each task B upstream of A, walk through that task's downstream dependencies
143143
! if they're all completed, the output data from B can be freed.
144-
! upstream_tasks = dag%dependencies_for(task_identifier[next_image])
145-
! upstream_task_images = task_assignment_history(upstream_tasks)
146-
! do i = 1, size(upstream_tasks)
147-
! if (all(task_done(dag%depends_on(upstream_tasks(i))))) then
148-
! mailbox_entry_can_be_freed(upstream_tasks(i))[upstream_task_images(i)] = .true.
149-
! end if
150-
! end do
144+
i = task_identifier[next_image]
145+
if (i /= NO_TASK_READY) then
146+
upstream_tasks = dag%dependencies_for(i)
147+
upstream_task_images = task_assignment_history(upstream_tasks)
148+
do i = 1, size(upstream_tasks)
149+
if (all(task_done(dag%depends_on(upstream_tasks(i))))) then
150+
mailbox_entry_can_be_freed(upstream_tasks(i))[upstream_task_images(i)] = .true.
151+
end if
152+
end do
153+
end if
151154

152155

153156
! tell the image that it can proceed with the next task

0 commit comments

Comments
 (0)