Skip to content

Commit 98e7271

Browse files
committed
refactor: ToCSC, ToCSR
1 parent aeea80e commit 98e7271

20 files changed

Lines changed: 1334 additions & 1528 deletions

File tree

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksEWiseAdd.fs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ open BenchmarkDotNet.Columns
99
open Brahma.FSharp
1010
open GraphBLAS.FSharp.Objects
1111
open GraphBLAS.FSharp.Backend.Objects
12-
open GraphBLAS.FSharp.Backend.Matrix.COO
13-
open GraphBLAS.FSharp.Backend.Matrix.CSR
12+
open GraphBLAS.FSharp.Backend.Matrix
1413
open GraphBLAS.FSharp.Objects.Matrix
1514
open GraphBLAS.FSharp.Benchmarks.MatrixExtensions
1615
open GraphBLAS.FSharp.Backend.Objects.ClContext
@@ -196,7 +195,7 @@ module M =
196195
type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
197196

198197
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<float32>,float32>(
199-
(fun context wgSize -> COOMatrix.map2 context ArithmeticOperations.float32Sum wgSize),
198+
(fun context wgSize -> COO.Matrix.map2 context ArithmeticOperations.float32Sum wgSize),
200199
float32,
201200
(fun _ -> Utils.nextSingle (System.Random())),
202201
Matrix.ToBackendCOO
@@ -208,7 +207,7 @@ type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
208207
type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
209208

210209
inherit EWiseAddBenchmarksWithDataTransfer<ClMatrix.COO<float32>,float32>(
211-
(fun context wgSize -> COOMatrix.map2 context ArithmeticOperations.float32Sum wgSize),
210+
(fun context wgSize -> COO.Matrix.map2 context ArithmeticOperations.float32Sum wgSize),
212211
float32,
213212
(fun _ -> Utils.nextSingle (System.Random())),
214213
Matrix.ToBackendCOO<float32>,
@@ -222,7 +221,7 @@ type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
222221
type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
223222

224223
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<bool>,bool>(
225-
(fun context wgSize -> COOMatrix.map2 context ArithmeticOperations.boolSum wgSize),
224+
(fun context wgSize -> COO.Matrix.map2 context ArithmeticOperations.boolSum wgSize),
226225
(fun _ -> true),
227226
(fun _ -> true),
228227
Matrix.ToBackendCOO<bool>
@@ -235,7 +234,7 @@ type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
235234
type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
236235

237236
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<float32>,float32>(
238-
(fun context wgSize -> CSRMatrix.map2 context ArithmeticOperations.float32Sum wgSize),
237+
(fun context wgSize -> CSR.Matrix.map2 context ArithmeticOperations.float32Sum wgSize),
239238
float32,
240239
(fun _ -> Utils.nextSingle (System.Random())),
241240
Matrix.ToBackendCSR
@@ -248,7 +247,7 @@ type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
248247
type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
249248

250249
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<bool>,bool>(
251-
(fun context wgSize -> CSRMatrix.map2 context ArithmeticOperations.boolSum wgSize),
250+
(fun context wgSize -> CSR.Matrix.map2 context ArithmeticOperations.boolSum wgSize),
252251
(fun _ -> true),
253252
(fun _ -> true),
254253
Matrix.ToBackendCSR
@@ -262,7 +261,7 @@ type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
262261
type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
263262

264263
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<bool>,bool>(
265-
(fun context wgSize -> COOMatrix.map2AtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize),
264+
(fun context wgSize -> COO.Matrix.map2AtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize),
266265
(fun _ -> true),
267266
(fun _ -> true),
268267
Matrix.ToBackendCOO<bool>
@@ -274,7 +273,7 @@ type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
274273
type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
275274

276275
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<bool>,bool>(
277-
(fun context wgSize -> CSRMatrix.map2AtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize),
276+
(fun context wgSize -> CSR.Matrix.map2AtLeastOne context ArithmeticOperations.boolSumAtLeastOne wgSize),
278277
(fun _ -> true),
279278
(fun _ -> true),
280279
Matrix.ToBackendCSR
@@ -286,7 +285,7 @@ type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
286285
type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
287286

288287
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.COO<float32>,float32>(
289-
(fun context wgSize -> COOMatrix.map2AtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize),
288+
(fun context wgSize -> COO.Matrix.map2AtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize),
290289
float32,
291290
(fun _ -> Utils.nextSingle (System.Random())),
292291
Matrix.ToBackendCOO<float32>
@@ -298,7 +297,7 @@ type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
298297
type EWiseAddAtLeastOneBenchmarks4Float32CSRWithoutDataTransfer() =
299298

300299
inherit EWiseAddBenchmarksWithoutDataTransfer<ClMatrix.CSR<float32>,float32>(
301-
(fun context wgSize -> CSRMatrix.map2AtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize),
300+
(fun context wgSize -> CSR.Matrix.map2AtLeastOne context ArithmeticOperations.float32SumAtLeastOne wgSize),
302301
float32,
303302
(fun _ -> Utils.nextSingle (System.Random())),
304303
Matrix.ToBackendCSR<float32>

benchmarks/GraphBLAS-sharp.Benchmarks/VectorEWiseAddGen.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ type VectorEWiseBenchmarksWithDataTransfer<'elem when 'elem : struct>(
155155
override this.GlobalCleanup() = ()
156156

157157
/// Without data transfer
158-
158+
/// AtLeastOne
159159
type VectorEWiseBenchmarks4FloatSparseWithoutDataTransfer() =
160160

161161
inherit VectorEWiseBenchmarksWithoutDataTransfer<float>(
@@ -173,13 +173,13 @@ type VectorEWiseBenchmarks4Int32SparseWithoutDataTransfer() =
173173
type VectorEWiseGeneralBenchmarks4FloatSparseWithoutDataTransfer() =
174174

175175
inherit VectorEWiseBenchmarksWithoutDataTransfer<float>(
176-
(fun context -> Vector.map2General context ArithmeticOperations.floatSum),
176+
(fun context -> Vector.map2 context ArithmeticOperations.floatSum),
177177
VectorGenerator.floatPair Sparse)
178178

179179
type VectorEWiseGeneralBenchmarks4Int32SparseWithoutDataTransfer() =
180180

181181
inherit VectorEWiseBenchmarksWithoutDataTransfer<int32>(
182-
(fun context -> Vector.map2General context ArithmeticOperations.intSum),
182+
(fun context -> Vector.map2 context ArithmeticOperations.intSum),
183183
VectorGenerator.intPair Sparse)
184184

185185
/// With data transfer
@@ -201,11 +201,11 @@ type VectorEWiseBenchmarks4Int32SparseWithDataTransfer() =
201201
type VectorEWiseGeneralBenchmarks4FloatSparseWithDataTransfer() =
202202

203203
inherit VectorEWiseBenchmarksWithDataTransfer<float>(
204-
(fun context -> Vector.map2General context ArithmeticOperations.floatSum),
204+
(fun context -> Vector.map2 context ArithmeticOperations.floatSum),
205205
VectorGenerator.floatPair Sparse)
206206

207207
type VectorEWiseGeneralBenchmarks4Int32SparseWithDataTransfer() =
208208

209209
inherit VectorEWiseBenchmarksWithDataTransfer<int32>(
210-
(fun context -> Vector.map2General context ArithmeticOperations.intSum),
210+
(fun context -> Vector.map2 context ArithmeticOperations.intSum),
211211
VectorGenerator.intPair Sparse)

src/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.fsproj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@
3535
<Compile Include="Predefined/PrefixSum.fs" />
3636
<!--Compile Include="Matrices.fs" /-->
3737
<Compile Include="Matrix/Common.fs" />
38-
<Compile Include="Matrix/COOMatrix/COOMatrix.fs" />
39-
<Compile Include="Matrix/CSRMatrix/Map2.fs" />
38+
<Compile Include="Matrix\COOMatrix\Map2.fs" />
39+
<Compile Include="Matrix\COOMatrix\Map2AtLeastOne.fs" />
40+
<Compile Include="Matrix\COOMatrix\Matrix.fs" />
41+
<Compile Include="Matrix\CSRMatrix\Map2AtLeastOne.fs" />
4042
<Compile Include="Matrix/CSRMatrix/SpGEMM.fs" />
41-
<Compile Include="Matrix/CSRMatrix/CSRMatrix.fs" />
43+
<Compile Include="Matrix\CSRMatrix\Matrix.fs" />
4244
<Compile Include="Matrix/Matrix.fs" />
45+
<Compile Include="Vector\SparseVector\Common.fs" />
4346
<Compile Include="Vector/SparseVector/Map2.fs" />
47+
<Compile Include="Vector\SparseVector\Map2AtLeastOne.fs" />
4448
<Compile Include="Vector/SparseVector/SparseVector.fs" />
4549
<Compile Include="Vector/DenseVector/DenseVector.fs" />
4650
<Compile Include="Vector/Vector.fs" />

0 commit comments

Comments
 (0)