Skip to content

Commit 56f8097

Browse files
authored
Merge branch 'dev' into dev
2 parents 53fba87 + de357df commit 56f8097

5 files changed

Lines changed: 33 additions & 22 deletions

File tree

benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ open GraphBLAS.FSharp.Backend
1515
[<AbstractClass>]
1616
[<IterationCount(100)>]
1717
[<WarmupCount(10)>]
18-
[<Config(typeof<Configs.Matrix2>)>]
18+
[<Config(typeof<Configs.Matrix>)>]
1919
type Benchmarks<'elem when 'elem : struct>(
2020
buildFunToBenchmark,
2121
converter: string -> 'elem,
@@ -24,11 +24,9 @@ type Benchmarks<'elem when 'elem : struct>(
2424

2525
let mutable funToBenchmark = None
2626

27-
let mutable firstMatrix = Unchecked.defaultof<ClMatrix<'elem>>
28-
let mutable secondMatrix = Unchecked.defaultof<ClMatrix<'elem>>
27+
let mutable matrix = Unchecked.defaultof<ClMatrix<'elem>>
2928

30-
let mutable firstMatrixHost = Unchecked.defaultof<_>
31-
let mutable secondMatrixHost = Unchecked.defaultof<_>
29+
let mutable matrixHost = Unchecked.defaultof<_>
3230

3331
member val ResultMatrix = Unchecked.defaultof<ClMatrix.COO<'elem> option> with get, set
3432

@@ -38,7 +36,7 @@ type Benchmarks<'elem when 'elem : struct>(
3836
[<ParamsSource("InputMatrixProvider")>]
3937
member val InputMatrixReader = Unchecked.defaultof<MtxReader> with get, set
4038

41-
member this.OclContext:ClContext = (fst this.OclContextInfo).ClContext
39+
member this.OclContext: ClContext = (fst this.OclContextInfo).ClContext
4240
member this.WorkGroupSize = snd this.OclContextInfo
4341

4442
member this.Processor =
@@ -78,24 +76,21 @@ type Benchmarks<'elem when 'elem : struct>(
7876
reader.ReadMatrix converter
7977

8078
member this.Mxm() =
81-
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly firstMatrix secondMatrix
79+
this.ResultMatrix <- this.FunToBenchmark this.Processor DeviceOnly matrix matrix
8280

8381
member this.ClearInputMatrices() =
84-
firstMatrix.Dispose this.Processor
85-
secondMatrix.Dispose this.Processor
82+
matrix.Dispose this.Processor
8683

8784
member this.ClearResult() =
8885
match this.ResultMatrix with
8986
| Some matrix -> matrix.Dispose this.Processor
9087
| None -> ()
9188

9289
member this.ReadMatrices() =
93-
firstMatrixHost <- this.ReadMatrix this.InputMatrixReader
94-
secondMatrixHost <- this.ReadMatrix this.InputMatrixReader
90+
matrixHost <- this.ReadMatrix this.InputMatrixReader
9591

9692
member this.LoadMatricesToGPU () =
97-
firstMatrix <- buildMatrix this.OclContext firstMatrixHost
98-
secondMatrix <- buildMatrix this.OclContext secondMatrixHost
93+
matrix <- buildMatrix this.OclContext matrixHost
9994

10095
abstract member GlobalSetup : unit -> unit
10196

paket.lock

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,11 @@ NUGET
761761
BinaryDefense.FSharp.Analyzers.Hashing (0.2.2)
762762
FSharp.Analyzers.SDK (>= 0.8) - restriction: >= net5.0
763763
FSharp.Core (>= 5.0.1) - restriction: >= net5.0
764-
FSharp.Analyzers.SDK (0.12) - restriction: >= net5.0
765-
FSharp.Compiler.Service (>= 43.7.200) - restriction: >= net6.0
766-
FSharp.Core (>= 7.0.200) - restriction: >= net6.0
767-
McMaster.NETCore.Plugins (>= 1.4) - restriction: >= net6.0
768-
FSharp.Compiler.Service (43.7.300) - restriction: >= net6.0
764+
FSharp.Analyzers.SDK (0.11) - restriction: >= net5.0
765+
FSharp.Compiler.Service (>= 41.0.1) - restriction: >= net5.0
766+
FSharp.Core (>= 6.0.1) - restriction: >= net5.0
767+
McMaster.NETCore.Plugins (>= 1.4) - restriction: >= net5.0
768+
FSharp.Compiler.Service (43.7.300) - restriction: >= net5.0
769769
FSharp.Core (7.0.300) - restriction: >= netstandard2.0
770770
System.Buffers (>= 4.5.1) - restriction: >= netstandard2.0
771771
System.Collections.Immutable (>= 6.0) - restriction: >= netstandard2.0
@@ -775,7 +775,7 @@ NUGET
775775
System.Reflection.Metadata (>= 6.0.1) - restriction: >= netstandard2.0
776776
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= netstandard2.0
777777
FSharp.Core (7.0.300) - restriction: >= net5.0
778-
McMaster.NETCore.Plugins (1.4) - restriction: >= net6.0
778+
McMaster.NETCore.Plugins (1.4) - restriction: >= net5.0
779779
Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: >= netcoreapp2.1
780780
Microsoft.Extensions.DependencyModel (>= 5.0) - restriction: >= netcoreapp2.1
781781
Microsoft.DotNet.PlatformAbstractions (3.1.6) - restriction: >= net6.0
@@ -785,13 +785,17 @@ NUGET
785785
System.Buffers (4.5.1) - restriction: >= net6.0
786786
System.Collections.Immutable (7.0) - restriction: >= net6.0
787787
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0))
788-
System.Diagnostics.DiagnosticSource (7.0.2) - restriction: >= net6.0
788+
System.Diagnostics.DiagnosticSource (7.0.2) - restriction: >= net5.0
789+
System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0))
789790
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0))
790791
System.Memory (4.5.5) - restriction: >= net6.0
791792
System.Buffers (>= 4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.1)) (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (>= monotouch) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (< uap10.1) (>= wpa81)) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos)
792793
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (>= monoandroid) (< netstandard1.1)) (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (>= monotouch) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos)
793794
System.Reflection.Emit (4.7) - restriction: >= net6.0
794-
System.Reflection.Metadata (7.0.1) - restriction: >= net6.0
795+
System.Reflection.Metadata (7.0.1) - restriction: >= net6.
796+
System.Numerics.Vectors (4.5) - restriction: || (&& (>= net462) (>= net5.0)) (&& (>= net5.0) (< net6.0))
797+
System.Reflection.Emit (4.7) - restriction: >= net5.0
798+
System.Reflection.Metadata (7.0.1) - restriction: >= net5.0
795799
System.Collections.Immutable (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0)
796800
System.Runtime.CompilerServices.Unsafe (6.0) - restriction: >= net6.0
797801
System.Text.Encodings.Web (7.0) - restriction: >= net6.0

