Skip to content

Commit 1f1aba6

Browse files
committed
Merge branch 'dev' into vector
2 parents ace945d + 4bafd2b commit 1f1aba6

34 files changed

Lines changed: 1614 additions & 2111 deletions

File tree

benchmarks/GraphBLAS-sharp.Benchmarks/Helpers.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ open BenchmarkDotNet.Jobs
1414
open GraphBLAS.FSharp.Tests
1515
open FsCheck
1616
open Expecto
17+
open GraphBLAS.FSharp.Test
1718

1819
type CommonConfig() =
1920
inherit ManualConfig()
@@ -258,7 +259,7 @@ module Utils =
258259
module VectorGenerator =
259260
let private pairOfVectorsOfEqualSize (valuesGenerator: Gen<'a>) createVector =
260261
gen {
261-
let! length = Gen.sized <| fun size -> Gen.constant size
262+
let! length = Gen.sized <| Gen.constant
262263

263264
let! leftArray = Gen.arrayOfLength length valuesGenerator
264265

docsTool/templates/nav.fs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@ let navItemIconOnly link ariaLabel inner =
4848
]
4949

5050
let dropDownNavMenu text items =
51-
li [ Class "nav-item dropdown" ][
52-
a [
53-
Id (sprintf "navbarDropdown-%s" text)
54-
Href "#"
55-
DataToggle "dropdown"
56-
AriaHasPopup true
57-
AriaExpanded false
58-
Class "nav-link dropdown-toggle" ]
59-
[ normalizeStr text ]
60-
ul [ HTMLAttr.Custom ("aria-labelledby", "dropdownMenu1")
61-
Class "dropdown-menu border-0 shadow" ] items ]
51+
li [ Class "nav-item dropdown" ] [
52+
a [ Id (sprintf "navbarDropdown-%s" text)
53+
Href "#"
54+
DataToggle "dropdown"
55+
AriaHasPopup true
56+
AriaExpanded false
57+
Class "nav-link dropdown-toggle" ]
58+
[ normalizeStr text ]
59+
ul [ HTMLAttr.Custom ("aria-labelledby", "dropdownMenu1")
60+
Class "dropdown-menu border-0 shadow" ] items ]
6261

6362
let dropDownNavItem text link =
6463
li [

paket.lock

Lines changed: 141 additions & 314 deletions
Large diffs are not rendered by default.

src/GraphBLAS-sharp.Backend/Common/Utils.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
namespace GraphBLAS.FSharp.Backend.Common
22

3-
open Brahma.FSharp
4-
53
module internal Utils =
64
let defaultWorkGroupSize = 32
75

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,3 @@ module Common =
4242
valuesScatter processor positions allValues resultValues
4343

4444
resultRows, resultColumns, resultValues, resultLength
45-
46-

src/GraphBLAS-sharp.Backend/Quotes/Convert.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ module Convert =
2323
match rightItem with
2424
| Some _ -> (%op) leftItem None
2525
| None -> (%op) leftItem (Some value) @>
26-

src/GraphBLAS-sharp.Backend/Quotes/SubSum.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ module SubSum =
3535
sumGeneral<'a> <| sequentialAccess<'a> opAdd
3636

3737
let treeSum<'a> opAdd = sumGeneral<'a> <| treeAccess<'a> opAdd
38-

src/GraphBLAS-sharp/Objects/VectorExtensions.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ module ClVectorExtensions =
2222
Values = values
2323
Size = this.Size }
2424
| ClVector.Dense vector -> Vector.Dense <| vector.ToHost q
25-

tests/GraphBLAS-sharp.Tests/Algorithms/BFS.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let testFixtures (testContext: TestContext) =
1616
[ let config = Utils.undirectedAlgoConfig
1717
let context = testContext.ClContext
1818
let queue = testContext.Queue
19-
let workGroupSize = 32
19+
let workGroupSize = Utils.defaultWorkGroupSize
2020

2121
let testName =
2222
sprintf "Test on %A" testContext.ClContext
@@ -40,7 +40,7 @@ let testFixtures (testContext: TestContext) =
4040
|> Utils.createArrayFromDictionary (Array2D.length1 matrix) 0
4141

4242
let matrixHost =
43-
Utils.createMatrixFromArray2D CSR matrix (fun x -> x = 0)
43+
Utils.createMatrixFromArray2D CSR matrix ((=) 0)
4444

4545
let matrix = matrixHost.ToDevice context
4646

tests/GraphBLAS-sharp.Tests/Common/BitonicSort.fs

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,82 +5,81 @@ open Expecto.Logging
55
open Expecto.Logging.Message
66
open GraphBLAS.FSharp.Backend.Common
77
open Brahma.FSharp
8-
open GraphBLAS.FSharp.Tests.Utils
8+
open GraphBLAS.FSharp.Tests
99
open GraphBLAS.FSharp.Tests.Context
1010

1111
let logger = Log.create "BitonicSort.Tests"
1212

1313
let context = defaultContext.ClContext
14-
let config = { defaultConfig with endSize = 1000000 }
1514

16-
let wgSize = 32
15+
let config =
16+
{ Utils.defaultConfig with
17+
endSize = 1000000 }
18+
19+
let wgSize = Utils.defaultWorkGroupSize
20+
1721
let q = defaultContext.Queue
1822

1923
let makeTest sort (array: ('n * 'n * 'a) []) =
2024
if array.Length > 0 then
21-
let projection (row: 'n) (col: 'n) (v: 'a) = row, col
25+
let projection (row: 'n) (col: 'n) (_: 'a) = row, col
2226

2327
logger.debug (
2428
eventX "Initial size is {size}"
25-
>> setField "size" (sprintf "%A" array.Length)
29+
>> setField "size" $"%A{array.Length}"
2630
)
2731

2832
let rows, cols, vals = Array.unzip3 array
2933

3034
use clRows = context.CreateClArray rows
31-
use clCols = context.CreateClArray cols
32-
use clVals = context.CreateClArray vals
35+
use clColumns = context.CreateClArray cols
36+
use clValues = context.CreateClArray vals
3337

34-
let actualRows, actualCols, actualVals =
35-
sort q clRows clCols clVals
38+
let actualRows, actualCols, actualValues =
39+
sort q clRows clColumns clValues
3640

3741
let rows = Array.zeroCreate<'n> clRows.Length
38-
let cols = Array.zeroCreate<'n> clCols.Length
39-
let vals = Array.zeroCreate<'a> clVals.Length
42+
let columns = Array.zeroCreate<'n> clColumns.Length
43+
let values = Array.zeroCreate<'a> clValues.Length
4044

4145
q.Post(Msg.CreateToHostMsg(clRows, rows))
42-
q.Post(Msg.CreateToHostMsg(clCols, cols))
46+
q.Post(Msg.CreateToHostMsg(clColumns, columns))
4347

44-
q.PostAndReply(fun ch -> Msg.CreateToHostMsg(clVals, vals, ch))
48+
q.PostAndReply(fun ch -> Msg.CreateToHostMsg(clValues, values, ch))
4549
|> ignore
4650

47-
rows, cols, vals
51+
rows, columns, values
4852

49-
let expectedRows, expectedCols, expectedVals =
53+
let expectedRows, expectedCols, expectedValues =
5054
(rows, cols, vals)
5155
|||> Array.zip3
5256
|> Array.sortBy ((<|||) projection)
5357
|> Array.unzip3
5458

55-
(sprintf "Row arrays should be equal. Actual is \n%A, expected \n%A, input is \n%A" actualRows expectedRows rows)
56-
|> compareArrays (=) actualRows expectedRows
59+
$"Row arrays should be equal. Actual is \n%A{actualRows}, expected \n%A{expectedRows}, input is \n%A{rows}"
60+
|> Utils.compareArrays (=) actualRows expectedRows
5761

58-
(sprintf
59-
"Column arrays should be equal. Actual is \n%A, expected \n%A, input is \n%A"
60-
actualCols
61-
expectedCols
62-
cols)
63-
|> compareArrays (=) actualCols expectedCols
62+
$"Column arrays should be equal. Actual is \n%A{actualCols}, expected \n%A{expectedCols}, input is \n%A{cols}"
63+
|> Utils.compareArrays (=) actualCols expectedCols
6464

65-
(sprintf
66-
"Value arrays should be equal. Actual is \n%A, expected \n%A, input is \n%A"
67-
actualVals
68-
expectedVals
69-
vals)
70-
|> compareArrays (=) actualVals expectedVals
65+
$"Value arrays should be equal. Actual is \n%A{actualValues}, expected \n%A{expectedValues}, input is \n%A{vals}"
66+
|> Utils.compareArrays (=) actualValues expectedValues
7167

7268
let testFixtures<'a when 'a: equality> =
73-
let sort =
74-
BitonicSort.sortKeyValuesInplace<int, 'a> context wgSize
75-
76-
makeTest sort
77-
|> testPropertyWithConfig config (sprintf "Correctness on %A" typeof<'a>)
69+
BitonicSort.sortKeyValuesInplace<int, 'a> context wgSize
70+
|> makeTest
71+
|> testPropertyWithConfig config $"Correctness on %A{typeof<'a>}"
7872

7973
let tests =
8074
q.Error.Add(fun e -> failwithf "%A" e)
8175

8276
[ testFixtures<int>
83-
testFixtures<float>
77+
78+
if Utils.isFloat64Available context.ClDevice then
79+
testFixtures<float>
80+
81+
testFixtures<float32>
82+
8483
testFixtures<byte>
8584
testFixtures<bool> ]
8685
|> testList "Backend.Common.BitonicSort tests"

0 commit comments

Comments
 (0)