Skip to content

Commit 97f971d

Browse files
committed
Start bench refactoring
1 parent 79a5d96 commit 97f971d

4 files changed

Lines changed: 84 additions & 50 deletions

File tree

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksEWiseAdd.fs

Lines changed: 76 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,65 +40,65 @@ type EWiseAddBenchmarks() =
4040
member val FirstMatrix = Unchecked.defaultof<COOFormat<float32>> with get, set
4141
member val SecondMatrix = Unchecked.defaultof<COOFormat<float32>> with get, set
4242

43-
[<ParamsSource("InputMatricesProvider")>]
44-
member val InputMatrix = Unchecked.defaultof<InputMatrixFormat> with get, set
43+
// [<ParamsSource("InputMatricesProvider")>]
44+
// member val InputMatrix = Unchecked.defaultof<InputMatrixFormat> with get, set
4545

4646
[<ParamsSource("AvaliableContexts")>]
4747
member val OclContext = Unchecked.defaultof<ClContext> with get, set
4848

49-
[<GlobalSetup>]
50-
member this.FormInputData() =
51-
let transposeCOO (matrix: COOFormat<float32>) =
52-
(matrix.Rows, matrix.Columns, matrix.Values)
53-
|||> Array.zip3
54-
|> Array.sortBy (fun (row, col, value) -> row)
55-
|> Array.unzip3
56-
|>
57-
fun (rows, cols, values) ->
58-
{
59-
Rows = cols
60-
Columns = rows
61-
Values = values
62-
RowCount = matrix.ColumnCount
63-
ColumnCount = matrix.RowCount
64-
}
65-
66-
this.FirstMatrix <- this.InputMatrix.MatrixStructure
67-
this.SecondMatrix <- this.InputMatrix.MatrixStructure |> transposeCOO
49+
// [<GlobalSetup>]
50+
// member this.FormInputData() =
51+
// let transposeCOO (matrix: COOFormat<float32>) =
52+
// (matrix.Rows, matrix.Columns, matrix.Values)
53+
// |||> Array.zip3
54+
// |> Array.sortBy (fun (row, col, value) -> row)
55+
// |> Array.unzip3
56+
// |>
57+
// fun (rows, cols, values) ->
58+
// {
59+
// Rows = cols
60+
// Columns = rows
61+
// Values = values
62+
// RowCount = matrix.ColumnCount
63+
// ColumnCount = matrix.RowCount
64+
// }
65+
66+
// this.FirstMatrix <- this.InputMatrix.MatrixStructure
67+
// this.SecondMatrix <- this.InputMatrix.MatrixStructure |> transposeCOO
6868

6969
[<IterationCleanup>]
7070
member this.ClearBuffers() =
7171
let (ClContext context) = this.OclContext
7272
context.Provider.CloseAllBuffers()
7373

7474
/// Sequence of paths to files where data for benchmarking will be taken from
75-
static member InputMatricesProvider =
76-
let matricesFilenames =
77-
seq {
78-
"arc130.mtx"
79-
"linux_call_graph.mtx"
80-
"webbase-1M.mtx"
81-
}
82-
83-
matricesFilenames
84-
|> Seq.map
85-
(fun matrixFilename ->
86-
let getFullPathToMatrix filename =
87-
Path.Combine [|
88-
__SOURCE_DIRECTORY__
89-
"Datasets"
90-
"EWiseAddDatasets"
91-
filename
92-
|]
93-
94-
let fullPath = getFullPathToMatrix matrixFilename
95-
let matrixName = Path.GetFileNameWithoutExtension matrixFilename
96-
let matrixStructure = GraphReader.readMtx fullPath
97-
{
98-
MatrixName = matrixName
99-
MatrixStructure = matrixStructure
100-
}
101-
)
75+
// static member InputMatricesProvider =
76+
// let matricesFilenames =
77+
// seq {
78+
// "arc130.mtx"
79+
// "linux_call_graph.mtx"
80+
// "webbase-1M.mtx"
81+
// }
82+
83+
// matricesFilenames
84+
// |> Seq.map
85+
// (fun matrixFilename ->
86+
// let getFullPathToMatrix filename =
87+
// Path.Combine [|
88+
// __SOURCE_DIRECTORY__
89+
// "Datasets"
90+
// "EWiseAddDatasets"
91+
// filename
92+
// |]
93+
94+
// let fullPath = getFullPathToMatrix matrixFilename
95+
// let matrixName = Path.GetFileNameWithoutExtension matrixFilename
96+
// let matrixStructure = GraphReader.readMtx fullPath
97+
// {
98+
// MatrixName = matrixName
99+
// MatrixStructure = matrixStructure
100+
// }
101+
// )
102102

103103
static member AvaliableContexts =
104104
let mutable e = ErrorCode.Unknown
@@ -161,6 +161,34 @@ type EWiseAddBenchmarks4Float32() =
161161
leftCOO.EWiseAdd rightCOO None Float32Semiring.addMult
162162
|> context.RunSync
163163

164+
static member InputMatricesProvider =
165+
let matricesFilenames =
166+
seq {
167+
"arc130.mtx"
168+
"linux_call_graph.mtx"
169+
"webbase-1M.mtx"
170+
}
171+
172+
matricesFilenames
173+
|> Seq.map
174+
(fun matrixFilename ->
175+
let getFullPathToMatrix filename =
176+
Path.Combine [|
177+
__SOURCE_DIRECTORY__
178+
"Datasets"
179+
"EWiseAddDatasets"
180+
filename
181+
|]
182+
183+
let fullPath = getFullPathToMatrix matrixFilename
184+
let matrixName = Path.GetFileNameWithoutExtension matrixFilename
185+
let matrixStructure = GraphReader.readMtx fullPath
186+
{
187+
MatrixName = matrixName
188+
MatrixStructure = matrixStructure
189+
}
190+
)
191+
164192
type EWiseAddBenchmarks4Bool() =
165193
inherit EWiseAddBenchmarks()
166194

benchmarks/GraphBLAS-sharp.Benchmarks/Common.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ with
2828

2929
sprintf "%s, %s" platformName deviceType
3030

31-
type InputMatrixFormat = {
31+
type InputMatrixFormat<'a> = {
3232
MatrixName: string
33-
MatrixStructure: COOFormat<float32>
33+
MatrixStructure: COOFormat<'a>
3434
}
3535
with
3636
override this.ToString() =

src/GraphBLAS-sharp/GraphBLAS-sharp.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.1;net461</TargetFrameworks>
5+
<AppConfig>app.config</AppConfig>
56
</PropertyGroup>
67
<PropertyGroup Condition="'$(Configuration)'=='Release'">
78
<Optimize>true</Optimize>

src/GraphBLAS-sharp/app.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
4+
<dllmap os="linux" dll="opencl.dll" target="/usr/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0"/>
5+
</configuration>

0 commit comments

Comments
 (0)