Skip to content

Commit 1f7838e

Browse files
committed
No reduce in BFS
1 parent 92fa5bb commit 1f7838e

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

  • src/GraphBLAS-sharp.Backend/Algorithms

src/GraphBLAS-sharp.Backend/Algorithms/BFS.fs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ module BFS =
2828
let fillSubVector =
2929
Vector.standardFillSubVector<int, int> clContext workGroupSize
3030

31-
let reduce =
32-
Vector.reduce clContext workGroupSize addNumeric
31+
let containsNonZero =
32+
DenseVector.DenseVector.containsNonZero clContext workGroupSize
3333

3434
fun (queue: MailboxProcessor<Msg>) (matrix: CSRMatrix<'a>) (source: int) ->
3535
let vertexCount = matrix.RowCount
@@ -60,16 +60,16 @@ module BFS =
6060
newFrontierUnmasked.Dispose queue
6161
frontier.Dispose queue
6262

63-
frontier <- newFrontier |> ClVectorDense
64-
levels <- newLevels
65-
66-
let frontierSum = Array.zeroCreate 1
67-
let sum = reduce queue frontier
63+
let frontNotEmpty = Array.zeroCreate 1
64+
let sum = containsNonZero queue newFrontier
6865

69-
queue.PostAndReply(fun ch -> Msg.CreateToHostMsg(sum, frontierSum, ch))
66+
queue.PostAndReply(fun ch -> Msg.CreateToHostMsg(sum, frontNotEmpty, ch))
7067
|> ignore
7168

72-
stop <- frontierSum.[0] = 0
69+
frontier <- newFrontier |> ClVectorDense
70+
levels <- newLevels
71+
72+
stop <- not frontNotEmpty.[0]
7373
| _ -> failwith "Not implemented"
7474

7575
levels

0 commit comments

Comments
 (0)