Skip to content

Commit fbb4585

Browse files
committed
refactor: formatting
1 parent 224ddcd commit fbb4585

7 files changed

Lines changed: 68 additions & 28 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ module ClArray =
6464

6565
let create = create clContext workGroupSize
6666

67-
fun (processor: MailboxProcessor<_>) allocationMode length -> create processor allocationMode length Unchecked.defaultof<'a>
67+
fun (processor: MailboxProcessor<_>) allocationMode length ->
68+
create processor allocationMode length Unchecked.defaultof<'a>
6869

6970
let copy (clContext: ClContext) workGroupSize =
7071
let copy =

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,14 @@ module COOMatrix =
318318

319319
fun (processor: MailboxProcessor<_>) allocationMode (matrix: ClMatrix.COO<'a>) ->
320320

321-
let resultRows = copy processor allocationMode matrix.Rows
321+
let resultRows =
322+
copy processor allocationMode matrix.Rows
322323

323-
let resultColumns = copy processor allocationMode matrix.Columns
324+
let resultColumns =
325+
copy processor allocationMode matrix.Columns
324326

325-
let resultValues = copyData processor allocationMode matrix.Values
327+
let resultValues =
328+
copyData processor allocationMode matrix.Values
326329

327330
{ Context = clContext
328331
RowIndices = resultRows
@@ -352,7 +355,9 @@ module COOMatrix =
352355
fun (processor: MailboxProcessor<_>) allocationMode (rowIndices: ClArray<int>) rowCount ->
353356

354357
let nnz = rowIndices.Length
355-
let rowPointers = create processor allocationMode (rowCount + 1) nnz
358+
359+
let rowPointers =
360+
create processor allocationMode (rowCount + 1) nnz
356361

357362
let kernel = program.GetKernel()
358363

@@ -377,8 +382,11 @@ module COOMatrix =
377382
let rowPointers =
378383
prepare processor allocationMode matrix.Rows matrix.RowCount
379384

380-
let cols = copy processor allocationMode matrix.Columns
381-
let vals = copyData processor allocationMode matrix.Values
385+
let cols =
386+
copy processor allocationMode matrix.Columns
387+
388+
let vals =
389+
copyData processor allocationMode matrix.Values
382390

383391
{ Context = clContext
384392
RowCount = matrix.RowCount

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ module CSRMatrix =
6161
let rows =
6262
prepare processor allocationMode matrix.RowPointers matrix.Columns.Length matrix.RowCount
6363

64-
let cols = copy processor allocationMode matrix.Columns
65-
let vals = copyData processor allocationMode matrix.Values
64+
let cols =
65+
copy processor allocationMode matrix.Columns
66+
67+
let vals =
68+
copyData processor allocationMode matrix.Values
6669

6770
{ Context = clContext
6871
RowCount = matrix.RowCount
@@ -117,7 +120,8 @@ module CSRMatrix =
117120
Columns = m2.Columns
118121
Values = m2.Values }
119122

120-
let m3COO = eWiseCOO processor allocationMode m1COO m2COO
123+
let m3COO =
124+
eWiseCOO processor allocationMode m1COO m2COO
121125

122126
processor.Post(Msg.CreateFreeMsg(m1COO.Rows))
123127
processor.Post(Msg.CreateFreeMsg(m2COO.Rows))

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ module Matrix =
8585

8686
fun (processor: MailboxProcessor<_>) allocationMode (matrix: ClMatrix<'a>) ->
8787
match matrix with
88-
| ClMatrix.COO m -> toCSRInplace processor allocationMode m |> ClMatrix.CSR
88+
| ClMatrix.COO m ->
89+
toCSRInplace processor allocationMode m
90+
|> ClMatrix.CSR
8991
| ClMatrix.CSR _ -> matrix
9092
| ClMatrix.CSC m ->
9193
{ Context = m.Context
@@ -144,7 +146,9 @@ module Matrix =
144146
fun (processor: MailboxProcessor<_>) allocationMode (matrix: ClMatrix<'a>) ->
145147
match matrix with
146148
| ClMatrix.COO _ -> matrix
147-
| ClMatrix.CSR m -> toCOOInplace processor allocationMode m |> ClMatrix.COO
149+
| ClMatrix.CSR m ->
150+
toCOOInplace processor allocationMode m
151+
|> ClMatrix.COO
148152
| ClMatrix.CSC m ->
149153

150154
{ Context = m.Context
@@ -220,7 +224,8 @@ module Matrix =
220224
match matrix with
221225
| ClMatrix.CSC _ -> matrix
222226
| ClMatrix.CSR m ->
223-
let csrT = transposeCSRInplace processor allocationMode m
227+
let csrT =
228+
transposeCSRInplace processor allocationMode m
224229

225230
{ Context = csrT.Context
226231
RowCount = csrT.ColumnCount
@@ -469,7 +474,9 @@ module Matrix =
469474

470475
fun (processor: MailboxProcessor<_>) allocationMode matrix ->
471476
match matrix with
472-
| ClMatrix.COO m -> COOtranspose processor allocationMode m |> ClMatrix.COO
477+
| ClMatrix.COO m ->
478+
COOtranspose processor allocationMode m
479+
|> ClMatrix.COO
473480
| ClMatrix.CSR m ->
474481
{ Context = m.Context
475482
RowCount = m.ColumnCount

src/GraphBLAS-sharp.Backend/Vector/SparseVector/SparseVector.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ module SparseVector =
313313
fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClVector.Sparse<'b>) (value: ClCell<'a>) ->
314314

315315
let allIndices, leftValues, rightValues, isLeft =
316-
merge processor allocationMode leftVector.Indices leftVector.Values rightVector.Indices rightVector.Values
316+
merge processor leftVector.Indices leftVector.Values rightVector.Indices rightVector.Values
317317

318318
let allValues, positions =
319319
prepare processor allIndices leftValues rightValues value isLeft
@@ -351,7 +351,8 @@ module SparseVector =
351351
ClArray.zeroCreate clContext workGroupSize
352352

353353
fun (processor: MailboxProcessor<_>) allocationMode (vector: ClVector.Sparse<'a>) ->
354-
let resultVector = create processor allocationMode vector.Size
354+
let resultVector =
355+
create processor allocationMode vector.Size
355356

356357
let ndRange =
357358
Range1D.CreateValid(vector.Indices.Length, workGroupSize)

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

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ module Vector =
2323
ClVector.Sparse
2424
{ Context = clContext
2525
Indices = clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, [| 0 |])
26-
Values = clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, [| Unchecked.defaultof<'a> |])
26+
Values =
27+
clContext.CreateClArrayWithSpecificAllocationMode(
28+
allocationMode,
29+
[| Unchecked.defaultof<'a> |]
30+
)
2731
Size = size }
28-
| Dense -> ClVector.Dense <| zeroCreate processor allocationMode size
32+
| Dense ->
33+
ClVector.Dense
34+
<| zeroCreate processor allocationMode size
2935

3036
let ofList (clContext: ClContext) workGroupSize =
3137
let scatter =
@@ -101,7 +107,9 @@ module Vector =
101107

102108
fun (processor: MailboxProcessor<_>) allocationMode (vector: ClVector<'a>) ->
103109
match vector with
104-
| ClVector.Dense vector -> ClVector.Sparse <| toSparse processor allocationMode vector
110+
| ClVector.Dense vector ->
111+
ClVector.Sparse
112+
<| toSparse processor allocationMode vector
105113
| ClVector.Sparse _ -> copy processor allocationMode vector
106114

107115
let toDense (clContext: ClContext) workGroupSize =
@@ -112,8 +120,12 @@ module Vector =
112120

113121
fun (processor: MailboxProcessor<_>) allocationMode (vector: ClVector<'a>) ->
114122
match vector with
115-
| ClVector.Dense vector -> ClVector.Dense <| copy processor allocationMode vector
116-
| ClVector.Sparse vector -> ClVector.Dense <| toDense processor allocationMode vector
123+
| ClVector.Dense vector ->
124+
ClVector.Dense
125+
<| copy processor allocationMode vector
126+
| ClVector.Sparse vector ->
127+
ClVector.Dense
128+
<| toDense processor allocationMode vector
117129

118130
let elementWiseAtLeastOne (clContext: ClContext) (opAdd: Expr<AtLeastOne<'a, 'b> -> 'c option>) workGroupSize =
119131
let addSparse =
@@ -190,12 +202,14 @@ module Vector =
190202
ClVector.Sparse
191203
<| sparseFillVector processor allocationMode vector mask value
192204
| ClVector.Sparse vector, ClVector.Dense mask ->
193-
let mask = toSparseMask processor allocationMode mask
205+
let mask =
206+
toSparseMask processor allocationMode mask
194207

195208
ClVector.Sparse
196209
<| sparseFillVector processor allocationMode vector mask value
197210
| ClVector.Dense vector, ClVector.Sparse mask ->
198-
let vector = toSparseVector processor allocationMode vector
211+
let vector =
212+
toSparseVector processor allocationMode vector
199213

200214
ClVector.Sparse
201215
<| sparseFillVector processor allocationMode vector mask value
@@ -217,18 +231,23 @@ module Vector =
217231
fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector<'a>) (maskVector: ClVector<'b>) (value: ClCell<'a>) ->
218232
match leftVector, maskVector with
219233
| ClVector.Sparse vector, ClVector.Sparse mask ->
220-
let denseVector = vectorToDense processor allocationMode vector
221-
let denseMask = maskToDense processor allocationMode mask
234+
let denseVector =
235+
vectorToDense processor allocationMode vector
236+
237+
let denseMask =
238+
maskToDense processor allocationMode mask
222239

223240
ClVector.Dense
224241
<| denseFillVector processor allocationMode denseVector denseMask value
225242
| ClVector.Dense vector, ClVector.Sparse mask ->
226-
let denseMask = maskToDense processor allocationMode mask
243+
let denseMask =
244+
maskToDense processor allocationMode mask
227245

228246
ClVector.Dense
229247
<| denseFillVector processor allocationMode vector denseMask value
230248
| ClVector.Sparse vector, ClVector.Dense mask ->
231-
let denseVector = vectorToDense processor allocationMode vector
249+
let denseVector =
250+
vectorToDense processor allocationMode vector
232251

233252
ClVector.Dense
234253
<| denseFillVector processor allocationMode denseVector mask value

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let testCases =
2323
|> Array.filter (fun i -> array.Length % i = 0)
2424
|> Array.max
2525

26-
replicate q HostInterop wgSize
26+
replicate wgSize q HostInterop
2727

2828
let makeTest getReplicateFun (array: array<'a>) filterFun i =
2929
if array.Length > 0 && i > 0 then

0 commit comments

Comments
 (0)