Skip to content

Commit

Permalink
Merge pull request #82 from IgorErin/splitbench
Browse files Browse the repository at this point in the history
SpGeMM refactor
  • Loading branch information
gsvgit authored May 23, 2023
2 parents b494dab + 41309d9 commit de357df
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 118 deletions.
21 changes: 8 additions & 13 deletions benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ open GraphBLAS.FSharp.Backend
[<AbstractClass>]
[<IterationCount(100)>]
[<WarmupCount(10)>]
[<Config(typeof<Configs.Matrix2>)>]
[<Config(typeof<Configs.Matrix>)>]
type Benchmarks<'elem when 'elem : struct>(
buildFunToBenchmark,
converter: string -> 'elem,
Expand All @@ -24,11 +24,9 @@ type Benchmarks<'elem when 'elem : struct>(

let mutable funToBenchmark = None

let mutable firstMatrix = Unchecked.defaultof<ClMatrix<'elem>>
let mutable secondMatrix = Unchecked.defaultof<ClMatrix<'elem>>
let mutable matrix = Unchecked.defaultof<ClMatrix<'elem>>

let mutable firstMatrixHost = Unchecked.defaultof<_>
let mutable secondMatrixHost = Unchecked.defaultof<_>
let mutable matrixHost = Unchecked.defaultof<_>

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

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

member this.OclContext:ClContext = (fst this.OclContextInfo).ClContext
member this.OclContext: ClContext = (fst this.OclContextInfo).ClContext
member this.WorkGroupSize = snd this.OclContextInfo

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

member this.Mxm() =
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly firstMatrix secondMatrix
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly matrix matrix

member this.ClearInputMatrices() =
firstMatrix.Dispose this.Processor
secondMatrix.Dispose this.Processor
matrix.Dispose this.Processor

member this.ClearResult() =
match this.ResultMatrix with
| Some matrix -> matrix.Dispose this.Processor
| None -> ()

member this.ReadMatrices() =
firstMatrixHost <- this.ReadMatrix this.InputMatrixReader
secondMatrixHost <- this.ReadMatrix this.InputMatrixReader
matrixHost <- this.ReadMatrix this.InputMatrixReader

member this.LoadMatricesToGPU () =
firstMatrix <- buildMatrix this.OclContext firstMatrixHost
secondMatrix <- buildMatrix this.OclContext secondMatrixHost
matrix <- buildMatrix this.OclContext matrixHost

abstract member GlobalSetup : unit -> unit

Expand Down
Loading

0 comments on commit de357df

Please sign in to comment.