1- namespace GraphBLAS.FSharp.Benchmarks.Algorithms.BFS
1+ namespace GraphBLAS.FSharp.Benchmarks.Algorithms.BFS
22
33open System.IO
44open BenchmarkDotNet.Attributes
@@ -9,11 +9,12 @@ open GraphBLAS.FSharp.IO
99open GraphBLAS.FSharp .Benchmarks
1010open GraphBLAS.FSharp .Objects
1111open GraphBLAS.FSharp .Objects .ArraysExtensions
12+ open GraphBLAS.FSharp .Objects .MailboxProcessorExtensions
1213open GraphBLAS.FSharp .Backend .Quotes
1314
1415[<AbstractClass>]
15- [<IterationCount( 100 ) >]
16- [<WarmupCount( 10 ) >]
16+ [<IterationCount( 10 ) >]
17+ [<WarmupCount( 3 ) >]
1718[<Config( typeof< Configs.Matrix>) >]
1819type Benchmarks < 'elem when 'elem : struct >(
1920 buildFunToBenchmark,
@@ -27,7 +28,7 @@ type Benchmarks<'elem when 'elem : struct>(
2728 let mutable matrix = Unchecked.defaultof< ClMatrix< 'elem>>
2829 let mutable matrixHost = Unchecked.defaultof<_>
2930
30- member val ResultLevels = Unchecked.defaultof< ClVector< 'elem >> with get, set
31+ member val ResultLevels = Unchecked.defaultof< ClVector< int >> with get, set
3132
3233 [<ParamsSource( " AvailableContexts" ) >]
3334 member val OclContextInfo = Unchecked.defaultof< Utils.BenchmarkContext * int> with get, set
@@ -113,10 +114,12 @@ type WithoutTransferBenchmark<'elem when 'elem : struct>(
113114 override this.GlobalSetup () =
114115 this.ReadMatrix()
115116 this.LoadMatrixToGPU()
117+ finish this.Processor
116118
117119 [<IterationCleanup>]
118120 override this.IterationCleanup () =
119121 this.ClearResult()
122+ finish this.Processor
120123
121124 [<GlobalCleanup>]
122125 override this.GlobalCleanup () =
@@ -127,10 +130,34 @@ type WithoutTransferBenchmark<'elem when 'elem : struct>(
127130 this.BFS()
128131 this.Processor.PostAndReply Msg.MsgNotifyMe
129132
130- type BFSWithoutTransferBenchmarkInt32 () =
133+ type BFSWithoutTransferBenchmarkBool () =
134+
135+ inherit WithoutTransferBenchmark< bool>(
136+ ( Algorithms.BFS.singleSource ArithmeticOperations.boolSumOption ArithmeticOperations.boolMulOption),
137+ ( fun _ -> true ),
138+ ( fun _ -> true ),
139+ 0 ,
140+ ( fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context))
141+
142+ static member InputMatrixProvider =
143+ Benchmarks<_>. InputMatrixProviderBuilder " BFSBenchmarks.txt"
144+
145+ type BFSPushPullWithoutTransferBenchmarkBool () =
146+
147+ inherit WithoutTransferBenchmark< bool>(
148+ ( Algorithms.BFS.singleSourcePushPull ArithmeticOperations.boolSumOption ArithmeticOperations.boolMulOption),
149+ ( fun _ -> true ),
150+ ( fun _ -> true ),
151+ 0 ,
152+ ( fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context))
153+
154+ static member InputMatrixProvider =
155+ Benchmarks<_>. InputMatrixProviderBuilder " BFSBenchmarks.txt"
156+
157+ type SSSPWithoutTransferBenchmarkInt32 () =
131158
132159 inherit WithoutTransferBenchmark< int>(
133- ( Algorithms.BFS.singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption ) ,
160+ Algorithms.SSSP.run ,
134161 int32,
135162 ( fun _ -> Utils.nextInt ( System.Random())),
136163 0 ,
@@ -156,6 +183,7 @@ type WithTransferBenchmark<'elem when 'elem : struct>(
156183 [<GlobalSetup>]
157184 override this.GlobalSetup () =
158185 this.ReadMatrix()
186+ finish this.Processor
159187
160188 [<GlobalCleanup>]
161189 override this.GlobalCleanup () =
@@ -165,6 +193,7 @@ type WithTransferBenchmark<'elem when 'elem : struct>(
165193 override this.IterationCleanup () =
166194 this.ClearInputMatrix()
167195 this.ClearResult()
196+ finish this.Processor
168197
169198 [<Benchmark>]
170199 override this.Benchmark () =
@@ -176,12 +205,12 @@ type WithTransferBenchmark<'elem when 'elem : struct>(
176205 this.Processor.PostAndReply Msg.MsgNotifyMe
177206 | _ -> failwith " Impossible"
178207
179- type BFSWithTransferBenchmarkInt32 () =
208+ type BFSWithTransferBenchmarkBool () =
180209
181- inherit WithTransferBenchmark< int >(
182- ( Algorithms.BFS.singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption ),
183- int32 ,
184- ( fun _ -> Utils.nextInt ( System.Random ()) ),
210+ inherit WithTransferBenchmark< bool >(
211+ ( Algorithms.BFS.singleSource ArithmeticOperations.boolSumOption ArithmeticOperations.boolMulOption ),
212+ ( fun _ -> true ) ,
213+ ( fun _ -> true ),
185214 0 ,
186215 ( fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context))
187216
0 commit comments