Skip to content

Commit d06202f

Browse files
committed
refactor: --project in build, move ClMask
1 parent 6dcb977 commit d06202f

File tree

19 files changed

+38
-36
lines changed

19 files changed

+38
-36
lines changed

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksEWiseAdd.fs

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
namespace GraphBLAS.FSharp.Benchmarks
22

33
open System.IO
4-
open GraphBLAS.FSharp
54
open GraphBLAS.FSharp.IO
65
open BenchmarkDotNet.Attributes
76
open BenchmarkDotNet.Configs
87
open BenchmarkDotNet.Columns
98
open Brahma.FSharp
9+
open GraphBLAS.FSharp.Objects
1010
open GraphBLAS.FSharp.Backend.Objects
1111
open GraphBLAS.FSharp.Backend.Matrix.COO
1212
open GraphBLAS.FSharp.Backend.Matrix.CSR
13+
open GraphBLAS.FSharp.Backend.Common
1314

1415
type Config() =
1516
inherit ManualConfig()
@@ -221,7 +222,7 @@ module M =
221222
type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
222223

223224
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCOOMatrix<float32>,float32>(
224-
(fun context wgSize -> COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
225+
(fun context wgSize -> COOMatrix.elementwise context StandardOperations.float32Sum wgSize),
225226
float32,
226227
(fun _ -> Utils.nextSingle (System.Random())),
227228
COOMatrix<float32>.ToBackend
@@ -233,7 +234,7 @@ type EWiseAddBenchmarks4Float32COOWithoutDataTransfer() =
233234
type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
234235

235236
inherit EWiseAddBenchmarksWithDataTransfer<ClCOOMatrix<float32>,float32>(
236-
(fun context wgSize -> COOMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
237+
(fun context wgSize -> COOMatrix.elementwise context StandardOperations.float32Sum wgSize),
237238
float32,
238239
(fun _ -> Utils.nextSingle (System.Random())),
239240
COOMatrix<float32>.ToBackend,
@@ -247,7 +248,7 @@ type EWiseAddBenchmarks4Float32COOWithDataTransfer() =
247248
type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
248249

249250
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCOOMatrix<bool>,bool>(
250-
(fun context wgSize -> COOMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
251+
(fun context wgSize -> COOMatrix.elementwise context StandardOperations.boolSum wgSize),
251252
(fun _ -> true),
252253
(fun _ -> true),
253254
COOMatrix<bool>.ToBackend
@@ -260,7 +261,7 @@ type EWiseAddBenchmarks4BoolCOOWithoutDataTransfer() =
260261
type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
261262

262263
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCSRMatrix<float32>,float32>(
263-
(fun context wgSize -> CSRMatrix.elementwise context Backend.Common.StandardOperations.float32Sum wgSize),
264+
(fun context wgSize -> CSRMatrix.elementwise context StandardOperations.float32Sum wgSize),
264265
float32,
265266
(fun _ -> Utils.nextSingle (System.Random())),
266267
CSRMatrix<float32>.ToBackend
@@ -273,7 +274,7 @@ type EWiseAddBenchmarks4Float32CSRWithoutDataTransfer() =
273274
type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
274275

275276
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCSRMatrix<bool>,bool>(
276-
(fun context wgSize -> CSRMatrix.elementwise context Backend.Common.StandardOperations.boolSum wgSize),
277+
(fun context wgSize -> CSRMatrix.elementwise context StandardOperations.boolSum wgSize),
277278
(fun _ -> true),
278279
(fun _ -> true),
279280
CSRMatrix<bool>.ToBackend
@@ -287,7 +288,7 @@ type EWiseAddBenchmarks4BoolCSRWithoutDataTransfer() =
287288
type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
288289

289290
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCOOMatrix<bool>,bool>(
290-
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
291+
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context StandardOperations.boolSumAtLeastOne wgSize),
291292
(fun _ -> true),
292293
(fun _ -> true),
293294
COOMatrix<bool>.ToBackend
@@ -299,7 +300,7 @@ type EWiseAddAtLeastOneBenchmarks4BoolCOOWithoutDataTransfer() =
299300
type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
300301

301302
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCSRMatrix<bool>,bool>(
302-
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.boolSumAtLeastOne wgSize),
303+
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context StandardOperations.boolSumAtLeastOne wgSize),
303304
(fun _ -> true),
304305
(fun _ -> true),
305306
CSRMatrix<bool>.ToBackend
@@ -311,7 +312,7 @@ type EWiseAddAtLeastOneBenchmarks4BoolCSRWithoutDataTransfer() =
311312
type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
312313

313314
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCOOMatrix<float32>,float32>(
314-
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
315+
(fun context wgSize -> COOMatrix.elementwiseAtLeastOne context StandardOperations.float32SumAtLeastOne wgSize),
315316
float32,
316317
(fun _ -> Utils.nextSingle (System.Random())),
317318
COOMatrix<float32>.ToBackend
@@ -323,7 +324,7 @@ type EWiseAddAtLeastOneBenchmarks4Float32COOWithoutDataTransfer() =
323324
type EWiseAddAtLeastOneBenchmarks4Float32CSRWithoutDataTransfer() =
324325

325326
inherit EWiseAddBenchmarksWithoutDataTransfer<ClCSRMatrix<float32>,float32>(
326-
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context Backend.Common.StandardOperations.float32SumAtLeastOne wgSize),
327+
(fun context wgSize -> CSRMatrix.elementwiseAtLeastOne context StandardOperations.float32SumAtLeastOne wgSize),
327328
float32,
328329
(fun _ -> Utils.nextSingle (System.Random())),
329330
CSRMatrix<float32>.ToBackend

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksMathNET.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace GraphBLAS.FSharp.Benchmarks
22

33
open System.IO
4-
open GraphBLAS.FSharp
4+
open GraphBLAS.FSharp.Objects
55
open GraphBLAS.FSharp.IO
66
open BenchmarkDotNet.Attributes
77
open MathNet.Numerics.LinearAlgebra

benchmarks/GraphBLAS-sharp.Benchmarks/BenchmarksMxm.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace GraphBLAS.FSharp.Benchmarks
22

33
open System.IO
4-
open GraphBLAS.FSharp
54
open GraphBLAS.FSharp.IO
65
open BenchmarkDotNet.Attributes
76
open Brahma.FSharp
7+
open GraphBLAS.FSharp.Objects
88
open GraphBLAS.FSharp.Backend.Objects
99
open GraphBLAS.FSharp.Backend.Matrix
1010

@@ -24,7 +24,7 @@ type MxmBenchmarks<'elem when 'elem : struct>(
2424

2525
let mutable firstMatrix = Unchecked.defaultof<ClMatrix<'elem>>
2626
let mutable secondMatrix = Unchecked.defaultof<ClMatrix<'elem>>
27-
let mutable mask = Unchecked.defaultof<Backend.Mask2D>
27+
let mutable mask = Unchecked.defaultof<ClMask2D>
2828

2929
let mutable firstMatrixHost = Unchecked.defaultof<_>
3030
let mutable secondMatrixHost = Unchecked.defaultof<_>

build.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
echo Restoring dotnet tools...
22
dotnet tool restore
33

4-
dotnet run -p ./build/build.fsproj -- -t %*
4+
dotnet run --project ./build/build.fsproj -- -t %*

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -o pipefail
66
echo "Restoring dotnet tools..."
77
dotnet tool restore
88

9-
FAKE_DETAILED_ERRORS=true dotnet run -p ./build/build.fsproj -- -t "$@"
9+
FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@"

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
<Compile Include="Common/Reduce.fs" />
2323
<Compile Include="Predefined/PrefixSum.fs" />
2424
<!--Compile Include="Matrices.fs" /-->
25-
<Compile Include="Masks.fs" />
2625
<Compile Include="Objects/Common.fs" />
2726
<Compile Include="Objects/ArraysExtentions.fs" />
2827
<Compile Include="Objects/Vector.fs" />
2928
<Compile Include="Objects/Matrix.fs" />
29+
<Compile Include="Objects\Masks.fs" />
3030
<Compile Include="Matrix/COOMatrix/COOMatrix.fs" />
3131
<Compile Include="Matrix/CSRMatrix/Elementwise.fs" />
3232
<Compile Include="Matrix/CSRMatrix/SpGEMM.fs" />

src/GraphBLAS-sharp.Backend/Matrix/CSRMatrix/CSRMatrix.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,6 @@ module CSRMatrix =
254254
let run =
255255
SpGEMM.run clContext workGroupSize opAdd opMul
256256

257-
fun (queue: MailboxProcessor<_>) (matrixLeft: ClCSRMatrix<'a>) (matrixRight: ClCSCMatrix<'b>) (mask: Mask2D) ->
257+
fun (queue: MailboxProcessor<_>) (matrixLeft: ClCSRMatrix<'a>) (matrixRight: ClCSCMatrix<'b>) (mask: ClMask2D) ->
258258

259259
run queue matrixLeft matrixRight mask

src/GraphBLAS-sharp.Backend/Matrix/CSRMatrix/SpGEMM.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module internal SpGEMM =
106106

107107
let program = context.Compile(run)
108108

109-
fun (queue: MailboxProcessor<_>) (matrixLeft: ClCSRMatrix<'a>) (matrixRight: ClCSCMatrix<'b>) (mask: Mask2D) ->
109+
fun (queue: MailboxProcessor<_>) (matrixLeft: ClCSRMatrix<'a>) (matrixRight: ClCSCMatrix<'b>) (mask: ClMask2D) ->
110110

111111
let values =
112112
context.CreateClArray<'c>(
@@ -164,7 +164,7 @@ module internal SpGEMM =
164164
let scanInplace =
165165
PrefixSum.standardExcludeInplace context workGroupSize
166166

167-
fun (queue: MailboxProcessor<_>) (matrixLeft: ClCSRMatrix<'a>) (matrixRight: ClCSCMatrix<'b>) (mask: Mask2D) ->
167+
fun (queue: MailboxProcessor<_>) (matrixLeft: ClCSRMatrix<'a>) (matrixRight: ClCSCMatrix<'b>) (mask: ClMask2D) ->
168168

169169
let values, bitmap =
170170
calculate queue matrixLeft matrixRight mask

src/GraphBLAS-sharp.Backend/Matrix/Matrix.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ module Matrix =
474474
let runCSRnCSC =
475475
CSRMatrix.spgemmCSC clContext workGroupSize opAdd opMul
476476

477-
fun (queue: MailboxProcessor<_>) (matrix1: ClMatrix<'a>) (matrix2: ClMatrix<'b>) (mask: Mask2D) ->
477+
fun (queue: MailboxProcessor<_>) (matrix1: ClMatrix<'a>) (matrix2: ClMatrix<'b>) (mask: ClMask2D) ->
478478

479479
match matrix1, matrix2, mask.IsComplemented with
480480
| ClMatrixCSR m1, ClMatrixCSC m2, false -> runCSRnCSC queue m1 m2 mask |> ClMatrixCOO

src/GraphBLAS-sharp.Backend/Masks.fs renamed to src/GraphBLAS-sharp.Backend/Objects/Masks.fs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace GraphBLAS.FSharp.Backend
1+
namespace GraphBLAS.FSharp.Backend.Objects
22

33
open Brahma.FSharp
44

@@ -7,7 +7,7 @@ type MaskType =
77
| Complemented
88
| NoMask
99

10-
type Mask1D =
10+
type ClMask1D =
1111
{ Context: ClContext
1212
IsComplemented: bool
1313
Size: int
@@ -19,7 +19,7 @@ type Mask1D =
1919
q.Post(Msg.CreateFreeMsg<_>(this.Indices))
2020
q.PostAndReply(Msg.MsgNotifyMe)
2121

22-
type Mask2D =
22+
type ClMask2D =
2323
{ Context: ClContext
2424
IsComplemented: bool
2525
RowCount: int

src/GraphBLAS-sharp/IO/MtxReader.fs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
namespace GraphBLAS.FSharp.IO
22

33
open System.IO
4-
open GraphBLAS.FSharp
5-
open System
4+
open GraphBLAS.FSharp.Objects
65

76
type MtxReader(pathToFile: string) =
87
let mutable object = MtxMatrix

src/GraphBLAS-sharp/Objects/Masks.fs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
namespace GraphBLAS.FSharp
1+
namespace GraphBLAS.FSharp.Objects
22

33
open Brahma.FSharp
4-
open GraphBLAS.FSharp.Backend
4+
open GraphBLAS.FSharp.Backend.Objects
55

66
type MaskType =
77
| Regular
@@ -18,12 +18,12 @@ type Mask1D =
1818
member this.ToBackend(context: ClContext) =
1919
let indices = context.CreateClArray this.Indices
2020

21-
{ Backend.Mask1D.Context = context
21+
{ ClMask1D.Context = context
2222
IsComplemented = this.IsComplemented
2323
Size = this.Size
2424
Indices = indices }
2525

26-
static member FromBackend (q: MailboxProcessor<_>) (mask: Backend.Mask1D) =
26+
static member FromBackend (q: MailboxProcessor<_>) (mask: ClMask1D) =
2727
let indices = Array.zeroCreate mask.NNZ
2828

2929
let _ =
@@ -61,14 +61,14 @@ type Mask2D =
6161
let rows = context.CreateClArray this.Rows
6262
let columns = context.CreateClArray this.Columns
6363

64-
{ Backend.Mask2D.Context = context
64+
{ ClMask2D.Context = context
6565
IsComplemented = this.IsComplemented
6666
RowCount = this.RowCount
6767
ColumnCount = this.ColumnCount
6868
Rows = rows
6969
Columns = columns }
7070

71-
static member FromBackend (q: MailboxProcessor<_>) (mask: Backend.Mask2D) =
71+
static member FromBackend (q: MailboxProcessor<_>) (mask: ClMask2D) =
7272
let rows = Array.zeroCreate mask.Rows.Length
7373
let columns = Array.zeroCreate mask.Columns.Length
7474

src/GraphBLAS-sharp/Objects/Matrix.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace GraphBLAS.FSharp
1+
namespace GraphBLAS.FSharp.Objects
22

33
open Brahma.FSharp
44
open GraphBLAS.FSharp.Backend.Objects

src/GraphBLAS-sharp/Objects/Scalar.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace GraphBLAS.FSharp
1+
namespace GraphBLAS.FSharp.Objects
22

33
type Scalar<'a when 'a: struct> = ScalarWrapped of ArrayScalar<'a>
44

tests/GraphBLAS-sharp.Tests/Helpers.fs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ open Expecto.Logging.Message
1111
open System.Text.RegularExpressions
1212
open FSharp.Quotations.Evaluator
1313
open Expecto
14+
open GraphBLAS.FSharp.Objects
1415
open GraphBLAS.FSharp.Backend.Objects
1516

1617
[<AutoOpen>]

tests/GraphBLAS-sharp.Tests/Matrix/Convert.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ open Expecto.Logging.Message
66
open GraphBLAS.FSharp.Tests.Utils
77
open GraphBLAS.FSharp.Tests.Context
88
open GraphBLAS.FSharp.Backend
9-
open GraphBLAS.FSharp
9+
open GraphBLAS.FSharp.Objects
1010
open GraphBLAS.FSharp.Backend.Matrix
1111
open GraphBLAS.FSharp.Backend.Objects
1212

tests/GraphBLAS-sharp.Tests/Matrix/Elementwise.fs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ open Microsoft.FSharp.Collections
1111
open Backend.Common.StandardOperations
1212
open Utils
1313
open GraphBLAS.FSharp.Backend.Matrix
14+
open GraphBLAS.FSharp.Objects
1415
open GraphBLAS.FSharp.Backend.Objects
1516
open GraphBLAS.FSharp.Tests.Backend
1617

tests/GraphBLAS-sharp.Tests/Matrix/Mxm.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ open GraphBLAS.FSharp.Tests.Utils
66
open GraphBLAS.FSharp.Tests.Context
77
open GraphBLAS.FSharp.Tests
88
open GraphBLAS.FSharp.Backend
9-
open GraphBLAS.FSharp
9+
open GraphBLAS.FSharp.Objects
1010
open GraphBLAS.FSharp.Backend.Matrix
1111
open GraphBLAS.FSharp.Backend.Objects
1212

tests/GraphBLAS-sharp.Tests/Matrix/Transpose.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ open Expecto
44
open Expecto.Logging
55
open Expecto.Logging.Message
66
open GraphBLAS.FSharp.Backend
7-
open GraphBLAS.FSharp
7+
open GraphBLAS.FSharp.Objects
88
open GraphBLAS.FSharp.Tests.Utils
99
open GraphBLAS.FSharp.Tests.TestCases
1010
open GraphBLAS.FSharp.Backend.Matrix

0 commit comments

Comments
 (0)