Skip to content

Commit de357df

Browse files
authored
Merge pull request #82 from IgorErin/splitbench
SpGeMM refactor
2 parents b494dab + 41309d9 commit de357df

File tree

5 files changed

+146
-118
lines changed

5 files changed

+146
-118
lines changed

benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ open GraphBLAS.FSharp.Backend
1515
[<AbstractClass>]
1616
[<IterationCount(100)>]
1717
[<WarmupCount(10)>]
18-
[<Config(typeof<Configs.Matrix2>)>]
18+
[<Config(typeof<Configs.Matrix>)>]
1919
type Benchmarks<'elem when 'elem : struct>(
2020
buildFunToBenchmark,
2121
converter: string -> 'elem,
@@ -24,11 +24,9 @@ type Benchmarks<'elem when 'elem : struct>(
2424

2525
let mutable funToBenchmark = None
2626

27-
let mutable firstMatrix = Unchecked.defaultof<ClMatrix<'elem>>
28-
let mutable secondMatrix = Unchecked.defaultof<ClMatrix<'elem>>
27+
let mutable matrix = Unchecked.defaultof<ClMatrix<'elem>>
2928

30-
let mutable firstMatrixHost = Unchecked.defaultof<_>
31-
let mutable secondMatrixHost = Unchecked.defaultof<_>
29+
let mutable matrixHost = Unchecked.defaultof<_>
3230

3331
member val ResultMatrix = Unchecked.defaultof<ClMatrix.COO<'elem> option> with get, set
3432

@@ -38,7 +36,7 @@ type Benchmarks<'elem when 'elem : struct>(
3836
[<ParamsSource("InputMatrixProvider")>]
3937
member val InputMatrixReader = Unchecked.defaultof<MtxReader> with get, set
4038

41-
member this.OclContext:ClContext = (fst this.OclContextInfo).ClContext
39+
member this.OclContext: ClContext = (fst this.OclContextInfo).ClContext
4240
member this.WorkGroupSize = snd this.OclContextInfo
4341

4442
member this.Processor =
@@ -78,24 +76,21 @@ type Benchmarks<'elem when 'elem : struct>(
7876
reader.ReadMatrix converter
7977

8078
member this.Mxm() =
81-
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly firstMatrix secondMatrix
79+
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly matrix matrix
8280

8381
member this.ClearInputMatrices() =
84-
firstMatrix.Dispose this.Processor
85-
secondMatrix.Dispose this.Processor
82+
matrix.Dispose this.Processor
8683

8784
member this.ClearResult() =
8885
match this.ResultMatrix with
8986
| Some matrix -> matrix.Dispose this.Processor
9087
| None -> ()
9188

9289
member this.ReadMatrices() =
93-
firstMatrixHost <- this.ReadMatrix this.InputMatrixReader
94-
secondMatrixHost <- this.ReadMatrix this.InputMatrixReader
90+
matrixHost <- this.ReadMatrix this.InputMatrixReader
9591

9692
member this.LoadMatricesToGPU () =
97-
firstMatrix <- buildMatrix this.OclContext firstMatrixHost
98-
secondMatrix <- buildMatrix this.OclContext secondMatrixHost
93+
matrix <- buildMatrix this.OclContext matrixHost
9994

10095
abstract member GlobalSetup : unit -> unit
10196

0 commit comments

Comments
 (0)