Skip to content

Commit dacc3e1

Browse files
committed
merge dev
1 parent 63a44e3 commit dacc3e1

File tree

45 files changed

+250
-2089
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

+250
-2089
lines changed

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

Lines changed: 6 additions & 36 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(10)>]
16-
[<WarmupCount(3)>]
15+
[<IterationCount(100)>]
16+
[<WarmupCount(10)>]
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<ClVector<'elem>> with get,set
30+
member val ResultLevels = Unchecked.defaultof<ClArray<'elem option>> with get,set
3131

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

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

7976
member this.ReadMatrix() =
8077
let converter =
@@ -139,30 +136,6 @@ type BFSWithoutTransferBenchmarkInt32() =
139136
static member InputMatrixProvider =
140137
Benchmarks<_>.InputMatrixProviderBuilder "BFSBenchmarks.txt"
141138

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-
166139
type WithTransferBenchmark<'elem when 'elem : struct>(
167140
buildFunToBenchmark,
168141
converter: string -> 'elem,
@@ -194,11 +167,8 @@ type WithTransferBenchmark<'elem when 'elem : struct>(
194167
override this.Benchmark() =
195168
this.LoadMatrixToGPU()
196169
this.BFS()
197-
match this.ResultLevels with
198-
| ClVector.Dense result ->
199-
result.ToHost this.Processor |> ignore
200-
this.Processor.PostAndReply Msg.MsgNotifyMe
201-
| _ -> failwith "Impossible"
170+
this.ResultLevels.ToHost this.Processor |> ignore
171+
this.Processor.PostAndReply Msg.MsgNotifyMe
202172

203173
type BFSWithTransferBenchmarkInt32() =
204174

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

Lines changed: 0 additions & 132 deletions
This file was deleted.

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

Lines changed: 1 addition & 2 deletions
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,7 +25,6 @@
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" />
2928
<Compile Include="Program.fs" />
3029
<Folder Include="Datasets" />
3130
</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 = ""
49+
let datasetFolder = "EWiseAdd"
5050
pathToConfig
5151
|> Utils.getMatricesFilenames
5252
|> Seq.map

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

Lines changed: 13 additions & 8 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.Matrix>)>]
16+
[<Config(typeof<Configs.Matrix2>)>]
1717
type Benchmarks<'elem when 'elem : struct>(
1818
buildFunToBenchmark,
1919
converter: string -> 'elem,
@@ -22,9 +22,11 @@ type Benchmarks<'elem when 'elem : struct>(
2222

2323
let mutable funToBenchmark = None
2424

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

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

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

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

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

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

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

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

8285
member this.ClearResult() =
8386
match this.ResultMatrix with
8487
| Some matrix -> matrix.Dispose this.Processor
8588
| None -> ()
8689

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

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

9398
abstract member GlobalSetup : unit -> unit
9499

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 = ""
54+
let datasetFolder = "Mxm"
5555
pathToConfig
5656
|> Utils.getMatricesFilenames
5757
|> Seq.map

benchmarks/GraphBLAS-sharp.Benchmarks/Program.fs

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

119
benchmarks.Run argv |> ignore
1210
0

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

Lines changed: 4 additions & 10 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> option> with get,set
30+
member val ResultVector = Unchecked.defaultof<ClVector<'elem>> with get,set
3131

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

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

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

174168
[<IterationCleanup>]
175169
override this.IterationCleanup () =

0 commit comments

Comments
 (0)