Skip to content

Commit d6373cc

Browse files
committed
revert: kirill's changes comming with pagerank pr
1 parent dacc3e1 commit d6373cc

File tree

45 files changed

+1678
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1678
-285
lines changed

benchmarks/GraphBLAS-sharp.Benchmarks/Algorithms/BFS.fs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ open GraphBLAS.FSharp.Objects.ArraysExtensions
1212
open GraphBLAS.FSharp.Backend.Quotes
1313

1414
[<AbstractClass>]
15-
[<IterationCount(100)>]
16-
[<WarmupCount(10)>]
15+
[<IterationCount(10)>]
16+
[<WarmupCount(3)>]
1717
[<Config(typeof<Configs.Matrix>)>]
1818
type Benchmarks<'elem when 'elem : struct>(
1919
buildFunToBenchmark,
@@ -27,7 +27,7 @@ type Benchmarks<'elem when 'elem : struct>(
2727
let mutable matrix = Unchecked.defaultof<ClMatrix<'elem>>
2828
let mutable matrixHost = Unchecked.defaultof<_>
2929

30-
member val ResultLevels = Unchecked.defaultof<ClArray<'elem option>> with get,set
30+
member val ResultLevels = Unchecked.defaultof<ClVector<'elem>> with get,set
3131

3232
[<ParamsSource("AvailableContexts")>]
3333
member val OclContextInfo = Unchecked.defaultof<Utils.BenchmarkContext * int> with get, set
@@ -71,7 +71,10 @@ type Benchmarks<'elem when 'elem : struct>(
7171
member this.ClearInputMatrix() =
7272
matrix.Dispose this.Processor
7373

74-
member this.ClearResult() = this.ResultLevels.FreeAndWait this.Processor
74+
member this.ClearResult() =
75+
match this.ResultLevels with
76+
| ClVector.Dense result -> result.FreeAndWait this.Processor
77+
| _ -> failwith "Impossible"
7578

7679
member this.ReadMatrix() =
7780
let converter =
@@ -136,6 +139,30 @@ type BFSWithoutTransferBenchmarkInt32() =
136139
static member InputMatrixProvider =
137140
Benchmarks<_>.InputMatrixProviderBuilder "BFSBenchmarks.txt"
138141

142+
type BFSPushPullWithoutTransferBenchmarkInt32() =
143+
144+
inherit WithoutTransferBenchmark<int>(
145+
(Algorithms.BFS.singleSourcePushPull ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption),
146+
int32,
147+
(fun _ -> Utils.nextInt (System.Random())),
148+
0,
149+
(fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context))
150+
151+
static member InputMatrixProvider =
152+
Benchmarks<_>.InputMatrixProviderBuilder "BFSBenchmarks.txt"
153+
154+
type SSSPWithoutTransferBenchmarkInt32() =
155+
156+
inherit WithoutTransferBenchmark<int>(
157+
Algorithms.SSSP.run,
158+
int32,
159+
(fun _ -> Utils.nextInt (System.Random())),
160+
0,
161+
(fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context))
162+
163+
static member InputMatrixProvider =
164+
Benchmarks<_>.InputMatrixProviderBuilder "BFSBenchmarks.txt"
165+
139166
type WithTransferBenchmark<'elem when 'elem : struct>(
140167
buildFunToBenchmark,
141168
converter: string -> 'elem,
@@ -167,8 +194,11 @@ type WithTransferBenchmark<'elem when 'elem : struct>(
167194
override this.Benchmark() =
168195
this.LoadMatrixToGPU()
169196
this.BFS()
170-
this.ResultLevels.ToHost this.Processor |> ignore
171-
this.Processor.PostAndReply Msg.MsgNotifyMe
197+
match this.ResultLevels with
198+
| ClVector.Dense result ->
199+
result.ToHost this.Processor |> ignore
200+
this.Processor.PostAndReply Msg.MsgNotifyMe
201+
| _ -> failwith "Impossible"
172202

173203
type BFSWithTransferBenchmarkInt32() =
174204

benchmarks/GraphBLAS-sharp.Benchmarks/GraphBLAS-sharp.Benchmarks.fsproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -25,6 +25,7 @@
2525
<Compile Include="Matrix/Map2/MathNET.fs" />
2626
<Compile Include="Vector/Map2.fs" />
2727
<Compile Include="Algorithms/BFS.fs" />
28+
<Compile Include="Algorithms/PageRank.fs" />
2829
<Compile Include="Program.fs" />
2930
<Folder Include="Datasets" />
3031
</ItemGroup>

benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/Map2/Map2.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type Benchmarks<'matrixT, 'elem when 'matrixT :> IDeviceMemObject and 'elem : st
4646
static member AvailableContexts = Utils.availableContexts
4747

4848
static member InputMatricesProviderBuilder pathToConfig =
49-
let datasetFolder = "EWiseAdd"
49+
let datasetFolder = ""
5050
pathToConfig
5151
|> Utils.getMatricesFilenames
5252
|> Seq.map

benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ open GraphBLAS.FSharp.Benchmarks
1313
[<AbstractClass>]
1414
[<IterationCount(100)>]
1515
[<WarmupCount(10)>]
16-
[<Config(typeof<Configs.Matrix2>)>]
16+
[<Config(typeof<Configs.Matrix>)>]
1717
type Benchmarks<'elem when 'elem : struct>(
1818
buildFunToBenchmark,
1919
converter: string -> 'elem,
@@ -22,11 +22,9 @@ type Benchmarks<'elem when 'elem : struct>(
2222

2323
let mutable funToBenchmark = None
2424

25-
let mutable firstMatrix = Unchecked.defaultof<ClMatrix<'elem>>
26-
let mutable secondMatrix = Unchecked.defaultof<ClMatrix<'elem>>
25+
let mutable matrix = Unchecked.defaultof<ClMatrix<'elem>>
2726

28-
let mutable firstMatrixHost = Unchecked.defaultof<_>
29-
let mutable secondMatrixHost = Unchecked.defaultof<_>
27+
let mutable matrixHost = Unchecked.defaultof<_>
3028

3129
member val ResultMatrix = Unchecked.defaultof<ClMatrix.COO<'elem> option> with get, set
3230

@@ -36,7 +34,7 @@ type Benchmarks<'elem when 'elem : struct>(
3634
[<ParamsSource("InputMatrixProvider")>]
3735
member val InputMatrixReader = Unchecked.defaultof<MtxReader> with get, set
3836

39-
member this.OclContext:ClContext = (fst this.OclContextInfo).ClContext
37+
member this.OclContext: ClContext = (fst this.OclContextInfo).ClContext
4038
member this.WorkGroupSize = snd this.OclContextInfo
4139

4240
member this.Processor =
@@ -76,24 +74,21 @@ type Benchmarks<'elem when 'elem : struct>(
7674
reader.ReadMatrix converter
7775

7876
member this.Mxm() =
79-
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly firstMatrix secondMatrix
77+
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly matrix matrix
8078

8179
member this.ClearInputMatrices() =
82-
firstMatrix.Dispose this.Processor
83-
secondMatrix.Dispose this.Processor
80+
matrix.Dispose this.Processor
8481

8582
member this.ClearResult() =
8683
match this.ResultMatrix with
8784
| Some matrix -> matrix.Dispose this.Processor
8885
| None -> ()
8986

9087
member this.ReadMatrices() =
91-
firstMatrixHost <- this.ReadMatrix this.InputMatrixReader
92-
secondMatrixHost <- this.ReadMatrix this.InputMatrixReader
88+
matrixHost <- this.ReadMatrix this.InputMatrixReader
9389

9490
member this.LoadMatricesToGPU () =
95-
firstMatrix <- buildMatrix this.OclContext firstMatrixHost
96-
secondMatrix <- buildMatrix this.OclContext secondMatrixHost
91+
matrix <- buildMatrix this.OclContext matrixHost
9792

9893
abstract member GlobalSetup : unit -> unit
9994

benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Masked.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type Masked<'elem when 'elem : struct>(
5151
static member AvaliableContexts = Utils.availableContexts
5252

5353
static member InputMatrixProviderBuilder pathToConfig =
54-
let datasetFolder = "Mxm"
54+
let datasetFolder = ""
5555
pathToConfig
5656
|> Utils.getMatricesFilenames
5757
|> Seq.map

benchmarks/GraphBLAS-sharp.Benchmarks/Program.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ open BenchmarkDotNet.Running
44
[<EntryPoint>]
55
let main argv =
66
let benchmarks =
7-
BenchmarkSwitcher [| typeof<Algorithms.BFS.BFSWithoutTransferBenchmarkInt32> |]
7+
BenchmarkSwitcher [| typeof<Algorithms.BFS.BFSWithoutTransferBenchmarkInt32>
8+
typeof<Algorithms.BFS.BFSPushPullWithoutTransferBenchmarkInt32>
9+
typeof<Algorithms.PageRank.PageRankWithoutTransferBenchmarkFloat32> |]
810

911
benchmarks.Run argv |> ignore
1012
0

benchmarks/GraphBLAS-sharp.Benchmarks/Vector/Map2.fs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Benchmarks<'elem when 'elem : struct>(
2727

2828
member val HostVectorPair = Unchecked.defaultof<Vector<'elem> * Vector<'elem>> with get, set
2929

30-
member val ResultVector = Unchecked.defaultof<ClVector<'elem>> with get,set
30+
member val ResultVector = Unchecked.defaultof<ClVector<'elem> option> with get,set
3131

3232
[<ParamsSource("AvailableContexts")>]
3333
member val OclContextInfo = Unchecked.defaultof<Utils.BenchmarkContext * int> with get, set
@@ -67,7 +67,9 @@ type Benchmarks<'elem when 'elem : struct>(
6767
secondVector.Dispose this.Processor
6868

6969
member this.ClearResult() =
70-
this.ResultVector.Dispose this.Processor
70+
match this.ResultVector with
71+
| Some v -> v.Dispose this.Processor
72+
| None -> ()
7173

7274
member this.CreateVectors() =
7375
this.HostVectorPair <- List.last (Gen.sample this.Size 1 generator)
@@ -162,8 +164,12 @@ module WithTransfer =
162164
override this.Benchmark () =
163165
this.LoadVectorsToGPU()
164166
this.Map2()
165-
this.ResultVector.ToHost this.Processor |> ignore
166-
this.Processor.PostAndReply Msg.MsgNotifyMe
167+
match this.ResultVector with
168+
| Some v ->
169+
v.ToHost this.Processor |> ignore
170+
this.Processor.PostAndReply Msg.MsgNotifyMe
171+
| None -> ()
172+
167173

168174
[<IterationCleanup>]
169175
override this.IterationCleanup () =

0 commit comments

Comments
 (0)