@@ -14,17 +14,22 @@ open GraphBLAS.FSharp.Backend.Matrix.COO
1414module internal MSBFS =
1515 let private frontExclude ( clContext : ClContext ) workGroupSize =
1616
17- let excludeValues = ClArray.excludeElements clContext workGroupSize
17+ let excludeValues =
18+ ClArray.excludeElements clContext workGroupSize
1819
19- let excludeIndices = ClArray.excludeElements clContext workGroupSize
20+ let excludeIndices =
21+ ClArray.excludeElements clContext workGroupSize
2022
2123 fun ( queue : MailboxProcessor < _ >) allocationMode ( front : ClMatrix.COO < _ >) ( intersection : ClArray < int >) ->
2224
23- let newRows = excludeIndices queue allocationMode intersection front.Rows
25+ let newRows =
26+ excludeIndices queue allocationMode intersection front.Rows
2427
25- let newColumns = excludeIndices queue allocationMode intersection front.Columns
28+ let newColumns =
29+ excludeIndices queue allocationMode intersection front.Columns
2630
27- let newValues = excludeValues queue allocationMode intersection front.Values
31+ let newValues =
32+ excludeValues queue allocationMode intersection front.Values
2833
2934 match newRows, newColumns, newValues with
3035 | Some rows, Some columns, Some values ->
@@ -42,17 +47,21 @@ module internal MSBFS =
4247
4348 let updateFront = frontExclude clContext workGroupSize
4449
45- let mergeDisjoint = Matrix.mergeDisjoint clContext workGroupSize
50+ let mergeDisjoint =
51+ Matrix.mergeDisjoint clContext workGroupSize
4652
47- let findIntersection = Intersect.findKeysIntersection clContext workGroupSize
53+ let findIntersection =
54+ Intersect.findKeysIntersection clContext workGroupSize
4855
4956 fun ( queue : MailboxProcessor < _ >) allocationMode ( front : ClMatrix.COO < _ >) ( levels : ClMatrix.COO < _ >) ->
5057
5158 // Find intersection of levels and front indices.
52- let intersection = findIntersection queue DeviceOnly front levels
59+ let intersection =
60+ findIntersection queue DeviceOnly front levels
5361
5462 // Remove mutual elements
55- let newFront = updateFront queue allocationMode front intersection
63+ let newFront =
64+ updateFront queue allocationMode front intersection
5665
5766 intersection.Free queue
5867
@@ -75,15 +84,15 @@ module internal MSBFS =
7584
7685 let copy = Matrix.copy clContext workGroupSize
7786
78- let updateFrontAndLevels = updateFrontAndLevels clContext workGroupSize
87+ let updateFrontAndLevels =
88+ updateFrontAndLevels clContext workGroupSize
7989
8090 fun ( queue : MailboxProcessor < Msg >) ( matrix : ClMatrix < 'a >) ( source : int list ) ->
8191 let vertexCount = matrix.RowCount
8292 let sourceVertexCount = source.Length
8393
8494 let startMatrix =
85- source
86- |> List.mapi ( fun i vertex -> i, vertex, 1 )
95+ source |> List.mapi ( fun i vertex -> i, vertex, 1 )
8796
8897 let mutable levels =
8998 startMatrix
@@ -124,50 +133,55 @@ module internal MSBFS =
124133 workGroupSize
125134 =
126135
127- let SSBFS = BFS.singleSourceSparse add mul clContext workGroupSize
136+ let SSBFS =
137+ BFS.singleSourceSparse add mul clContext workGroupSize
128138
129139 fun ( queue : MailboxProcessor < Msg >) ( matrix : ClMatrix < 'a >) ( source : int list ) ->
130- source
131- |> List.map ( SSBFS queue matrix)
140+ source |> List.map ( SSBFS queue matrix)
132141
133142 module Parents =
134143 let private updateFrontAndParents ( clContext : ClContext ) workGroupSize =
135144 // update parents same as levels
136145 // every front value should be equal to its column number
137146 let frontExclude = frontExclude clContext workGroupSize
138147
139- let mergeDisjoint = Matrix.mergeDisjoint clContext workGroupSize
148+ let mergeDisjoint =
149+ Matrix.mergeDisjoint clContext workGroupSize
140150
141- let findIntersection = Intersect.findKeysIntersection clContext workGroupSize
151+ let findIntersection =
152+ Intersect.findKeysIntersection clContext workGroupSize
142153
143154 fun ( queue : MailboxProcessor < Msg >) allocationMode ( front : ClMatrix.COO < _ >) ( parents : ClMatrix.COO < _ >) ->
144155
145156 // Find intersection of levels and front indices.
146- let intersection = findIntersection queue DeviceOnly front parents
157+ let intersection =
158+ findIntersection queue DeviceOnly front parents
147159
148160 // Remove mutual elements
149- let newFront = frontExclude queue allocationMode front intersection
161+ let newFront =
162+ frontExclude queue allocationMode front intersection
150163
151164 intersection.Free queue
152165
153166 match newFront with
154167 | Some f ->
155168 // Update levels
156- let resultFront =
157- { f with Values = f.Columns }
169+ let resultFront = { f with Values = f.Columns }
158170 let newLevels = mergeDisjoint queue parents f
159171 newLevels, Some resultFront
160172 | _ -> parents, None
161173
162- let run < 'a when 'a : struct >
163- ( clContext : ClContext )
164- workGroupSize
165- =
174+ let run < 'a when 'a : struct > ( clContext : ClContext ) workGroupSize =
166175
167176 let spGeMM =
168- Operations.SpGeMM.COO.expand ( ArithmeticOperations.min - 1 ) ( ArithmeticOperations.fst - 1 ) clContext workGroupSize
169-
170- let updateFrontAndLevels = updateFrontAndParents clContext workGroupSize
177+ Operations.SpGeMM.COO.expand
178+ ( ArithmeticOperations.min - 1 )
179+ ( ArithmeticOperations.fst - 1 )
180+ clContext
181+ workGroupSize
182+
183+ let updateFrontAndLevels =
184+ updateFrontAndParents clContext workGroupSize
171185
172186 fun ( queue : MailboxProcessor < Msg >) ( inputMatrix : ClMatrix < 'a >) ( source : int list ) ->
173187 let vertexCount = inputMatrix.RowCount
0 commit comments