Skip to content

Commit a7a262e

Browse files
author
Damian Rouson
committed
fix(topological_sort): rm nonconforming concurrent
In both `do concurrent` blocks inside the topological_sort function, each iteration conditionally references an "order" array that is defined in other iterations. Fortran disallows such code for variables that have no specified locality and adding locality would not help: the algorithm needs to accumulate values across iterations. A different algorithm would need to be chosen to parallelize the topological sort.
1 parent 923348e commit a7a262e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dag_s.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pure module function topological_sort(dag) result(order)
3939

4040
searched_and_ordered = searched_and_ordered_t(s = [integer::], o = [integer::])
4141

42-
do concurrent(v = 1:size(dag%vertices))
42+
do v = 1, size(dag%vertices)
4343
if (.not. any(v == searched_and_ordered%s)) &
4444
searched_and_ordered = depth_first_search(v, [integer::], searched_and_ordered%o)
4545
end do
@@ -60,7 +60,7 @@ pure recursive function depth_first_search(v, d, o) result(hybrid)
6060
associate(dependencies => dag%depends_on(v))
6161
block
6262
integer w
63-
do concurrent(w = 1:size(dependencies))
63+
do w = 1, size(dependencies)
6464
associate(w_dependencies => dependencies(w))
6565
if (.not. any(w_dependencies == hybrid%s)) hybrid = depth_first_search(w_dependencies, [d, v], hybrid%o)
6666
end associate

0 commit comments

Comments
 (0)