Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d55d34f
add: Gather
IgorErin Mar 12, 2023
a136bd3
add: Expand module
IgorErin Mar 13, 2023
f77b4d2
add: requiredRawsLengths test
IgorErin Mar 13, 2023
d22621e
wip: module Expand test
IgorErin Mar 13, 2023
9d25601
refactor: globalMap
IgorErin Mar 13, 2023
5479816
add: Expand stage
IgorErin Mar 13, 2023
be13d6e
add: Expand test
IgorErin Mar 16, 2023
890bdd1
merge: dev
IgorErin Mar 26, 2023
6da457b
add: reduceByKey2D
IgorErin Mar 27, 2023
66c2711
refactor: wip
IgorErin Apr 1, 2023
91a72e2
add: Gather tests
IgorErin Apr 3, 2023
b679650
wip: segments computing tests
IgorErin Apr 4, 2023
7e09219
wip: expand tests passed
IgorErin Apr 4, 2023
84fb950
wip: getUniqueBitmap{first/last} occurrence
IgorErin Apr 5, 2023
8ec7fd7
add: Scatter.firstOccurrence
IgorErin Apr 5, 2023
63037b6
spgemm: left filtering
IgorErin Apr 6, 2023
03e7e95
add: init gather
IgorErin Apr 6, 2023
6f02570
add: init scatter
IgorErin Apr 6, 2023
29c564c
add: scatter init value
IgorErin Apr 6, 2023
972b392
refactor: init in spgemm
IgorErin Apr 6, 2023
73d755f
refactor: deforestation in ClArray.choose
IgorErin Apr 6, 2023
f34e590
add: ClArray.choose2
IgorErin Apr 6, 2023
751ee68
add: filter after multiplication
IgorErin Apr 6, 2023
69be680
add: reduce by key option
IgorErin Apr 6, 2023
3f7c0bf
add: spgemm
IgorErin Apr 7, 2023
96c0c08
refactor: spgemm
IgorErin Apr 7, 2023
95fea31
refactor: duplication, allTests in Reduce
IgorErin Apr 7, 2023
c5fa0d0
refactor: ClArray.Free and *.FreeAndWait
IgorErin Apr 7, 2023
6ff1971
refactor: remove use in test
IgorErin Apr 7, 2023
048477d
refactor: formatting
IgorErin Apr 7, 2023
3703609
merge: dev
IgorErin Apr 7, 2023
4d26023
refactor: formatting
IgorErin Apr 7, 2023
cf7cc1d
refactor: expand endSize
IgorErin Apr 8, 2023
fdb9041
refactor: Scatter.test memory release
IgorErin Apr 8, 2023
a6ebc30
refactor: tests, names
IgorErin Apr 8, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
spgemm: left filtering
  • Loading branch information
IgorErin committed Apr 6, 2023
commit 63037b677c7623a7ab8bfd0c50c6538c7df6c559
3 changes: 2 additions & 1 deletion src/GraphBLAS-sharp.Backend/Common/Sort/Radix.fs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module Radix =

fun (processor: MailboxProcessor<_>) (keys: Indices) ->
if keys.Length <= 1 then
keys
copy processor DeviceOnly keys // TODO(allocation mode)
else
let firstKeys = copy processor DeviceOnly keys

Expand Down Expand Up @@ -194,6 +194,7 @@ module Radix =
localOffset.Free processor
shift.Free processor

(snd pair).Free processor
fst pair

let standardRunKeysOnly clContext workGroupSize =
Expand Down
12 changes: 8 additions & 4 deletions src/GraphBLAS-sharp.Backend/Matrix/CSRMatrix/SpGEMM/Expand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ module Expand =
let sortedColumns = sortKeys processor columns

// sort by rows
let valuesSortedByRows = sortByKeyValues processor DeviceOnly rows valuesSortedByColumns
let valuesSortedByRows = sortByKeyValues processor DeviceOnly rowsSortedByColumns valuesSortedByColumns

let columnsSortedByRows = sortByKeyIndices processor DeviceOnly rows sortedColumns
let columnsSortedByRows = sortByKeyIndices processor DeviceOnly rowsSortedByColumns sortedColumns

