Skip to content

Commit

Permalink
refactor: maxAllocSize: unit64
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiipatov committed Aug 7, 2023
1 parent 51bb2b4 commit 779c8de
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/GraphBLAS-sharp.Backend/Objects/ClContextExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ module ClContextExtensions =
Cl
.GetDeviceInfo(this.ClDevice.Device, OpenCL.Net.DeviceInfo.MaxMemAllocSize, error)
.CastTo<int>()
* 1<Byte>
|> uint64
|> ((*) 1UL<Byte>)
11 changes: 9 additions & 2 deletions src/GraphBLAS-sharp.Backend/Operations/Operations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,17 @@ module Operations =
List.max [ sizeof<'a>
sizeof<'c>
sizeof<'b> ]
* 1<Byte>
|> uint64
|> (*) 1UL<Byte>

let resultCapacity =
(clContext.MaxMemAllocSize / allocCapacity) / 3
(clContext.MaxMemAllocSize / allocCapacity) / 3UL

let resultCapacity =
(max
<| uint64 System.Int32.MaxValue
<| resultCapacity)
|> int

run processor allocationMode resultCapacity leftMatrix rightMatrix
| _ -> failwith "Matrix formats are not matching"
3 changes: 3 additions & 0 deletions tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/ByKey.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ let sequentialSegmentsTests =
|> testList "include"

testList "Sequential segments" [ excludeTests; includeTests ]

let tests =
testList "ByKey" [ sequentialSegmentsTests ]
5 changes: 4 additions & 1 deletion tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Expand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,7 @@ let generalTests =
ArithmeticOperations.float32Mul
Operations.SpGeMM.expand
createGeneralTest false (=) ArithmeticOperations.boolAdd ArithmeticOperations.boolMul Operations.SpGeMM.expand ]
|> testList "general"
|> testList "General"

let tests =
testList "SpGeMM.Expand" [ generalTests ]
4 changes: 2 additions & 2 deletions tests/GraphBLAS-sharp.Tests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ let matrixTests =
Matrix.SubRows.tests
Matrix.Kronecker.tests

Matrix.SpGeMM.Expand.generalTests
Matrix.SpGeMM.Expand.tests
Matrix.SpGeMM.Masked.tests ]
|> testSequenced

let commonTests =
let scanTests =
testList
"Scan"
[ Common.Scan.ByKey.sequentialSegmentsTests
[ Common.Scan.ByKey.tests
Common.Scan.PrefixSum.tests ]

let reduceTests =
Expand Down

0 comments on commit 779c8de

Please sign in to comment.