11namespace GraphBLAS.FSharp.Benchmarks
22
33open System.IO
4- open System.Text .RegularExpressions
54open GraphBLAS.FSharp
65open GraphBLAS.FSharp .IO
76open BenchmarkDotNet.Attributes
87open BenchmarkDotNet.Configs
98open BenchmarkDotNet.Columns
109open Brahma.FSharp
11- open OpenCL.Net
10+ open GraphBLAS.FSharp .Backend .Objects
11+ open GraphBLAS.FSharp .Backend .Matrix .COO
12+ open GraphBLAS.FSharp .Backend .Matrix .CSR
1213
1314type Config () =
1415 inherit ManualConfig()
@@ -43,7 +44,7 @@ type Config() =
4344[<IterationCount( 100 ) >]
4445[<WarmupCount( 10 ) >]
4546[<Config( typeof< Config>) >]
46- type EWiseAddBenchmarks < 'matrixT , 'elem when 'matrixT :> Backend. IDeviceMemObject and 'elem : struct >(
47+ type EWiseAddBenchmarks < 'matrixT , 'elem when 'matrixT :> IDeviceMemObject and 'elem : struct >(
4748 buildFunToBenchmark,
4849 converter: string -> 'elem,
4950 converterBool,
@@ -107,11 +108,11 @@ type EWiseAddBenchmarks<'matrixT, 'elem when 'matrixT :> Backend.IDeviceMemObjec
107108 this.ResultMatrix <- this.FunToBenchmark this.Processor firstMatrix secondMatrix
108109
109110 member this.ClearInputMatrices () =
110- ( firstMatrix :> Backend. IDeviceMemObject) .Dispose this.Processor
111- ( secondMatrix :> Backend. IDeviceMemObject) .Dispose this.Processor
111+ ( firstMatrix :> IDeviceMemObject) .Dispose this.Processor
112+ ( secondMatrix :> IDeviceMemObject) .Dispose this.Processor
112113
113114 member this.ClearResult () =
114- ( this.ResultMatrix :> Backend. IDeviceMemObject) .Dispose this.Processor
115+ ( this.ResultMatrix :> IDeviceMemObject) .Dispose this.Processor
115116
116117 member this.ReadMatrices () =
117118 let leftMatrixReader = fst this.InputMatrixReader
@@ -131,7 +132,7 @@ type EWiseAddBenchmarks<'matrixT, 'elem when 'matrixT :> Backend.IDeviceMemObjec
131132
132133 abstract member Benchmark : unit -> unit
133134
134- type EWiseAddBenchmarksWithoutDataTransfer < 'matrixT , 'elem when 'matrixT :> Backend. IDeviceMemObject and 'elem : struct >(
135+ type EWiseAddBenchmarksWithoutDataTransfer < 'matrixT , 'elem when 'matrixT :> IDeviceMemObject and 'elem : struct >(
135136 buildFunToBenchmark,
136137 converter: string -> 'elem,
137138 converterBool,
@@ -161,7 +162,7 @@ type EWiseAddBenchmarksWithoutDataTransfer<'matrixT, 'elem when 'matrixT :> Back
161162 this.EWiseAddition()
162163 this.Processor.PostAndReply( Msg.MsgNotifyMe)
163164
164- type EWiseAddBenchmarksWithDataTransfer < 'matrixT , 'elem when 'matrixT :> Backend. IDeviceMemObject and 'elem : struct >(
165+ type EWiseAddBenchmarksWithDataTransfer < 'matrixT , 'elem when 'matrixT :> IDeviceMemObject and 'elem : struct >(
165166 buildFunToBenchmark,
166167 converter: string -> 'elem,
167168 converterBool,
@@ -195,18 +196,18 @@ type EWiseAddBenchmarksWithDataTransfer<'matrixT, 'elem when 'matrixT :> Backend
195196 this.Processor.PostAndReply Msg.MsgNotifyMe
196197
197198module M =
198- let resultToHostCOO ( resultMatrix : Backend. ClCOOMatrix< 'a >) ( procesor : MailboxProcessor < _ >) =
199+ let resultToHostCOO ( resultMatrix : ClCOOMatrix < 'a >) ( processor : MailboxProcessor < _ >) =
199200 let cols =
200201 let a = Array.zeroCreate resultMatrix.ColumnCount
201- procesor .Post( Msg.CreateToHostMsg<_>( resultMatrix.Columns, a))
202+ processor .Post( Msg.CreateToHostMsg<_>( resultMatrix.Columns, a))
202203 a
203204 let rows =
204205 let a = Array.zeroCreate resultMatrix.RowCount
205- procesor .Post( Msg.CreateToHostMsg( resultMatrix.Rows, a))
206+ processor .Post( Msg.CreateToHostMsg( resultMatrix.Rows, a))
206207 a
207208 let vals =
208209 let a = Array.zeroCreate resultMatrix.Values.Length
209- procesor .Post( Msg.CreateToHostMsg( resultMatrix.Values, a))
210+ processor .Post( Msg.CreateToHostMsg( resultMatrix.Values, a))
210211 a
211212 {
212213 RowCount = resultMatrix.RowCount
@@ -219,8 +220,8 @@ module M =
219220
220221type EWiseAddBenchmarks4Float32COOWithoutDataTransfer () =
221222
222- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCOOMatrix< float32>, float32>(
223- ( fun context wgSize -> Backend. COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
223+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCOOMatrix< float32>, float32>(
224+ ( fun context wgSize -> COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
224225 float32,
225226 ( fun _ -> Utils.nextSingle ( System.Random())),
226227 COOMatrix< float32>. ToBackend
@@ -231,8 +232,8 @@ type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
231232
232233type EWiseAddBenchmarks4Float32COOWithDataTransfer () =
233234
234- inherit EWiseAddBenchmarksWithDataTransfer< Backend. ClCOOMatrix< float32>, float32>(
235- ( fun context wgSize -> Backend. COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
235+ inherit EWiseAddBenchmarksWithDataTransfer< ClCOOMatrix< float32>, float32>(
236+ ( fun context wgSize -> COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
236237 float32,
237238 ( fun _ -> Utils.nextSingle ( System.Random())),
238239 COOMatrix< float32>. ToBackend,
@@ -245,8 +246,8 @@ type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
245246
246247type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer () =
247248
248- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCOOMatrix< bool>, bool>(
249- ( fun context wgSize -> Backend. COOMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
249+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCOOMatrix< bool>, bool>(
250+ ( fun context wgSize -> COOMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
250251 ( fun _ -> true ),
251252 ( fun _ -> true ),
252253 COOMatrix< bool>. ToBackend
@@ -258,8 +259,8 @@ type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
258259
259260type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer () =
260261
261- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCSRMatrix< float32>, float32>(
262- ( fun context wgSize -> Backend. CSRMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
262+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCSRMatrix< float32>, float32>(
263+ ( fun context wgSize -> CSRMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
263264 float32,
264265 ( fun _ -> Utils.nextSingle ( System.Random())),
265266 CSRMatrix< float32>. ToBackend
@@ -271,8 +272,8 @@ type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
271272
272273type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer () =
273274
274- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCSRMatrix< bool>, bool>(
275- ( fun context wgSize -> Backend. CSRMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
275+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCSRMatrix< bool>, bool>(
276+ ( fun context wgSize -> CSRMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
276277 ( fun _ -> true ),
277278 ( fun _ -> true ),
278279 CSRMatrix< bool>. ToBackend
@@ -285,8 +286,8 @@ type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
285286
286287type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer () =
287288
288- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCOOMatrix< bool>, bool>(
289- ( fun context wgSize -> Backend. COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
289+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCOOMatrix< bool>, bool>(
290+ ( fun context wgSize -> COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
290291 ( fun _ -> true ),
291292 ( fun _ -> true ),
292293 COOMatrix< bool>. ToBackend
@@ -297,8 +298,8 @@ type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
297298
298299type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer () =
299300
300- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCSRMatrix< bool>, bool>(
301- ( fun context wgSize -> Backend. CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
301+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCSRMatrix< bool>, bool>(
302+ ( fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
302303 ( fun _ -> true ),
303304 ( fun _ -> true ),
304305 CSRMatrix< bool>. ToBackend
@@ -309,8 +310,8 @@ type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
309310
310311type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer () =
311312
312- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCOOMatrix< float32>, float32>(
313- ( fun context wgSize -> Backend. COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
313+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCOOMatrix< float32>, float32>(
314+ ( fun context wgSize -> COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
314315 float32,
315316 ( fun _ -> Utils.nextSingle ( System.Random())),
316317 COOMatrix< float32>. ToBackend
@@ -321,8 +322,8 @@ type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
321322
322323type EWiseAddAtLeastOneBenchmarks4Float32CSRWithoutDataTransfer () =
323324
324- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend. ClCSRMatrix< float32>, float32>(
325- ( fun context wgSize -> Backend. CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
325+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClCSRMatrix< float32>, float32>(
326+ ( fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
326327 float32,
327328 ( fun _ -> Utils.nextSingle ( System.Random())),
328329 CSRMatrix< float32>. ToBackend
0 commit comments