let sortedRows = sortKeys processor rowsSortedByColumns

Expand All @@ -206,15 +206,16 @@ module Expand =
let reduce (clContext: ClContext) workGroupSize opAdd =

let reduce = Reduce.ByKey2D.segmentSequential clContext workGroupSize opAdd
//let reduce = Reduce.ByKey2D.sequential clContext workGroupSize opAdd

let getUniqueBitmap =
ClArray.getUniqueBitmap2FirstOccurrence clContext workGroupSize
ClArray.getUniqueBitmap2LastOccurrence clContext workGroupSize

let prefixSum = PrefixSum.standardExcludeInplace clContext workGroupSize

let init = ClArray.init clContext workGroupSize Map.id // TODO(fuse)

let scatter = Scatter.scatterLastOccurrence clContext workGroupSize
let scatter = Scatter.scatterFirstOccurrence clContext workGroupSize

fun (processor: MailboxProcessor<_>) allocationMode (values: ClArray<'a>) (columns: Indices) (rows: Indices) ->

Expand Down Expand Up @@ -242,6 +243,9 @@ module Expand =
let reducedColumns, reducedRows, reducedValues =
reduce processor allocationMode uniqueKeysCount offsets columns rows values

// let reducedColumns, reducedRows, reducedValues =
// reduce processor DeviceOnly uniqueKeysCount columns rows values

offsets.Free processor

reducedValues, reducedColumns, reducedRows
Expand Down
27 changes: 13 additions & 14 deletions tests/GraphBLAS-sharp.Tests/Matrix/SpGeMM.fs
Original file line number Diff line number Diff line change
Expand Up @@ -203,30 +203,29 @@ let makeGeneralTest zero isEqual opMul opAdd testFun (leftArray: 'a [,], rightAr

if leftMatrix.NNZ > 0
&& rightMatrix.NNZ > 0 then
try
let clLeftMatrix = leftMatrix.ToDevice context
let clRightMatrix = rightMatrix.ToDevice context

let clLeftMatrix = leftMatrix.ToDevice context
let clRightMatrix = rightMatrix.ToDevice context
let (clActualValues: ClArray<'a>), (clActualColumns: ClArray<int>), (clActualRows: ClArray<int>) =
testFun processor HostInterop clLeftMatrix clRightMatrix

let (clActualValues: ClArray<'a>), (clActualColumns: ClArray<int>), (clActualRows: ClArray<int>) =
testFun processor HostInterop clLeftMatrix clRightMatrix
let actualValues = clActualValues.ToHostAndFree processor
let actualColumns = clActualColumns.ToHostAndFree processor
let actualRows = clActualRows.ToHostAndFree processor

clLeftMatrix.Dispose processor
clRightMatrix.Dispose processor

let actualValues = clActualValues.ToHostAndFree processor
let actualColumns = clActualColumns.ToHostAndFree processor
let actualRows = clActualRows.ToHostAndFree processor

checkGeneralResult zero isEqual actualValues actualColumns actualRows opMul opAdd leftArray rightArray
checkGeneralResult zero isEqual actualValues actualColumns actualRows opMul opAdd leftArray rightArray
with
| ex when ex.Message = "InvalidBufferSize" -> ()
| ex -> raise ex

let createGeneralTest (zero: 'a) isEqual opAdd opAddQ opMul opMulQ testFun =

let testFun = testFun context Utils.defaultWorkGroupSize opAddQ opMulQ

makeGeneralTest zero isEqual opMul opAdd testFun
|> testPropertyWithConfig { config with endSize = 10 } $"test on %A{typeof<'a>}"
|> testPropertyWithConfig { config with endSize = 10; maxTest = 1000 } $"test on %A{typeof<'a>}"

let generalTests =
[ createGeneralTest 0 (=) (+) <@ (+) @> (*) <@ (*) @> Expand.run ]
|> testList "general"

3 changes: 1 addition & 2 deletions tests/GraphBLAS-sharp.Tests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ open GraphBLAS.FSharp.Tests.Matrix
let allTests =
testList
"All tests"
[ // SpGeMM.generalTests
Common.Scatter.tests
[ SpGeMM.generalTests
]

|> testSequenced
Expand Down