@@ -92,89 +92,87 @@ type Benchmarks<'elem when 'elem : struct>(
9292
9393 abstract member Benchmark : unit -> unit
9494
95- module WithoutTransfer =
96- type Benchmark < 'elem when 'elem : struct >(
95+ type WithoutTransferBenchmark < 'elem when 'elem : struct >(
96+ buildFunToBenchmark,
97+ converter: string -> 'elem,
98+ boolConverter,
99+ vertex) =
100+
101+ inherit Benchmarks< 'elem>(
97102 buildFunToBenchmark,
98- converter: string -> 'elem ,
103+ converter,
99104 boolConverter,
100- vertex) =
105+ vertex)
101106
102- inherit Benchmarks< 'elem>(
103- buildFunToBenchmark,
104- converter,
105- boolConverter,
106- vertex)
107+ [<GlobalSetup>]
108+ override this.GlobalSetup () =
109+ this.ReadMatrix()
110+ this.LoadMatrixToGPU()
107111
108- [<GlobalSetup>]
109- override this.GlobalSetup () =
110- this.ReadMatrix()
111- this.LoadMatrixToGPU()
112+ [<IterationCleanup>]
113+ override this.IterationCleanup () =
114+ this.ClearResult()
112115
113- [<IterationCleanup >]
114- override this.IterationCleanup () =
115- this.ClearResult ()
116+ [<GlobalCleanup >]
117+ override this.GlobalCleanup () =
118+ this.ClearInputMatrix ()
116119
117- [<GlobalCleanup>]
118- override this.GlobalCleanup () =
119- this.ClearInputMatrix()
120+ [<Benchmark>]
121+ override this.Benchmark () =
122+ this.BFS()
123+ this.Processor.PostAndReply Msg.MsgNotifyMe
120124
121- [<Benchmark>]
122- override this.Benchmark () =
123- this.BFS()
124- this.Processor.PostAndReply Msg.MsgNotifyMe
125+ type BFSWithoutTransferBenchmarkInt32 () =
125126
126- type Int () =
127+ inherit WithoutTransferBenchmark< int>(
128+ ( singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption),
129+ int32,
130+ ( fun _ -> Utils.nextInt ( System.Random())),
131+ 0 )
127132
128- inherit Benchmark< int>(
129- ( singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption),
130- int32,
131- ( fun _ -> Utils.nextInt ( System.Random())),
132- 0 )
133+ static member InputMatrixProvider =
134+ Benchmarks<_>. InputMatrixProviderBuilder " BFSBenchmarks.txt"
133135
134- static member InputMatrixProvider =
135- Benchmark<_>. InputMatrixProviderBuilder " BFSBenchmarks.txt"
136+ type WithTransferBenchmark < 'elem when 'elem : struct >(
137+ buildFunToBenchmark,
138+ converter: string -> 'elem,
139+ boolConverter,
140+ vertex) =
136141
137- module WithTransfer =
138- type Benchmark < 'elem when 'elem : struct >(
142+ inherit Benchmarks< 'elem>(
139143 buildFunToBenchmark,
140- converter: string -> 'elem ,
144+ converter,
141145 boolConverter,
142- vertex) =
143-
144- inherit Benchmarks< 'elem>(
145- buildFunToBenchmark,
146- converter,
147- boolConverter,
148- vertex)
149-
150- [<GlobalSetup>]
151- override this.GlobalSetup () =
152- this.ReadMatrix()
153-
154- [<GlobalCleanup>]
155- override this.GlobalCleanup () =
156- this.ClearResult()
157-
158- [<IterationCleanup>]
159- override this.IterationCleanup () =
160- this.ClearInputMatrix()
161- this.ClearResult()
162-
163- [<Benchmark>]
164- override this.Benchmark () =
165- this.LoadMatrixToGPU()
166- this.BFS()
167- this.ResultLevels.ToHost this.Processor |> ignore
168- this.Processor.PostAndReply Msg.MsgNotifyMe
169-
170- type Int () =
171-
172- inherit Benchmark< int>(
173- ( singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption),
174- int32,
175- ( fun _ -> Utils.nextInt ( System.Random())),
176- 0 )
177-
178- static member InputMatrixProvider =
179- Benchmark<_>. InputMatrixProviderBuilder " BFSBenchmarks.txt"
146+ vertex)
147+
148+ [<GlobalSetup>]
149+ override this.GlobalSetup () =
150+ this.ReadMatrix()
151+
152+ [<GlobalCleanup>]
153+ override this.GlobalCleanup () =
154+ this.ClearResult()
155+
156+ [<IterationCleanup>]
157+ override this.IterationCleanup () =
158+ this.ClearInputMatrix()
159+ this.ClearResult()
160+
161+ [<Benchmark>]
162+ override this.Benchmark () =
163+ this.LoadMatrixToGPU()
164+ this.BFS()
165+ this.ResultLevels.ToHost this.Processor |> ignore
166+ this.Processor.PostAndReply Msg.MsgNotifyMe
167+
168+ type BFSWithTransferBenchmarkInt32 () =
169+
170+ inherit WithTransferBenchmark< int>(
171+ ( singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption),
172+ int32,
173+ ( fun _ -> Utils.nextInt ( System.Random())),
174+ 0 )
175+
176+ static member InputMatrixProvider =
177+ Benchmarks<_>. InputMatrixProviderBuilder " BFSBenchmarks.txt"
180178
0 commit comments