def degrees_tree

bend-visgraph@2.0.0.0 · parallel.bend:180

import bend-visgraph@2.0.0.0/parallel.bend as Parallel
import Base
import bend-visgraph@2.0.0.0/visgraph.bend as VG

180# Forks down the build's tree of EJoin into VG.degrees.into, which
181# forks nothing, so the runtime spreads the tallies over every thread.
182def degrees_tree(depth: Nat, es: VG.Edges, dd: Array<U32> & Array<U32>) -> Array<U32>:
183  match depth es:
184    case 1n++p VG.EJoin{a, b}:
185      (d1, d2) = dd
186      x y = degrees_tree(p, a, Array.fork(U32, d1)) degrees_tree(p, b, Array.fork(U32, d2))
187      Array.join(U32, x, y)
188    case 0n VG.EJoin{a, b}:
189      (d1, d2) = dd
190      x y = VG.degrees.into(a, d1) VG.degrees.into(b, d2)
191      Array.join(U32, x, y)
192    case _ _:
193      (d1, d2) = dd
194      VG.degrees.into(es, Array.join(U32, d1, d2))

Uses (9)

Used by (1)