11namespace GraphBLAS.FSharp.Benchmarks
22
33open System.IO
4- open System.Text .RegularExpressions
5- open GraphBLAS.FSharp
4+ open GraphBLAS.FSharp .Backend .Quotes
65open GraphBLAS.FSharp .IO
76open BenchmarkDotNet.Attributes
87open BenchmarkDotNet.Configs
98open BenchmarkDotNet.Columns
109open Brahma.FSharp
11- open OpenCL.Net
10+ open GraphBLAS.FSharp .Objects
11+ open GraphBLAS.FSharp .Backend .Objects
12+ open GraphBLAS.FSharp .Backend .Matrix .COO
13+ open GraphBLAS.FSharp .Backend .Matrix .CSR
14+ open GraphBLAS.FSharp .Objects .Matrix
15+ open GraphBLAS.FSharp .Benchmarks .MatrixExtensions
1216
1317type Config () =
1418 inherit ManualConfig()
@@ -43,7 +47,7 @@ type Config() =
4347[<IterationCount( 100 ) >]
4448[<WarmupCount( 10 ) >]
4549[<Config( typeof< Config>) >]
46- type EWiseAddBenchmarks < 'matrixT , 'elem when 'matrixT :> Backend. IDeviceMemObject and 'elem : struct >(
50+ type EWiseAddBenchmarks < 'matrixT , 'elem when 'matrixT :> IDeviceMemObject and 'elem : struct >(
4751 buildFunToBenchmark,
4852 converter: string -> 'elem,
4953 converterBool,
@@ -107,11 +111,11 @@ type EWiseAddBenchmarks<'matrixT, 'elem when 'matrixT :> Backend.IDeviceMemObjec
107111 this.ResultMatrix <- this.FunToBenchmark this.Processor firstMatrix secondMatrix
108112
109113 member this.ClearInputMatrices () =
110- ( firstMatrix :> Backend. IDeviceMemObject) .Dispose this.Processor
111- ( secondMatrix :> Backend. IDeviceMemObject) .Dispose this.Processor
114+ ( firstMatrix :> IDeviceMemObject) .Dispose this.Processor
115+ ( secondMatrix :> IDeviceMemObject) .Dispose this.Processor
112116
113117 member this.ClearResult () =
114- ( this.ResultMatrix :> Backend. IDeviceMemObject) .Dispose this.Processor
118+ ( this.ResultMatrix :> IDeviceMemObject) .Dispose this.Processor
115119
116120 member this.ReadMatrices () =
117121 let leftMatrixReader = fst this.InputMatrixReader
@@ -131,7 +135,7 @@ type EWiseAddBenchmarks<'matrixT, 'elem when 'matrixT :> Backend.IDeviceMemObjec
131135
132136 abstract member Benchmark : unit -> unit
133137
134- type EWiseAddBenchmarksWithoutDataTransfer < 'matrixT , 'elem when 'matrixT :> Backend. IDeviceMemObject and 'elem : struct >(
138+ type EWiseAddBenchmarksWithoutDataTransfer < 'matrixT , 'elem when 'matrixT :> IDeviceMemObject and 'elem : struct >(
135139 buildFunToBenchmark,
136140 converter: string -> 'elem,
137141 converterBool,
@@ -161,7 +165,7 @@ type EWiseAddBenchmarksWithoutDataTransfer<'matrixT, 'elem when 'matrixT :> Back
161165 this.EWiseAddition()
162166 this.Processor.PostAndReply( Msg.MsgNotifyMe)
163167
164- type EWiseAddBenchmarksWithDataTransfer < 'matrixT , 'elem when 'matrixT :> Backend. IDeviceMemObject and 'elem : struct >(
168+ type EWiseAddBenchmarksWithDataTransfer < 'matrixT , 'elem when 'matrixT :> IDeviceMemObject and 'elem : struct >(
165169 buildFunToBenchmark,
166170 converter: string -> 'elem,
167171 converterBool,
@@ -195,18 +199,18 @@ type EWiseAddBenchmarksWithDataTransfer<'matrixT, 'elem when 'matrixT :> Backend
195199 this.Processor.PostAndReply Msg.MsgNotifyMe
196200
197201module M =
198- let resultToHostCOO ( resultMatrix : Backend.COOMatrix < 'a >) ( procesor : MailboxProcessor < _ >) =
202+ let resultToHostCOO ( resultMatrix : ClMatrix.COO < 'a >) ( processor : MailboxProcessor < _ >) =
199203 let cols =
200204 let a = Array.zeroCreate resultMatrix.ColumnCount
201- procesor .Post( Msg.CreateToHostMsg<_>( resultMatrix.Columns, a))
205+ processor .Post( Msg.CreateToHostMsg<_>( resultMatrix.Columns, a))
202206 a
203207 let rows =
204208 let a = Array.zeroCreate resultMatrix.RowCount
205- procesor .Post( Msg.CreateToHostMsg( resultMatrix.Rows, a))
209+ processor .Post( Msg.CreateToHostMsg( resultMatrix.Rows, a))
206210 a
207211 let vals =
208212 let a = Array.zeroCreate resultMatrix.Values.Length
209- procesor .Post( Msg.CreateToHostMsg( resultMatrix.Values, a))
213+ processor .Post( Msg.CreateToHostMsg( resultMatrix.Values, a))
210214 a
211215 {
212216 RowCount = resultMatrix.RowCount
@@ -219,23 +223,23 @@ module M =
219223
220224type EWiseAddBenchmarks4Float32COOWithoutDataTransfer () =
221225
222- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix < float32>, float32>(
223- ( fun context wgSize -> Backend. COOMatrix.elementwise context Backend.Common.StandardOperations .float32Sum wgSize),
226+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.COO < float32>, float32>(
227+ ( fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations .float32Sum wgSize),
224228 float32,
225229 ( fun _ -> Utils.nextSingle ( System.Random())),
226- COOMatrix < float32 >. ToBackend
230+ Matrix.ToBackendCOO
227231 )
228232
229233 static member InputMatricesProvider =
230234 EWiseAddBenchmarks<_,_>. InputMatricesProviderBuilder " EWiseAddBenchmarks4Float32COO.txt"
231235
232236type EWiseAddBenchmarks4Float32COOWithDataTransfer () =
233237
234- inherit EWiseAddBenchmarksWithDataTransfer< Backend.COOMatrix < float32>, float32>(
235- ( fun context wgSize -> Backend. COOMatrix.elementwise context Backend.Common.StandardOperations .float32Sum wgSize),
238+ inherit EWiseAddBenchmarksWithDataTransfer< ClMatrix.COO < float32>, float32>(
239+ ( fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations .float32Sum wgSize),
236240 float32,
237241 ( fun _ -> Utils.nextSingle ( System.Random())),
238- COOMatrix < float32>. ToBackend ,
242+ Matrix.ToBackendCOO < float32>,
239243 M.resultToHostCOO
240244 )
241245
@@ -245,11 +249,11 @@ type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
245249
246250type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer () =
247251
248- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix < bool>, bool>(
249- ( fun context wgSize -> Backend. COOMatrix.elementwise context Backend.Common.StandardOperations .boolSum wgSize),
252+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.COO < bool>, bool>(
253+ ( fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations .boolSum wgSize),
250254 ( fun _ -> true ),
251255 ( fun _ -> true ),
252- COOMatrix < bool>. ToBackend
256+ Matrix.ToBackendCOO < bool>
253257 )
254258
255259 static member InputMatricesProvider =
@@ -258,11 +262,11 @@ type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
258262
259263type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer () =
260264
261- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix < float32>, float32>(
262- ( fun context wgSize -> Backend. CSRMatrix.elementwise context Backend.Common.StandardOperations .float32Sum wgSize),
265+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.CSR < float32>, float32>(
266+ ( fun context wgSize -> CSRMatrix.elementwise context ArithmeticOperations .float32Sum wgSize),
263267 float32,
264268 ( fun _ -> Utils.nextSingle ( System.Random())),
265- CSRMatrix < float32 >. ToBackend
269+ Matrix.ToBackendCSR
266270 )
267271
268272 static member InputMatricesProvider =
@@ -271,11 +275,11 @@ type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
271275
272276type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer () =
273277
274- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix < bool>, bool>(
275- ( fun context wgSize -> Backend. CSRMatrix.elementwise context Backend.Common.StandardOperations .boolSum wgSize),
278+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.CSR < bool>, bool>(
279+ ( fun context wgSize -> CSRMatrix.elementwise context ArithmeticOperations .boolSum wgSize),
276280 ( fun _ -> true ),
277281 ( fun _ -> true ),
278- CSRMatrix < bool >. ToBackend
282+ Matrix.ToBackendCSR
279283 )
280284
281285 static member InputMatricesProvider =
@@ -285,47 +289,47 @@ type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
285289
286290type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer () =
287291
288- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix < bool>, bool>(
289- ( fun context wgSize -> Backend. COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations .boolSumAtLeastOne wgSize),
292+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.COO < bool>, bool>(
293+ ( fun context wgSize -> COOMatrix.elementwiseAtLeastOne context ArithmeticOperations .boolSumAtLeastOne wgSize),
290294 ( fun _ -> true ),
291295 ( fun _ -> true ),
292- COOMatrix < bool>. ToBackend
296+ Matrix.ToBackendCOO < bool>
293297 )
294298
295299 static member InputMatricesProvider =
296300 EWiseAddBenchmarks<_, _>. InputMatricesProviderBuilder " EWiseAddBenchmarks4BoolCSR.txt"
297301
298302type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer () =
299303
300- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix < bool>, bool>(
301- ( fun context wgSize -> Backend. CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations .boolSumAtLeastOne wgSize),
304+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.CSR < bool>, bool>(
305+ ( fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context ArithmeticOperations .boolSumAtLeastOne wgSize),
302306 ( fun _ -> true ),
303307 ( fun _ -> true ),
304- CSRMatrix < bool >. ToBackend
308+ Matrix.ToBackendCSR
305309 )
306310
307311 static member InputMatricesProvider =
308312 EWiseAddBenchmarks<_, _>. InputMatricesProviderBuilder " EWiseAddBenchmarks4BoolCSR.txt"
309313
310314type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer () =
311315
312- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.COOMatrix < float32>, float32>(
313- ( fun context wgSize -> Backend. COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations .float32SumAtLeastOne wgSize),
316+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.COO < float32>, float32>(
317+ ( fun context wgSize -> COOMatrix.elementwiseAtLeastOne context ArithmeticOperations .float32SumAtLeastOne wgSize),
314318 float32,
315319 ( fun _ -> Utils.nextSingle ( System.Random())),
316- COOMatrix < float32>. ToBackend
320+ Matrix.ToBackendCOO < float32>
317321 )
318322
319323 static member InputMatricesProvider =
320324 EWiseAddBenchmarks<_,_>. InputMatricesProviderBuilder " EWiseAddBenchmarks4Float32COO.txt"
321325
322326type EWiseAddAtLeastOneBenchmarks4Float32CSRWithoutDataTransfer () =
323327
324- inherit EWiseAddBenchmarksWithoutDataTransfer< Backend.CSRMatrix < float32>, float32>(
325- ( fun context wgSize -> Backend. CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations .float32SumAtLeastOne wgSize),
328+ inherit EWiseAddBenchmarksWithoutDataTransfer< ClMatrix.CSR < float32>, float32>(
329+ ( fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context ArithmeticOperations .float32SumAtLeastOne wgSize),
326330 float32,
327331 ( fun _ -> Utils.nextSingle ( System.Random())),
328- CSRMatrix < float32>. ToBackend
332+ Matrix.ToBackendCSR < float32>
329333 )
330334
331335 static member InputMatricesProvider =
0 commit comments