src/GraphBLAS-sharp.Backend/Common/Sort/Radix.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ module Radix =
318318
keysPair <- swap keysPair
319319
valuesPair <- swap valuesPair
320320

321+
globalOffset.Free processor
321322
localOffset.Free processor
322323
shift.Free processor
323324

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ module Reduce =
704704
reducedValues.Free processor
705705
reducedKeys.Free processor
706706
resultPositions.Free processor
707+
707708
None
708709
else
709710
// write values
@@ -988,6 +989,7 @@ module Reduce =
988989
firstReducedKeys.Free processor
989990
secondReducedKeys.Free processor
990991
resultPositions.Free processor
992+
991993
None
992994
else
993995
// write value

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ module Expand =
401401

402402
// compute sub result
403403
let length, result = runCOO subMatrix
404+
405+
// release subMatrix (TODO(non blocking Free)
406+
subMatrix.Dispose processor
407+
404408
// increase workOffset according to previous expand
405409
let workOffset = workOffset + length
406410

@@ -447,7 +451,12 @@ module Expand =
447451
if generalLength < maxAllocSize then
448452
segmentLengths.Free processor
449453

450-
runOneStep processor allocationMode leftMatrix rightMatrixRowsNNZ rightMatrix
454+
let result =
455+
runOneStep processor allocationMode leftMatrix rightMatrixRowsNNZ rightMatrix
456+
457+
rightMatrixRowsNNZ.Free processor
458+
459+
result
451460
else
452461
let result =
453462
runManySteps

0 commit comments

Comments
 (0)