Skip to content

SpGeMM refactor #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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