Skip to content

Commit 380b774

Browse files
committed
Use new dag_m library (currently tracking dag HEAD)
1 parent 469020a commit 380b774

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

fpm.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ copyright = "2021 Sourcery Institute"
77

88
[dependencies]
99
sourcery = {git = "https://github.com/sourceryinstitute/sourcery", tag = "21.02.24"}
10-
dag = {git = "https://github.com/sourceryinstitute/dag", tag = "21.04.20"}
10+
dag = {git = "https://github.com/sourceryinstitute/dag"}
1111

1212
[dev-dependencies]
1313
vegetables = {git = "https://gitlab.com/everythingfunctional/vegetables", tag = "v7.0.2"}

src/application_m.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module application_m
2-
use dag_interface, only : dag_t
2+
use dag_m, only : dag_t
33
use task_item_m, only : task_item_t
44
implicit none
55

src/application_s.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
contains
66

77
module procedure construct
8-
call assert(size(tasks)==dag%get_num_vertices(), "application(construct): size(tasks)==dag%get_num_vertices()")
8+
call assert(size(tasks)==dag%num_vertices(), "application(construct): size(tasks)==dag%num_vertices()")
99
application%dag_ = dag
1010
application%tasks_ = tasks
1111
end procedure

src/image_s.f90

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
submodule(image_m) image_s
2-
use dag_interface, only: dag_t
2+
use dag_m, only: dag_t
33
use iso_fortran_env, only: event_type
44
use final_task_m, only: final_task_t
55
use mailbox_m, only: mailbox, mailbox_entry_can_be_freed
@@ -84,7 +84,7 @@ function do_work(tasks, dag) result(tasks_left)
8484
integer, allocatable :: upstream_task_imagenums(:)
8585

8686
! figure out which images have our input data
87-
upstream_task_nums = dag%get_edges(task_identifier)
87+
upstream_task_nums = dag%dependencies_for(task_identifier)
8888
upstream_task_imagenums = task_assignment_history(upstream_task_nums)[scheduler_image]
8989

9090
! execute task, store result
@@ -138,10 +138,10 @@ function assign_task(dag) result(tasks_left)
138138
! check which task the image just finished, that's task A
139139
! for each task B upstream of A, walk through that task's downstream dependencies
140140
! if they're all completed, the output data from B can be freed.
141-
upstream_tasks = dag%get_edges(task_identifier[next_image])
141+
upstream_tasks = dag%dependencies_for(task_identifier[next_image])
142142
upstream_task_images = task_assignment_history(upstream_tasks)
143143
do i = 1, size(upstream_tasks)
144-
if (all(task_done(dag%get_dependencies(upstream_tasks(i))))) then
144+
if (all(task_done(dag%depends_on(upstream_tasks(i))))) then
145145
mailbox_entry_can_be_freed(upstream_tasks(i))[upstream_task_images(i)] = .true.
146146
end if
147147
end do
@@ -176,7 +176,8 @@ subroutine assign_completed_to_images()
176176
end subroutine
177177

178178
pure function find_next_task ( dag ) Result ( next_task_to_run )
179-
!! find_next_task: search through the dag to find the next task where its dependents are complete
179+
!! find_next_task: search through the dag to find the next task where its
180+
!! dependencies are complete
180181
!!
181182
!! possible outputs for next_task_to_run
182183
!! - a positive integer signals the next task to run
@@ -189,7 +190,7 @@ pure function find_next_task ( dag ) Result ( next_task_to_run )
189190
integer :: next_task_to_run
190191

191192
integer :: task, depends
192-
integer, allocatable, dimension(:) :: dependents
193+
integer, allocatable, dimension(:) :: dependencies
193194
logical :: done, all_done
194195

195196
all_done = .true.
@@ -200,10 +201,10 @@ pure function find_next_task ( dag ) Result ( next_task_to_run )
200201
cycle
201202
else
202203
all_done = .false.
203-
dependents = dag%get_dependencies ( task )
204+
dependencies = dag%dependencies_for ( task )
204205
done = .true.
205-
do depends = 1, size(dependents)
206-
done = done .and. task_done(depends)
206+
do depends = 1, size(dependencies)
207+
done = done .and. task_done(dependencies(depends))
207208
end do
208209
if ( done ) then
209210
next_task_to_run = task

0 commit comments

Comments
 (0)