Skip to content

Commit 2ec5b78

Browse files
committed
Generalize benchmarks config
1 parent 6319d74 commit 2ec5b78

5 files changed

Lines changed: 28 additions & 54 deletions

File tree

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksBFS.fs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,7 @@ open OpenCL.Net
1313
open GraphBLAS.FSharp.IO
1414
open QuickGraph
1515

16-
type BFSConfig() =
17-
inherit ManualConfig()
18-
19-
do
20-
base.AddColumn(
21-
MatrixShapeColumn("RowCount", fun mtxReader -> mtxReader.ReadMatrixShape().RowCount) :> IColumn,
22-
MatrixShapeColumn("ColumnCount", fun mtxReader -> mtxReader.ReadMatrixShape().ColumnCount) :> IColumn,
23-
MatrixShapeColumn("NNZ", fun mtxReader -> mtxReader.ReadMatrixShape().Nnz) :> IColumn,
24-
TEPSColumn() :> IColumn,
25-
StatisticColumn.Min,
26-
StatisticColumn.Max
27-
) |> ignore
28-
29-
[<IterationCount(10)>]
30-
[<WarmupCount(3)>]
31-
[<InvocationCount(3)>]
32-
[<Config(typeof<BFSConfig>)>]
16+
[<Config(typeof<CommonConfig>)>]
3317
type BFSBenchmarks() =
3418
let random = Random()
3519

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksMxv.fs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,7 @@ open BenchmarkDotNet.Columns
77
open System.IO
88
open GraphBLAS.FSharp.IO
99

10-
type MxvConfig() =
11-
inherit ManualConfig()
12-
13-
do
14-
base.AddColumn(
15-
MatrixShapeColumn("RowCount", fun mtxReader -> mtxReader.ReadMatrixShape().RowCount) :> IColumn,
16-
MatrixShapeColumn("ColumnCount", fun mtxReader -> mtxReader.ReadMatrixShape().ColumnCount) :> IColumn,
17-
MatrixShapeColumn("NNZ", fun mtxReader -> mtxReader.ReadMatrixShape().Nnz) :> IColumn,
18-
TEPSColumn() :> IColumn,
19-
StatisticColumn.Min,
20-
StatisticColumn.Max
21-
) |> ignore
22-
23-
[<IterationCount(10)>]
24-
[<WarmupCount(3)>]
25-
[<InvocationCount(3)>]
26-
[<Config(typeof<MxvConfig>)>]
10+
[<Config(typeof<CommonConfig>)>]
2711
type MxvBenchmarks() =
2812
let rand = System.Random()
2913

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksTranspose.fs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,7 @@ open Brahma.FSharp.OpenCL.WorkflowBuilder.Evaluation
1212
open OpenCL.Net
1313
open GraphBLAS.FSharp.IO
1414

15-
type TransposeConfig() =
16-
inherit ManualConfig()
17-
18-
do
19-
base.AddColumn(
20-
MatrixShapeColumn("RowCount", fun mtxReader -> mtxReader.ReadMatrixShape().RowCount) :> IColumn,
21-
MatrixShapeColumn("ColumnCount", fun mtxReader -> mtxReader.ReadMatrixShape().ColumnCount) :> IColumn,
22-
MatrixShapeColumn("NNZ", fun mtxReader -> mtxReader.ReadMatrixShape().Nnz) :> IColumn,
23-
TEPSColumn() :> IColumn,
24-
StatisticColumn.Min,
25-
StatisticColumn.Max
26-
) |> ignore
27-
28-
[<IterationCount(10)>]
29-
[<WarmupCount(3)>]
30-
[<InvocationCount(3)>]
31-
[<Config(typeof<MxvConfig>)>]
15+
[<Config(typeof<CommonConfig>)>]
3216
type TransposeBenchmarks() =
3317
let mutable matrix = Unchecked.defaultof<Matrix<float>>
3418

benchmarks/GraphBLAS-sharp.Benchmarks/Helpers.fs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace GraphBLAS.FSharp.Benchmarks
1+
namespace rec GraphBLAS.FSharp.Benchmarks
22

33
open BenchmarkDotNet.Columns
44
open BenchmarkDotNet.Reports
@@ -8,6 +8,28 @@ open OpenCL.Net
88
open GraphBLAS.FSharp.IO
99
open System.IO
1010
open System.Text.RegularExpressions
11+
open BenchmarkDotNet.Configs
12+
open BenchmarkDotNet.Jobs
13+
14+
type CommonConfig() =
15+
inherit ManualConfig()
16+
17+
do
18+
base.AddColumn(
19+
MatrixShapeColumn("RowCount", fun mtxReader -> mtxReader.ReadMatrixShape().RowCount) :> IColumn,
20+
MatrixShapeColumn("ColumnCount", fun mtxReader -> mtxReader.ReadMatrixShape().ColumnCount) :> IColumn,
21+
MatrixShapeColumn("NNZ", fun mtxReader -> mtxReader.ReadMatrixShape().Nnz) :> IColumn,
22+
TEPSColumn() :> IColumn,
23+
StatisticColumn.Min,
24+
StatisticColumn.Max
25+
) |> ignore
26+
27+
base.AddJob(
28+
Job.Dry
29+
.WithWarmupCount(3)
30+
.WithIterationCount(10)
31+
.WithInvocationCount(3)
32+
) |> ignore
1133

1234
type ClContext = ClContext of OpenCLEvaluationContext
1335
with

src/GraphBLAS-sharp/Backend/CSRMatrix/Convert.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ module internal rec Convert =
110110
fun (ndRange: _1D)
111111
(nnzPerRowSparse: int[])
112112
(nonZeroRowsIndices: int[])
113-
(off2: int[]) ->
113+
(expandedNnzPerRow: int[]) ->
114114

115115
let gid = ndRange.GlobalID0
116116

117117
if gid < totalSum then
118-
off2.[nonZeroRowsIndices.[gid] + 1] <- nnzPerRowSparse.[gid]
118+
expandedNnzPerRow.[nonZeroRowsIndices.[gid] + 1] <- nnzPerRowSparse.[gid]
119119
@>
120120

121121
let expandedNnzPerRow = Array.zeroCreate (rowCount + 1)

0 commit comments

Comments
 (0)