Skip to content

Commit f5c6fe6

Browse files
committed
fix: count in CSR.byRows
1 parent d9dd757 commit f5c6fe6

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
2-
Gpu
3-
32
4-
51
NVIDIA*
62
Gpu
73
32

benchmarks/GraphBLAS-sharp.Benchmarks/Program.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ open BenchmarkDotNet.Running
44
[<EntryPoint>]
55
let main argv =
66
let benchmarks =
7-
BenchmarkSwitcher [| typeof<Algorithms.BFS.BFSWithoutTransferBenchmarkInt32>
8-
typeof<Matrix.SpGeMM.Expand.WithoutTransfer.Float32> |]
7+
BenchmarkSwitcher [| typeof<Algorithms.BFS.BFSWithoutTransferBenchmarkInt32> |]
98

109
benchmarks.Run argv |> ignore
1110
0

src/GraphBLAS-sharp.Backend/Matrix/CSR/Matrix.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ module Matrix =
132132
|> Seq.map
133133
(fun (first, second) ->
134134
lazy
135-
(if second - first > 0 then
136-
let values = getChunkValues first second
137-
let columns = getChunkIndices first second
135+
(let count = second - first
136+
137+
if count > 0 then
138+
let values = getChunkValues first count
139+
let columns = getChunkIndices first count
138140

139141
Some <| creatSparseVector values columns
140-
else
142+
else
141143
None))
142144

143145
let byRows (clContext: ClContext) workGroupSize =

src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Expand.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,21 @@ module Expand =
301301
runRow processor allocationMode rightMatrix rightMatrixRowsLengths
302302

303303
split processor allocationMode leftMatrix
304-
|> Seq.map (fun lazyRow -> Option.bind runRow lazyRow.Value)
304+
|> Seq.map (fun lazyRow ->
305+
Option.bind (fun row ->
306+
let result = runRow row
307+
row.Dispose processor
308+
309+
result
310+
) lazyRow.Value)
305311
|> Seq.toArray
306312
|> fun rows ->
307313
rightMatrixRowsLengths.Free processor
308314

309315
// compute nnz
310316
let nnz =
311317
rows
312-
|> Array.fold
318+
|> Seq.fold
313319
(fun count ->
314320
function
315321
| Some row -> count + row.Size

src/GraphBLAS-sharp.Backend/Objects/Matrix.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ module ClMatrix =
9292
interface IDeviceMemObject with
9393
member this.Dispose q =
9494
this.Rows
95-
|> Array.choose id
96-
|> Array.iter (fun vector -> vector.Dispose q)
95+
|> Seq.choose id
96+
|> Seq.iter (fun vector -> vector.Dispose q)
9797

9898
type Tuple<'elem when 'elem: struct> =
9999
{ Context: ClContext

0 commit comments

Comments
 (0)