Skip to content

Commit 36b3be4

Browse files
committed
Deleting unused and duplicated methods
1 parent 33d974e commit 36b3be4

2 files changed

Lines changed: 0 additions & 139 deletions

File tree

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ module internal Utils =
2121
>> fun x -> x ||| (x >>> 8)
2222
>> fun x -> x ||| (x >>> 16)
2323
>> fun x -> x + 1
24-
25-
let toHost (processor: MailboxProcessor<_>) (src: ClArray<_>) =
26-
let dst = Array.zeroCreate src.Length
27-
processor.PostAndReply(fun ch -> Msg.CreateToHostMsg(src, dst, ch))

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

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,6 @@ open GraphBLAS.FSharp.Backend.Common
88
open Microsoft.FSharp.Quotations
99

1010
module internal Elementwise =
11-
let expandCompressedRowPointers (clContext: ClContext) workGroupSize =
12-
13-
let kernel =
14-
<@ fun (ndRange: Range1D) nonZeroRows nnz numberOfRows (compressedRowPointers: ClArray<int>) (compressedRows: ClArray<int>) (rowPointers: ClArray<int>) ->
15-
16-
let i = ndRange.GlobalID0
17-
18-
//Init with zeroes
19-
if i < numberOfRows then
20-
rowPointers.[i] <- 0
21-
22-
if i < nonZeroRows then
23-
rowPointers.[compressedRows.[i]] <-
24-
compressedRowPointers.[i + 1]
25-
- compressedRowPointers.[i] @>
26-
27-
let sum =
28-
ClArray.prefixSumExcludeInplace clContext workGroupSize
29-
30-
let kernel = clContext.Compile(kernel)
31-
32-
fun (processor: MailboxProcessor<_>) (numberOfRows: int) (nnz: int) (compressedRowPointers: ClArray<int>) (compressedRows: ClArray<int>) ->
33-
34-
let rowPointers =
35-
clContext.CreateClArray<int>(
36-
numberOfRows + 1,
37-
hostAccessMode = HostAccessMode.NotAccessible,
38-
deviceAccessMode = DeviceAccessMode.ReadWrite,
39-
allocationMode = AllocationMode.Default
40-
)
41-
42-
let ndRange =
43-
Range1D.CreateValid(numberOfRows + 1, workGroupSize)
44-
45-
let kernel = kernel.GetKernel()
46-
47-
processor.Post(
48-
Msg.MsgSetArguments
49-
(fun () ->
50-
kernel.KernelFunc
51-
ndRange
52-
compressedRows.Length
53-
nnz
54-
numberOfRows
55-
compressedRowPointers
56-
compressedRows
57-
rowPointers)
58-
)
59-
60-
processor.Post(Msg.CreateRunMsg<_, _>(kernel))
61-
62-
let sumCell = clContext.CreateClCell 0
63-
sum processor rowPointers sumCell |> ignore
64-
processor.Post(Msg.CreateFreeMsg<_>(sumCell))
65-
66-
rowPointers
67-
6811
let preparePositions<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality>
6912
(clContext: ClContext)
7013
(opAdd: Expr<'a option -> 'b option -> 'c option>)
@@ -311,84 +254,6 @@ module internal Elementwise =
311254

312255
resultRows, resultColumns, resultValues, positions, resultLength
313256

314-
let getCompressedRowPointers (clContext: ClContext) workGroupSize =
315-
316-
let getCompressedRowPointers =
317-
<@ fun (ndRange: Range1D) allRowsLength nonZeroRows nnz (allRows: ClArray<int>) (positions: ClArray<int>) (isEndOfRowBitmap: ClArray<int>) (rowPointers: ClArray<int>) (compressedRows: ClArray<int>) ->
318-
319-
let i = ndRange.GlobalID0
320-
321-
if i > 0
322-
&& i < allRowsLength
323-
&& isEndOfRowBitmap.[i] <> isEndOfRowBitmap.[i - 1] then
324-
let row = isEndOfRowBitmap.[i]
325-
326-
rowPointers.[row] <- positions.[i]
327-
compressedRows.[row] <- allRows.[i]
328-
elif i = 0 then
329-
rowPointers.[0] <- 0
330-
compressedRows.[0] <- allRows.[0]
331-
elif i = allRowsLength then
332-
rowPointers.[nonZeroRows] <- nnz @>
333-
334-
let kernel =
335-
clContext.Compile(getCompressedRowPointers)
336-
337-
let sum =
338-
ClArray.prefixSumExcludeInplace clContext workGroupSize
339-
340-
fun (processor: MailboxProcessor<_>) nnz (allRows: ClArray<int>) (positions: ClArray<int>) (isRowEnd: ClArray<int>) ->
341-
342-
let nonZeroRows = Array.zeroCreate 1
343-
344-
let rowEndSum = clContext.CreateClCell 0
345-
346-
let _, rowEndSum = sum processor isRowEnd rowEndSum
347-
348-
processor.PostAndReply(fun ch -> Msg.CreateToHostMsg<_>(rowEndSum, nonZeroRows, ch))
349-
let nonZeroRows = nonZeroRows.[0]
350-
processor.Post(Msg.CreateFreeMsg<_>(rowEndSum))
351-
352-
let compressedRowPointers =
353-
clContext.CreateClArray<int>(
354-
nonZeroRows + 1,
355-
hostAccessMode = HostAccessMode.NotAccessible,
356-
deviceAccessMode = DeviceAccessMode.ReadWrite,
357-
allocationMode = AllocationMode.Default
358-
)
359-
360-
let compressedRows =
361-
clContext.CreateClArray<int>(
362-
nonZeroRows,
363-
hostAccessMode = HostAccessMode.NotAccessible,
364-
deviceAccessMode = DeviceAccessMode.ReadWrite,
365-
allocationMode = AllocationMode.Default
366-
)
367-
368-
let ndRange =
369-
Range1D.CreateValid(allRows.Length + 1, workGroupSize)
370-
371-
let kernel = kernel.GetKernel()
372-
373-
processor.Post(
374-
Msg.MsgSetArguments
375-
(fun () ->
376-
kernel.KernelFunc
377-
ndRange
378-
allRows.Length
379-
nonZeroRows
380-
nnz
381-
allRows
382-
positions
383-
isRowEnd
384-
compressedRowPointers
385-
compressedRows)
386-
)
387-
388-
processor.Post(Msg.CreateRunMsg<_, _>(kernel))
389-
390-
compressedRowPointers, compressedRows, nonZeroRows
391-
392257
let merge<'a, 'b when 'a: struct and 'b: struct> (clContext: ClContext) workGroupSize =
393258
let localArraySize = workGroupSize + 2
394259

0 commit comments

Comments
 (0)