@@ -8,6 +8,7 @@ open Expecto
88open GraphBLAS.FSharp .Backend .Common
99open GraphBLAS.FSharp .Backend .Predefined
1010open GraphBLAS.FSharp .Backend .Objects .ClCell
11+ open GraphBLAS.FSharp .Backend .Objects .ClContext
1112
1213let context = Context.defaultContext
1314
@@ -28,7 +29,7 @@ let leftMatrix =
2829 { RowCount = 5
2930 ColumnCount = 5
3031 RowPointers = [| 0 ; 2 ; 2 ; 5 ; 6 ; 8 |]
31- ColumnIndices = [| 2 ; 3 ; 1 ; 3 ; 4 ; 2 ; 0 ; 1 |]
32+ ColumnIndices = [| 2 ; 3 ; 1 ; 3 ; 4 ; 2 ; 0 ; 1 |]
3233 Values = [| 2 ; 3 ; 8 ; 5 ; 4 ; 2 ; 1 ; 7 |] }
3334
3435/// <remarks >
@@ -110,7 +111,7 @@ let getRequiredRightMatrixValuesPointersTest =
110111 |> Expect.equal result [| 3 ; 5 ; 0 ; 5 ; 8 ; 3 ; 0 ; 0 ; |]
111112
112113let getGlobalPositions () =
113- let getGlobalPositions = Expand.getGlobalPositions clContext Utils.defaultWorkGroupSize
114+ let getGlobalPositions = Expand.getGlobalMap clContext Utils.defaultWorkGroupSize
114115
115116 getGlobalPositions processor globalLength ( getGlobalRightMatrixRawsStartPositions ())
116117
@@ -124,13 +125,13 @@ let getGlobalPositionsTest =
124125
125126let getRightMatrixValuesPointers () =
126127 let getRightMatrixValuesPointers =
127- Expand.getRightMatrixPointers clContext Utils.defaultWorkGroupSize
128+ Expand.expandRightMatrixValuesIndices clContext Utils.defaultWorkGroupSize
128129
129130 let globalPositions = getGlobalPositions ()
130131 let globalRightMatrixRawsStartPositions = getGlobalRightMatrixRawsStartPositions ()
131132 let requiredRightMatrixValuesPointers = getRequiredRightMatrixValuesPointers ()
132133
133- getRightMatrixValuesPointers processor globalLength globalPositions globalRightMatrixRawsStartPositions requiredRightMatrixValuesPointers
134+ getRightMatrixValuesPointers processor globalLength globalRightMatrixRawsStartPositions requiredRightMatrixValuesPointers globalPositions
134135
135136let rightMatrixValuesPointersTest =
136137 testCase " RightMatrixValuesPointers"
@@ -139,3 +140,42 @@ let rightMatrixValuesPointersTest =
139140
140141 " Result must be the same"
141142 |> Expect.equal result [| 3 ; 4 ; 5 ; 6 ; 7 ; 0 ; 1 ; 2 ; 5 ; 6 ; 7 ; 8 ; 9 ; 3 ; 4 ; 0 ; 1 ; 2 ; |]
143+
144+ let gatherRightMatrixData () =
145+ let getRightMatrixColumnsAndValues =
146+ Expand.getRightMatrixColumnsAndValues clContext Utils.defaultWorkGroupSize
147+
148+ let rightMatrixValuesPointers = getRightMatrixValuesPointers ()
149+
150+ getRightMatrixColumnsAndValues processor globalLength rightMatrixValuesPointers deviceRightMatrix.Values deviceRightMatrix.Columns
151+
152+ let checkGatherRightMatrixData =
153+ testCase " gather right matrix data test"
154+ <| fun () ->
155+ let values , columns = gatherRightMatrixData ()
156+
157+ let hostValues = values.ToHostAndFree processor
158+
159+ " Result must be the same"
160+ |> Expect.equal hostValues [| 2 ; 2 ; 5 ; 9 ; 1 ; 3 ; 4 ; 4 ; 5 ; 9 ; 1 ; 1 ; 8 ; 2 ; 2 ; 3 ; 4 ; 4 ; |]
161+
162+ let hostColumns = columns.ToHostAndFree processor
163+
164+ " Result must be the same"
165+ |> Expect.equal hostColumns [| 2 ; 5 ; 1 ; 5 ; 6 ; 1 ; 4 ; 6 ; 1 ; 5 ; 6 ; 4 ; 6 ; 2 ; 5 ; 1 ; 4 ; 6 ; |]
166+
167+ let getLeftMatrixValues () =
168+ let getLeftMatrixValues =
169+ Expand.getLeftMatrixValuesCorrespondinglyToPositionsPattern clContext Utils.defaultWorkGroupSize
170+
171+ let globalPositions = getGlobalPositions ()
172+
173+ getLeftMatrixValues processor globalLength globalPositions deviceLeftMatrix.Values
174+
175+ let getLeftMatrixValuesTest =
176+ testCase " get left matrix values"
177+ <| fun () ->
178+ let result = ( getLeftMatrixValues ()) .ToHostAndFree processor
179+
180+ " Left matrix values must be the same"
181+ |> Expect.equal result [| 2 ; 2 ; 3 ; 3 ; 3 ; 8 ; 8 ; 8 ; 5 ; 5 ; 5 ; 4 ; 4 ; 2 ; 2 ; 7 ; 7 ; 7 |]
0 commit comments