Skip to content

Commit 33a7c7b

Browse files
committed
refactor: flags in benchmarks
1 parent 97df0e4 commit 33a7c7b

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksEWiseAdd.fs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ open GraphBLAS.FSharp.Backend.Matrix.COO
1313
open GraphBLAS.FSharp.Backend.Matrix.CSR
1414
open GraphBLAS.FSharp.Objects.Matrix
1515
open GraphBLAS.FSharp.Benchmarks.MatrixExtensions
16+
open GraphBLAS.FSharp.Backend.Objects.ClContext
1617

1718
type Config() =
1819
inherit ManualConfig()
@@ -224,7 +225,7 @@ module M =
224225
type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
225226

226227
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<float32>,float32>(
227-
(fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations.float32Sum wgSize),
228+
(fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations.float32Sum wgSize CPUInterop),
228229
float32,
229230
(fun _ -> Utils.nextSingle (System.Random())),
230231
Matrix.ToBackendCOO
@@ -236,7 +237,7 @@ type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
236237
type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
237238

238239
inherit EWiseAddBenchmarksWithDataTransfer<ClMatrix.COO<float32>,float32>(
239-
(fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations.float32Sum wgSize),
240+
(fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations.float32Sum wgSize CPUInterop),
240241
float32,
241242
(fun _ -> Utils.nextSingle (System.Random())),
242243
Matrix.ToBackendCOO<float32>,
@@ -250,7 +251,7 @@ type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
250251
type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
251252

252253
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<bool>,bool>(
253-
(fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations.boolSum wgSize),
254+
(fun context wgSize -> COOMatrix.elementwise context ArithmeticOperations.boolSum wgSize CPUInterop),
254255
(fun _ -> true),
255256
(fun _ -> true),
256257
Matrix.ToBackendCOO<bool>
@@ -263,7 +264,7 @@ type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
263264
type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
264265

265266
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<float32>,float32>(
266-
(fun context wgSize -> CSRMatrix.elementwise context ArithmeticOperations.float32Sum wgSize),
267+
(fun context wgSize -> CSRMatrix.elementwise context ArithmeticOperations.float32Sum wgSize CPUInterop),
267268
float32,
268269
(fun _ -> Utils.nextSingle (System.Random())),
269270
Matrix.ToBackendCSR
@@ -276,7 +277,7 @@ type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
276277
type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
277278

278279
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<bool>,bool>(
279-
(fun context wgSize -> CSRMatrix.elementwise context ArithmeticOperations.boolSum wgSize),
280+
(fun context wgSize -> CSRMatrix.elementwise context ArithmeticOperations.boolSum wgSize CPUInterop),
280281
(fun _ -> true),
281282
(fun _ -> true),
282283
Matrix.ToBackendCSR
@@ -290,7 +291,7 @@ type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
290291
type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
291292

292293
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<bool>,bool>(
293-
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize),
294+
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize CPUInterop),
294295
(fun _ -> true),
295296
(fun _ -> true),
296297
Matrix.ToBackendCOO<bool>
@@ -302,7 +303,7 @@ type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
302303
type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
303304

304305
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<bool>,bool>(
305-
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize),
306+
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize CPUInterop),
306307
(fun _ -> true),
307308
(fun _ -> true),
308309
Matrix.ToBackendCSR
@@ -314,7 +315,7 @@ type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
314315
type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
315316

316317
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<float32>,float32>(
317-
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize),
318+
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize CPUInterop),
318319
float32,
319320
(fun _ -> Utils.nextSingle (System.Random())),
320321
Matrix.ToBackendCOO<float32>
@@ -326,7 +327,7 @@ type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
326327
type EWiseAddAtLeastOneBenchmarks4Float32CSRWithoutDataTransfer() =
327328

328329
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<float32>,float32>(
329-
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize),
330+
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize CPUInterop),
330331
float32,
331332
(fun _ -> Utils.nextSingle (System.Random())),
332333
Matrix.ToBackendCSR<float32>

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksMxm.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ open GraphBLAS.FSharp.Objects
88
open GraphBLAS.FSharp.Backend.Objects
99
open GraphBLAS.FSharp.Backend.Matrix
1010
open GraphBLAS.FSharp.Benchmarks.MatrixExtensions
11+
open GraphBLAS.FSharp.Backend.Objects.ClContext
1112

1213
[<AbstractClass>]
1314
[<IterationCount(100)>]
@@ -74,15 +75,15 @@ type MxmBenchmarks<'elem when 'elem : struct>(
7475
member this.FunCSR2CSC =
7576
match funCSR2CSC with
7677
| None ->
77-
let x = Matrix.toCSCInplace this.OclContext this.WorkGroupSize
78+
let x = Matrix.toCSCInplace this.OclContext this.WorkGroupSize CPUInterop
7879
funCSR2CSC <- Some x
7980
x
8081
| Some x -> x
8182

8283
member this.FunCSC2CSR =
8384
match funCSC2CSR with
8485
| None ->
85-
let x = Matrix.toCSRInplace this.OclContext this.WorkGroupSize
86+
let x = Matrix.toCSRInplace this.OclContext this.WorkGroupSize CPUInterop
8687
funCSC2CSR <- Some x
8788
x
8889
| Some x -> x

0 commit comments

Comments
 (0)