diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 00000000..2e06ec69 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,48 @@ +name: BuildDocs + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + win-build: + name: Windows Build Docs + runs-on: windows-latest + defaults: + run: + shell: cmd + steps: + - name: System Info + run: systeminfo + + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - name: Build + run: ./build.cmd BuildDocs + env: + CI: true + + linux-build: + name: Linux Build Docs + runs-on: ubuntu-latest + steps: + - name: System Info + run: lscpu + + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - name: Build + run: | + chmod +x ./build.sh + ./build.sh BuildDocs + env: + CI: true diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index f7eaece3..c8763bc3 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -7,8 +7,8 @@ on: workflow_dispatch: jobs: - win-build: - name: Windows Build (No Tests) + win-build-release: + name: Windows Release Build (No Tests) runs-on: windows-latest defaults: run: @@ -28,9 +28,34 @@ jobs: # Work around https://github.com/actions/setup-dotnet/issues/29 DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 CI: true + CONFIGURATION: Release + + win-build-debug: + name: Windows Debug Build (No Tests) + runs-on: windows-latest + defaults: + run: + shell: cmd + steps: + - name: System Info + run: systeminfo + + - uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + + - name: Build + run: ./build.cmd DotnetBuild + env: + # Work around https://github.com/actions/setup-dotnet/issues/29 + DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 + CI: true + CONFIGURATION: Debug + win-test: - name: Windows Build And Test + name: Windows Release Build And Test if: github.repository_owner != 'YaccConstructor' runs-on: windows-latest defaults: @@ -68,9 +93,32 @@ jobs: # Work around https://github.com/actions/setup-dotnet/issues/29 DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 CI: true + CONFIGURATION: Release + + linux-build-debug: + name: Linux Debug Build (No Tests) + runs-on: ubuntu-latest + steps: + - name: System Info + run: lscpu + + - uses: actions/checkout@v1 + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + + - name: Build + run: | + chmod +x ./build.sh + ./build.sh DotnetBuild + env: + # Work around https://github.com/actions/setup-dotnet/issues/29 + DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 + CI: true + CONFIGURATION: Debug - linux-build: - name: Linux Build (No Tests) + linux-build-release: + name: Linux Release Build (No Tests) runs-on: ubuntu-latest steps: - name: System Info @@ -89,9 +137,10 @@ jobs: # Work around https://github.com/actions/setup-dotnet/issues/29 DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 CI: true + CONFIGURATION: Release linux-test: - name: Linux Build And Test + name: Linux Release Build And Test if: github.repository_owner != 'YaccConstructor' runs-on: ubuntu-latest steps: @@ -121,6 +170,7 @@ jobs: # Work around https://github.com/actions/setup-dotnet/issues/29 DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 CI: true + CONFIGURATION: Release linux-test-self-hosted: name: Linux Self-Hosted Test @@ -143,3 +193,4 @@ jobs: # Work around https://github.com/actions/setup-dotnet/issues/29 DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64 CI: true + CONFIGURATION: Release diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..cb858680 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +name: Publish Nuget packages + +on: + push: + tags: + - '*' + +jobs: + publish-self-hosted: + name: Build, test, and publish Nuget packages on self-hosted server with GPU + if: github.repository_owner == 'YaccConstructor' + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + + - name: OpenCL Info + run: clinfo + + - name: Build, test, publish + env: + NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} + GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} + FAKE_DETAILED_ERRORS: true + CI: true + run: | + chmod +x ./build.sh + ./build.sh Publish diff --git a/.github/workflows/release-docs.yml b/.github/workflows/release-docs.yml new file mode 100644 index 00000000..b13c0b8e --- /dev/null +++ b/.github/workflows/release-docs.yml @@ -0,0 +1,27 @@ +name: Release Docs + +on: + push: + tags: + - '*' + +jobs: + + linux-build: + name: Linux Release Docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - name: ReleaseDocs + run: | + chmod +x ./build.sh + ./build.sh ReleaseDocs + env: + GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} + FAKE_DETAILED_ERRORS: true + CI: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 16f812ac..a8f395d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,22 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.1.0-alpha1] - 2023-05-18 -## [0.1.0] - 2017-03-17 -First release +First release. For demo and tests. Basic linear algebra only. No graph algorithms. ### Added -- This release already has lots of features +- Basic functions for vectors and matrices creation +- Basic functions for vectors manipulation: map, reduce +- Basic functions for matrices manipulation: map, transpose +- Matrix-matrix element-wise functions (map2) +- Vector-vector element-wise functions (map2) +- Sparse matrix multiplication +- Kronecker product -[0.1.0]: https://github.com/user/MyCoolNewLib.git/releases/tag/v0.1.0 +[Unreleased]: https://github.com/YaccConstructor/GraphBLAS-sharp/compare/v0.1.0-alpha1...HEAD +[0.1.0-alpha1]: https://github.com/YaccConstructor/GraphBLAS-sharp/releases/tag/v0.1.0-alpha1 diff --git a/README.md b/README.md index 6ddbc2c0..8f1004a1 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ GraphBLAS# is a GPGPU-based [GraphBLAS](https://graphblas.org/)-like API impleme - [x] COO-COO `map2` - [x] COO-COO `map2AtLeastOne` - [x] CSR-CSR multiplication + - [x] CSR-CSR Kronecker product - **Vector-Matrix** - [x] Dense-CSR multiplication - [ ] Sparse-CSR multiplication @@ -231,6 +232,13 @@ build.cmd ``` To find more options look at [MiniScaffold](https://github.com/TheAngryByrd/MiniScaffold). We use it in our project. +### Release +The release process is automated: NuGet packages publishing process is triggered by tag pushing to any branch. +To release new version one should +1. [Add release notes to CHANGELOG](https://github.com/TheAngryByrd/MiniScaffold/blob/master/Content/Library/README.md#releasing) +2. Run ```./build.sh Release [version]``` (on local machine) + + ## License This project licensed under MIT License. License text can be found in the [license file](https://github.com/YaccConstructor/GraphBLAS-sharp/blob/master/LICENSE.md). diff --git a/benchmarks/GraphBLAS-sharp.Benchmarks/Algorithms/BFS.fs b/benchmarks/GraphBLAS-sharp.Benchmarks/Algorithms/BFS.fs index 7115a90c..5e7050d2 100644 --- a/benchmarks/GraphBLAS-sharp.Benchmarks/Algorithms/BFS.fs +++ b/benchmarks/GraphBLAS-sharp.Benchmarks/Algorithms/BFS.fs @@ -2,15 +2,14 @@ open System.IO open BenchmarkDotNet.Attributes +open Microsoft.FSharp.Core +open Brahma.FSharp open GraphBLAS.FSharp -open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.IO -open Brahma.FSharp -open Backend.Algorithms.BFS -open Microsoft.FSharp.Core -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions open GraphBLAS.FSharp.Benchmarks -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Backend.Quotes [] [] @@ -20,14 +19,15 @@ type Benchmarks<'elem when 'elem : struct>( buildFunToBenchmark, converter: string -> 'elem, binaryConverter, - vertex: int) + vertex: int, + buildMatrix) = let mutable funToBenchmark = None - let mutable matrix = Unchecked.defaultof> + let mutable matrix = Unchecked.defaultof> let mutable matrixHost = Unchecked.defaultof<_> - member val ResultLevels = Unchecked.defaultof> with get,set + member val ResultLevels = Unchecked.defaultof> with get,set [] member val OclContextInfo = Unchecked.defaultof with get, set @@ -46,7 +46,7 @@ type Benchmarks<'elem when 'elem : struct>( static member AvailableContexts = Utils.availableContexts static member InputMatrixProviderBuilder pathToConfig = - let datasetFolder = "BFS" + let datasetFolder = "" pathToConfig |> Utils.getMatricesFilenames |> Seq.map @@ -69,9 +69,12 @@ type Benchmarks<'elem when 'elem : struct>( this.ResultLevels <- this.FunToBenchmark this.Processor matrix vertex member this.ClearInputMatrix() = - (matrix :> IDeviceMemObject).Dispose this.Processor + matrix.Dispose this.Processor - member this.ClearResult() = this.ResultLevels.FreeAndWait this.Processor + member this.ClearResult() = + match this.ResultLevels with + | ClVector.Dense result -> result.FreeAndWait this.Processor + | _ -> failwith "Impossible" member this.ReadMatrix() = let converter = @@ -82,7 +85,7 @@ type Benchmarks<'elem when 'elem : struct>( matrixHost <- this.InputMatrixReader.ReadMatrix converter member this.LoadMatrixToGPU() = - matrix <- matrixHost.ToCSR.ToDevice this.OclContext + matrix <- buildMatrix this.OclContext matrixHost abstract member GlobalSetup : unit -> unit @@ -96,13 +99,15 @@ type WithoutTransferBenchmark<'elem when 'elem : struct>( buildFunToBenchmark, converter: string -> 'elem, boolConverter, - vertex) = + vertex, + buildMatrix) = inherit Benchmarks<'elem>( buildFunToBenchmark, converter, boolConverter, - vertex) + vertex, + buildMatrix) [] override this.GlobalSetup() = @@ -125,10 +130,11 @@ type WithoutTransferBenchmark<'elem when 'elem : struct>( type BFSWithoutTransferBenchmarkInt32() = inherit WithoutTransferBenchmark( - (singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption), + (Algorithms.BFS.singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption), int32, (fun _ -> Utils.nextInt (System.Random())), - 0) + 0, + (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context)) static member InputMatrixProvider = Benchmarks<_>.InputMatrixProviderBuilder "BFSBenchmarks.txt" @@ -137,13 +143,15 @@ type WithTransferBenchmark<'elem when 'elem : struct>( buildFunToBenchmark, converter: string -> 'elem, boolConverter, - vertex) = + vertex, + buildMatrix) = inherit Benchmarks<'elem>( buildFunToBenchmark, converter, boolConverter, - vertex) + vertex, + buildMatrix) [] override this.GlobalSetup() = @@ -162,16 +170,20 @@ type WithTransferBenchmark<'elem when 'elem : struct>( override this.Benchmark() = this.LoadMatrixToGPU() this.BFS() - this.ResultLevels.ToHost this.Processor |> ignore - this.Processor.PostAndReply Msg.MsgNotifyMe + match this.ResultLevels with + | ClVector.Dense result -> + result.ToHost this.Processor |> ignore + this.Processor.PostAndReply Msg.MsgNotifyMe + | _ -> failwith "Impossible" type BFSWithTransferBenchmarkInt32() = inherit WithTransferBenchmark( - (singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption), + (Algorithms.BFS.singleSource ArithmeticOperations.intSumOption ArithmeticOperations.intMulOption), int32, (fun _ -> Utils.nextInt (System.Random())), - 0) + 0, + (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context)) static member InputMatrixProvider = Benchmarks<_>.InputMatrixProviderBuilder "BFSBenchmarks.txt" diff --git a/benchmarks/GraphBLAS-sharp.Benchmarks/Helpers.fs b/benchmarks/GraphBLAS-sharp.Benchmarks/Helpers.fs index 6ce43002..0867e214 100644 --- a/benchmarks/GraphBLAS-sharp.Benchmarks/Helpers.fs +++ b/benchmarks/GraphBLAS-sharp.Benchmarks/Helpers.fs @@ -5,14 +5,12 @@ namespace GraphBLAS.FSharp.Benchmarks open Brahma.FSharp open Brahma.FSharp.OpenCL.Translator open Brahma.FSharp.OpenCL.Translator.QuotationTransformers -open GraphBLAS.FSharp.Backend.Objects open OpenCL.Net open System.IO open System.Text.RegularExpressions open GraphBLAS.FSharp.Tests open FsCheck open Expecto -open GraphBLAS.FSharp.Test module Utils = type BenchmarkContext = diff --git a/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/Map2/Map2.fs b/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/Map2/Map2.fs index 2e2582f1..ab54db75 100644 --- a/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/Map2/Map2.fs +++ b/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/Map2/Map2.fs @@ -1,15 +1,14 @@ namespace GraphBLAS.FSharp.Benchmarks.Matrix.Map2 open System.IO -open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.IO open BenchmarkDotNet.Attributes open Brahma.FSharp +open GraphBLAS.FSharp +open GraphBLAS.FSharp.IO open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Objects.MatrixExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Matrix +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Benchmarks [] @@ -47,7 +46,7 @@ type Benchmarks<'matrixT, 'elem when 'matrixT :> IDeviceMemObject and 'elem : st static member AvailableContexts = Utils.availableContexts static member InputMatricesProviderBuilder pathToConfig = - let datasetFolder = "EWiseAdd" + let datasetFolder = "" pathToConfig |> Utils.getMatricesFilenames |> Seq.map @@ -138,7 +137,7 @@ module WithoutTransfer = type Float32() = inherit Benchmark,float32>( - (Matrix.map2 ArithmeticOperations.float32SumOption), + (Operations.Matrix.map2 ArithmeticOperations.float32SumOption), float32, (fun _ -> Utils.nextSingle (System.Random())), Matrix.COO @@ -150,7 +149,7 @@ module WithoutTransfer = type Bool() = inherit Benchmark,bool>( - (Matrix.map2 ArithmeticOperations.boolSumOption), + (Operations.Matrix.map2 ArithmeticOperations.boolSumOption), (fun _ -> true), (fun _ -> true), Matrix.COO @@ -163,7 +162,7 @@ module WithoutTransfer = type Float32() = inherit Benchmark,float32>( - (Matrix.map2 ArithmeticOperations.float32SumOption), + (Operations.Matrix.map2 ArithmeticOperations.float32SumOption), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun matrix -> Matrix.CSR matrix.ToCSR) @@ -175,7 +174,7 @@ module WithoutTransfer = type Bool() = inherit Benchmark,bool>( - (Matrix.map2 ArithmeticOperations.boolSumOption), + (Operations.Matrix.map2 ArithmeticOperations.boolSumOption), (fun _ -> true), (fun _ -> true), (fun matrix -> Matrix.CSR matrix.ToCSR) @@ -189,7 +188,7 @@ module WithoutTransfer = type Bool() = inherit Benchmark,bool>( - (Matrix.map2AtLeastOne ArithmeticOperations.boolSumAtLeastOne), + (Operations.Matrix.map2AtLeastOne ArithmeticOperations.boolSumAtLeastOne), (fun _ -> true), (fun _ -> true), Matrix.COO @@ -201,7 +200,7 @@ module WithoutTransfer = type Float32() = inherit Benchmark,float32>( - (Matrix.map2AtLeastOne ArithmeticOperations.float32SumAtLeastOne), + (Operations.Matrix.map2AtLeastOne ArithmeticOperations.float32SumAtLeastOne), float32, (fun _ -> Utils.nextSingle (System.Random())), Matrix.COO @@ -214,7 +213,7 @@ module WithoutTransfer = type Bool() = inherit Benchmark,bool>( - (Matrix.map2AtLeastOne ArithmeticOperations.boolSumAtLeastOne), + (Operations.Matrix.map2AtLeastOne ArithmeticOperations.boolSumAtLeastOne), (fun _ -> true), (fun _ -> true), (fun matrix -> Matrix.CSR matrix.ToCSR) @@ -226,7 +225,7 @@ module WithoutTransfer = type Float32() = inherit Benchmark,float32>( - (Matrix.map2AtLeastOne ArithmeticOperations.float32SumAtLeastOne), + (Operations.Matrix.map2AtLeastOne ArithmeticOperations.float32SumAtLeastOne), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun matrix -> Matrix.CSR matrix.ToCSR) @@ -273,7 +272,7 @@ module WithTransfer = type Float32() = inherit Benchmark,float32>( - (Matrix.map2 ArithmeticOperations.float32SumOption), + (Operations.Matrix.map2 ArithmeticOperations.float32SumOption), float32, (fun _ -> Utils.nextSingle (System.Random())), Matrix.COO, diff --git a/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs b/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs index 87e81239..e8a75071 100644 --- a/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs +++ b/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Expand.fs @@ -1,16 +1,14 @@ module GraphBLAS.FSharp.Benchmarks.Matrix.SpGeMM.Expand open System.IO -open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.IO open BenchmarkDotNet.Attributes open Brahma.FSharp +open GraphBLAS.FSharp +open GraphBLAS.FSharp.IO +open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Benchmarks -open GraphBLAS.FSharp.Backend [] [] @@ -134,7 +132,7 @@ module WithoutTransfer = type Float32() = inherit Benchmark( - Matrix.SpGeMM.expand (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), + Operations.SpGeMM.expand (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) diff --git a/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Masked.fs b/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Masked.fs index 2a164021..ff0495bf 100644 --- a/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Masked.fs +++ b/benchmarks/GraphBLAS-sharp.Benchmarks/Matrix/SpGeMM/Masked.fs @@ -5,12 +5,10 @@ open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.IO open BenchmarkDotNet.Attributes open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Benchmarks -open GraphBLAS.FSharp.Backend [] [] @@ -53,7 +51,7 @@ type Masked<'elem when 'elem : struct>( static member AvaliableContexts = Utils.availableContexts static member InputMatrixProviderBuilder pathToConfig = - let datasetFolder = "Mxm" + let datasetFolder = "" pathToConfig |> Utils.getMatricesFilenames |> Seq.map @@ -204,7 +202,7 @@ type MxmBenchmarksWithTransposing<'elem when 'elem : struct>( type Mxm4Float32MultiplicationOnlyBenchmark() = inherit MxmBenchmarksMultiplicationOnly( - Matrix.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), + Operations.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) @@ -216,7 +214,7 @@ type Mxm4Float32MultiplicationOnlyBenchmark() = type Mxm4Float32WithTransposingBenchmark() = inherit MxmBenchmarksWithTransposing( - Matrix.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), + Operations.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) @@ -228,7 +226,7 @@ type Mxm4Float32WithTransposingBenchmark() = type Mxm4BoolMultiplicationOnlyBenchmark() = inherit MxmBenchmarksMultiplicationOnly( - (Matrix.SpGeMM.masked (fst ArithmeticOperations.boolAdd) (fst ArithmeticOperations.boolMul)), + (Operations.SpGeMM.masked (fst ArithmeticOperations.boolAdd) (fst ArithmeticOperations.boolMul)), (fun _ -> true), (fun _ -> true), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) @@ -240,7 +238,7 @@ type Mxm4BoolMultiplicationOnlyBenchmark() = type Mxm4BoolWithTransposingBenchmark() = inherit MxmBenchmarksWithTransposing( - (Matrix.SpGeMM.masked (fst ArithmeticOperations.boolAdd) (fst ArithmeticOperations.boolMul)), + (Operations.SpGeMM.masked (fst ArithmeticOperations.boolAdd) (fst ArithmeticOperations.boolMul)), (fun _ -> true), (fun _ -> true), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) @@ -252,7 +250,7 @@ type Mxm4BoolWithTransposingBenchmark() = type Mxm4Float32MultiplicationOnlyWithZerosFilterBenchmark() = inherit MxmBenchmarksMultiplicationOnly( - (Matrix.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul)), + (Operations.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul)), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) @@ -264,7 +262,7 @@ type Mxm4Float32MultiplicationOnlyWithZerosFilterBenchmark() = type Mxm4Float32WithTransposingWithZerosFilterBenchmark() = inherit MxmBenchmarksWithTransposing( - Matrix.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), + Operations.SpGeMM.masked (fst ArithmeticOperations.float32Add) (fst ArithmeticOperations.float32Mul), float32, (fun _ -> Utils.nextSingle (System.Random())), (fun context matrix -> ClMatrix.CSR <| matrix.ToCSR.ToDevice context) diff --git a/benchmarks/GraphBLAS-sharp.Benchmarks/Vector/Map2.fs b/benchmarks/GraphBLAS-sharp.Benchmarks/Vector/Map2.fs index 523f5185..5c4871e2 100644 --- a/benchmarks/GraphBLAS-sharp.Benchmarks/Vector/Map2.fs +++ b/benchmarks/GraphBLAS-sharp.Benchmarks/Vector/Map2.fs @@ -2,16 +2,14 @@ module GraphBLAS.FSharp.Benchmarks.Vector.Map2 open FsCheck open BenchmarkDotNet.Attributes - open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp open GraphBLAS.FSharp.Benchmarks open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Vector -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions [] [] @@ -29,7 +27,7 @@ type Benchmarks<'elem when 'elem : struct>( member val HostVectorPair = Unchecked.defaultof * Vector<'elem>> with get, set - member val ResultVector = Unchecked.defaultof> with get,set + member val ResultVector = Unchecked.defaultof option> with get,set [] member val OclContextInfo = Unchecked.defaultof with get, set @@ -69,7 +67,9 @@ type Benchmarks<'elem when 'elem : struct>( secondVector.Dispose this.Processor member this.ClearResult() = - this.ResultVector.Dispose this.Processor + match this.ResultVector with + | Some v -> v.Dispose this.Processor + | None -> () member this.CreateVectors() = this.HostVectorPair <- List.last (Gen.sample this.Size 1 generator) @@ -122,26 +122,26 @@ module WithoutTransfer = type Float() = inherit Benchmark( - (Vector.map2 ArithmeticOperations.floatSumOption), + (Operations.Vector.map2 ArithmeticOperations.floatSumOption), VectorGenerator.floatPair Sparse) type Int32() = inherit Benchmark( - (Vector.map2 ArithmeticOperations.intSumOption), + (Operations.Vector.map2 ArithmeticOperations.intSumOption), VectorGenerator.intPair Sparse) module AtLeastOne = type Float() = inherit Benchmark( - (Vector.map2AtLeastOne ArithmeticOperations.floatSumAtLeastOne), + (Operations.Vector.map2AtLeastOne ArithmeticOperations.floatSumAtLeastOne), VectorGenerator.floatPair Sparse) type Int32() = inherit Benchmark( - (Vector.map2AtLeastOne ArithmeticOperations.intSumAtLeastOne), + (Operations.Vector.map2AtLeastOne ArithmeticOperations.intSumAtLeastOne), VectorGenerator.intPair Sparse) module WithTransfer = @@ -164,8 +164,12 @@ module WithTransfer = override this.Benchmark () = this.LoadVectorsToGPU() this.Map2() - this.ResultVector.ToHost this.Processor |> ignore - this.Processor.PostAndReply Msg.MsgNotifyMe + match this.ResultVector with + | Some v -> + v.ToHost this.Processor |> ignore + this.Processor.PostAndReply Msg.MsgNotifyMe + | None -> () + [] override this.IterationCleanup () = @@ -178,24 +182,24 @@ module WithTransfer = type Float() = inherit Benchmark( - (Vector.map2 ArithmeticOperations.floatSumOption), + (Operations.Vector.map2 ArithmeticOperations.floatSumOption), VectorGenerator.floatPair Sparse) type Int32() = inherit Benchmark( - (Vector.map2 ArithmeticOperations.intSumOption), + (Operations.Vector.map2 ArithmeticOperations.intSumOption), VectorGenerator.intPair Sparse) module AtLeastOne = type Float() = inherit Benchmark( - (Vector.map2AtLeastOne ArithmeticOperations.floatSumAtLeastOne), + (Operations.Vector.map2AtLeastOne ArithmeticOperations.floatSumAtLeastOne), VectorGenerator.floatPair Sparse) type Int32() = inherit Benchmark( - (Vector.map2AtLeastOne ArithmeticOperations.intSumAtLeastOne), + (Operations.Vector.map2AtLeastOne ArithmeticOperations.intSumAtLeastOne), VectorGenerator.intPair Sparse) diff --git a/build/build.fs b/build/build.fs index ebe40819..15a5f2b9 100644 --- a/build/build.fs +++ b/build/build.fs @@ -66,7 +66,7 @@ let gitRepoName = "GraphBLAS-sharp" let gitHubRepoUrl = sprintf "https://github.com/%s/%s" gitOwner gitRepoName -let releaseBranch = "main" +let releaseBranch = "master" let tagFromVersionNumber versionNumber = sprintf "v%s" versionNumber @@ -76,7 +76,6 @@ let mutable latestEntry = if Seq.isEmpty changelog.Entries then Changelog.ChangelogEntry.New("0.0.1", "0.0.1-alpha.1", Some DateTime.Today, None, [], false) else changelog.LatestEntry -let mutable linkReferenceForLatestEntry = "" let mutable changelogBackupFilename = "" let publishUrl = "https://www.nuget.org" @@ -97,7 +96,7 @@ let nugetToken = Environment.environVarOrNone "NUGET_TOKEN" let isRelease (targets : Target list) = targets |> Seq.map(fun t -> t.Name) - |> Seq.exists ((=)"Release") + |> Seq.exists (fun name -> name = "Release" || name = "Publish") let invokeAsync f = async { f () } @@ -113,18 +112,25 @@ let failOnBadExitAndPrint (p : ProcessResult) = p.Errors |> Seq.iter Trace.traceError failwithf "failed with exitcode %d" p.ExitCode +let isCI = lazy environVarAsBoolOrDefault "CI" false + // CI Servers can have bizzare failures that have nothing to do with your code let rec retryIfInCI times fn = - match Environment.environVarOrNone "CI" with - | Some _ -> + if isCI.Value then if times > 1 then try - fn() - with - | _ -> retryIfInCI (times - 1) fn + fn () + with _ -> + retryIfInCI (times - 1) fn else - fn() - | _ -> fn() + fn () + else + fn () + +let isOnCI () = + if not isCI.Value then + failwith "Not on CI. If you want to publish, please use CI." + let isReleaseBranchCheck () = if Git.Information.getBranchName "" <> releaseBranch then failwithf "Not on %s. If you want to release please switch to this branch." releaseBranch @@ -161,7 +167,8 @@ module Changelog = | None -> sprintf "%s/releases/tag/%s" gitHubRepoUrl (tagFromVersionNumber newVersion.AsString) sprintf "[%s]: %s" newVersion.AsString linkTarget - let mkReleaseNotes (linkReference : string) (latestEntry : Changelog.ChangelogEntry) = + let mkReleaseNotes (latestEntry : Changelog.ChangelogEntry) = + let linkReference = mkLinkReference latestEntry.SemVer changelog if String.isNullOrEmpty linkReference then latestEntry.ToString() else // Add link reference target to description before building release notes, since in main changelog file it's at the bottom of the file @@ -273,6 +280,11 @@ let allReleaseChecks () = isReleaseBranchCheck () Changelog.isChangelogEmpty () +let allPublishChecks () = + isOnCI () + Changelog.isChangelogEmpty () + + //----------------------------------------------------------------------------- // Target Implementations //----------------------------------------------------------------------------- @@ -330,9 +342,8 @@ let updateChangelog ctx = ) let versionTuple version = (version.Major, version.Minor, version.Patch) let prereleaseEntries = changelog.Entries |> List.filter (fun entry -> entry.SemVer.PreRelease.IsSome && versionTuple entry.SemVer = versionTuple newVersion) - let prereleaseChanges = prereleaseEntries |> List.collect (fun entry -> entry.Changes |> List.filter (not << Changelog.isEmptyChange)) + let prereleaseChanges = prereleaseEntries |> List.collect (fun entry -> entry.Changes |> List.filter (not << Changelog.isEmptyChange)) |> List.distinct let assemblyVersion, nugetVersion = Changelog.parseVersions newVersion.AsString - linkReferenceForLatestEntry <- Changelog.mkLinkReference newVersion changelog let newEntry = Changelog.ChangelogEntry.New(assemblyVersion.Value, nugetVersion.Value, Some System.DateTime.Today, description, unreleasedChanges @ prereleaseChanges, false) let newChangelog = Changelog.Changelog.New(changelog.Header, changelog.Description, None, newEntry :: changelog.Entries) latestEntry <- newEntry @@ -346,7 +357,7 @@ let updateChangelog ctx = |> Changelog.save changelogFilename // Now update the link references at the end of the file - linkReferenceForLatestEntry <- Changelog.mkLinkReference newVersion changelog + let linkReferenceForLatestEntry = Changelog.mkLinkReference newVersion changelog let linkReferenceForUnreleased = sprintf "[Unreleased]: %s/compare/%s...%s" gitHubRepoUrl (tagFromVersionNumber newVersion.AsString) "HEAD" let tailLines = File.read changelogFilename |> List.ofSeq |> List.rev @@ -521,7 +532,7 @@ let generateAssemblyInfo _ = let dotnetPack ctx = // Get release notes with properly-linked version number - let releaseNotes = latestEntry |> Changelog.mkReleaseNotes linkReferenceForLatestEntry + let releaseNotes = latestEntry |> Changelog.mkReleaseNotes let args = [ sprintf "/p:PackageVersion=%s" latestEntry.NuGetVersion @@ -543,7 +554,7 @@ let sourceLinkTest _ = ) let publishToNuget _ = - allReleaseChecks () + allPublishChecks () Paket.push(fun c -> { c with ToolType = ToolType.CreateLocalTool() @@ -577,7 +588,7 @@ let gitRelease _ = Git.Branches.pushTag "" "origin" tag let githubRelease _ = - allReleaseChecks () + allPublishChecks () let token = match githubToken with | Some s -> s @@ -585,7 +596,7 @@ let githubRelease _ = let files = !! distGlob // Get release notes with properly-linked version number - let releaseNotes = latestEntry |> Changelog.mkReleaseNotes linkReferenceForLatestEntry + let releaseNotes = latestEntry |> Changelog.mkReleaseNotes GitHub.createClientWithToken token |> GitHub.draftNewRelease gitOwner gitRepoName (tagFromVersionNumber latestEntry.NuGetVersion) (latestEntry.SemVer.PreRelease <> None) (releaseNotes |> Seq.singleton) @@ -635,7 +646,9 @@ let watchDocs _ = DocsTool.watch () let releaseDocs ctx = - isReleaseBranchCheck () // Docs changes don't need a full release to the library + if isCI.Value + then allPublishChecks () // Release docs on publishing on CI + else isReleaseBranchCheck () // Docs changes don't need a full release to the library Git.Staging.stageAll docsDir Git.Commit.exec "" (sprintf "Documentation release of version %s" latestEntry.NuGetVersion) @@ -681,6 +694,7 @@ let initTargets () = Target.create "FormatCode" formatCode Target.create "CheckFormatCode" checkFormatCode Target.create "Release" ignore + Target.create "Publish" ignore Target.create "BuildDocs" buildDocs Target.create "WatchDocs" watchDocs Target.create "ReleaseDocs" releaseDocs @@ -705,13 +719,16 @@ let initTargets () = // Ensure UpdateChangelog is called after DotnetRestore and before GenerateAssemblyInfo "DotnetRestore" ?=>! "UpdateChangelog" "UpdateChangelog" ?=>! "GenerateAssemblyInfo" - "UpdateChangelog" ==>! "PublishToNuGet" "BuildDocs" ==>! "ReleaseDocs" "BuildDocs" ?=>! "PublishToNuget" "DotnetPack" ?=>! "BuildDocs" "GenerateCoverageReport" ?=>! "ReleaseDocs" + "UpdateChangelog" + ==> "GitRelease" + ==>! "Release" + "DotnetRestore" ==> "CheckFormatCode" @@ -722,9 +739,8 @@ let initTargets () = ==> "DotnetPack" ==> "SourceLinkTest" ==> "PublishToNuGet" - ==> "GitRelease" ==> "GitHubRelease" - ==>! "Release" + ==>! "Publish" "DotnetRestore" ==>! "WatchTests" diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.html new file mode 100644 index 00000000..0410dacd --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / GraphBLAS-sharp.Backend.html-GraphBLAS-sharp \ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-algorithms-bfs.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-algorithms-bfs.html new file mode 100644 index 00000000..08404686 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-algorithms-bfs.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / BFS-GraphBLAS-sharp

BFS

Namespace

GraphBLAS.FSharp.Backend.Algorithms

Functions and values

Function or valueSignatureDescription
#singleSource(...)add:Expr<(int option -> int option -> int option)> -> mul:Expr<('a option -> int option -> int option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> CSR<'a> -> int -> ClArray<int option>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-clarray-bitmap.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-clarray-bitmap.html new file mode 100644 index 00000000..09a1f11f --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-clarray-bitmap.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Bitmap-GraphBLAS-sharp

Bitmap

Namespace

GraphBLAS.FSharp.Backend.Common
Parent Module
ClArray

Functions and values

Function or valueSignatureDescription
#firstOccurrence(clContext)clContext:ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'?23541> -> ClArray<int>
#firstOccurrence2(clContext)clContext:ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'?23549> -> ClArray<'?23549> -> ClArray<int>
#lastOccurrence(clContext)clContext:ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'?23543> -> ClArray<int>
#lastOccurrence2(clContext)clContext:ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'b> -> ClArray<'b> -> ClArray<int>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-clarray.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-clarray.html new file mode 100644 index 00000000..0d6e872c --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-clarray.html @@ -0,0 +1,8 @@ + +GraphBLAS-sharp docs / ClArray-GraphBLAS-sharp

ClArray

Namespace

GraphBLAS.FSharp.Backend.Common

Nested types and modules

ModuleDescription
#Bitmap

Functions and values

Function or valueSignatureDescription
#assignOption op clContext workGroupSizeop:Expr<('a -> 'b option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<int> -> ClArray<'b> -> unit
#assignOption2 op clContext workGroupSizeop:Expr<('a -> 'b -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<'b> -> ClArray<int> -> ClArray<'c> -> unit
#blit clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> int -> ClArray<'a> -> int -> int -> unit
#choose predicate clContext workGroupSizepredicate:Expr<('a -> 'b option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<'b> option
#choose2(...)predicate:Expr<('a -> 'b -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<'b> -> ClArray<'c>
#chunkBySize clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<'a> -> ClArray<'a> []

+ Divides the input array into chunks of size at most chunkSize. +

#concat clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> seq<ClArray<'a>> -> ClArray<'a>
#copy clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<'a>
#create clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> 'a -> ClArray<'a>
#exists predicate clContext workGroupSizepredicate:Expr<('a -> bool)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClCell<bool>
#fill clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClCell<'a> -> int -> int -> ClArray<'a> -> unit
#init initializer clContext workGroupSizeinitializer:Expr<(int -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<'a>
#item clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> int -> ClArray<'a> -> ClCell<'a>
#lazyChunkBySize clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<'a> -> seq<Lazy<ClArray<'a>>>

+ Lazy divides the input array into chunks of size at most chunkSize. +

Remarks

+ Since calculations are performed lazily, the array should not change. +

#map op clContext workGroupSizeop:Expr<('a -> 'b)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<'b>
#map2 map clContext workGroupSizemap:Expr<('a -> 'b -> 'c)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<'b> -> ClArray<'c>
#map2InPlace map clContext workGroupSizemap:Expr<('a -> 'b -> 'c)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<'b> -> ClArray<'c> -> unit
#mapWithValue clContext workGroupSize opclContext:ClContext -> workGroupSize:int -> op:Expr<('a -> 'b -> 'c)> -> MailboxProcessor<Msg> -> AllocationFlag -> 'a -> ClArray<'b> -> ClArray<'c>
#pairwise clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<'a * 'a> option
#removeDuplications(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<'a>
#replicate clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> int -> ClArray<'a>
#set clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> int -> 'a -> unit
#sub clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> int -> int -> ClArray<'a>
#upperBound(clContext)clContext:ClContext -> int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClCell<'a> -> ClCell<int>
#upperBoundAndValue(clContext)clContext:ClContext -> int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClCell<'a> -> ClCell<int * 'a>
#zeroCreate clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-merge.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-merge.html new file mode 100644 index 00000000..40236bec --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-merge.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Merge-GraphBLAS-sharp

Merge

Namespace

GraphBLAS.FSharp.Backend.Common

Functions and values

Function or valueSignatureDescription
#run clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<'a> -> ClArray<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-prefixsum-bykey.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-prefixsum-bykey.html new file mode 100644 index 00000000..5437f7f5 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-prefixsum-bykey.html @@ -0,0 +1,6 @@ + +GraphBLAS-sharp docs / ByKey-GraphBLAS-sharp

ByKey

Namespace

GraphBLAS.FSharp.Backend.Common
Parent Module
PrefixSum

Functions and values

Function or valueSignatureDescription
#sequentialExclude(op)op:Expr<('?23587 -> '?23587 -> '?23587)> -> '?23587 -> ClContext -> int -> MailboxProcessor<Msg> -> int -> ClArray<'?23587> -> ClArray<int> -> ClArray<int> -> unit

+ Exclude scan by key. +

#sequentialInclude(op)op:Expr<('c -> 'c -> 'c)> -> 'c -> ClContext -> int -> MailboxProcessor<Msg> -> int -> ClArray<'c> -> ClArray<int> -> ClArray<int> -> unit

+ Include scan by key. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-prefixsum.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-prefixsum.html new file mode 100644 index 00000000..18b27701 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-prefixsum.html @@ -0,0 +1,6 @@ + +GraphBLAS-sharp docs / PrefixSum-GraphBLAS-sharp

PrefixSum

Namespace

GraphBLAS.FSharp.Backend.Common

Nested types and modules

ModuleDescription
#ByKey

Functions and values

Function or valueSignatureDescription
#runBackwardsExcludeInPlace(plus)plus:Expr<('?23576 -> '?23576 -> '?23576)> -> ClContext -> int -> MailboxProcessor<Msg> -> ClArray<'?23576> -> '?23576 -> ClCell<'?23576>
#runBackwardsIncludeInPlace(plus)plus:Expr<('a -> 'a -> 'a)> -> ClContext -> int -> MailboxProcessor<Msg> -> ClArray<'a> -> 'a -> ClCell<'a>
#runExcludeInPlace(plus)plus:Expr<('b -> 'b -> 'b)> -> ClContext -> int -> MailboxProcessor<Msg> -> ClArray<'b> -> 'b -> ClCell<'b>
#runIncludeInPlace(plus)plus:Expr<('a -> 'a -> 'a)> -> ClContext -> int -> MailboxProcessor<Msg> -> ClArray<'a> -> 'a -> ClCell<'a>
#standardExcludeInPlace(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClCell<int>

+ Exclude inplace prefix sum. +

#standardIncludeInPlace(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClCell<int>

+ Include inplace prefix sum. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey-option.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey-option.html new file mode 100644 index 00000000..e07e9d29 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey-option.html @@ -0,0 +1,6 @@ + +GraphBLAS-sharp docs / Option-GraphBLAS-sharp

Option

Namespace

GraphBLAS.FSharp.Backend.Common
Parent Module
ByKey

Functions and values

Function or valueSignatureDescription
#segmentSequential(...)reduceOp:Expr<('a -> 'a -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> (ClArray<'a> * ClArray<int>) option

+ Reduces values by key. Each segment is reduced by one work item. +

Remarks

+ The length of the result must be calculated in advance. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey.html new file mode 100644 index 00000000..2157474c --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey.html @@ -0,0 +1,17 @@ + +GraphBLAS-sharp docs / ByKey-GraphBLAS-sharp

ByKey

Namespace

GraphBLAS.FSharp.Backend.Common
Parent Module
Reduce

+ Reduction of an array of values by an array of keys. +

Nested types and modules

ModuleDescription
#Option

Functions and values

Function or valueSignatureDescription
#oneWorkGroupSegments(...)reduceOp:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<'a> -> ClArray<'a> * ClArray<int>

+ Reduces values by key. One work group participates in the reduction. +

Remarks

+ Reduces an array of values that does not exceed the size of the workgroup. + The length of the result must be calculated in advance. +

#segmentSequential(...)reduceOp:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> ClArray<'a> * ClArray<int>

+ Reduces values by key. Each segment is reduced by one work item. +

Remarks

+ The length of the result must be calculated in advance. +

#sequential(...)reduceOp:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<'a> -> ClArray<'a> * ClArray<int>

+ Reduce an array of values by key using a single work item. +

Remarks

+ The length of the result must be calculated in advance. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey2d-option.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey2d-option.html new file mode 100644 index 00000000..bae8e26d --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey2d-option.html @@ -0,0 +1,6 @@ + +GraphBLAS-sharp docs / Option-GraphBLAS-sharp

Option

Namespace

GraphBLAS.FSharp.Backend.Common
Parent Module
ByKey2D

Functions and values

Function or valueSignatureDescription
#segmentSequential(...)reduceOp:Expr<('a -> 'a -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> (ClArray<'a> * ClArray<int> * ClArray<int>) option

+ Reduces values by key. Each segment is reduced by one work item. +

Remarks

+ The length of the result must be calculated in advance. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey2d.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey2d.html new file mode 100644 index 00000000..92d7c775 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce-bykey2d.html @@ -0,0 +1,10 @@ + +GraphBLAS-sharp docs / ByKey2D-GraphBLAS-sharp

ByKey2D

Namespace

GraphBLAS.FSharp.Backend.Common
Parent Module
Reduce

Nested types and modules

ModuleDescription
#Option

Functions and values

Function or valueSignatureDescription
#segmentSequential(...)reduceOp:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> ClArray<'a> * ClArray<int> * ClArray<int>

+ Reduces values by key. Each segment is reduced by one work item. +

Remarks

+ The length of the result must be calculated in advance. +

#sequential(...)reduceOp:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> ClArray<'a> * ClArray<int> * ClArray<int>

+ Reduce an array of values by 2D keys using a single work item. +

Remarks

+ The length of the result must be calculated in advance. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce.html new file mode 100644 index 00000000..713eb351 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-reduce.html @@ -0,0 +1,8 @@ + +GraphBLAS-sharp docs / Reduce-GraphBLAS-sharp

Reduce

Namespace

GraphBLAS.FSharp.Backend.Common

Nested types and modules

ModuleDescription
#ByKey

+ Reduction of an array of values by an array of keys. +

#ByKey2D

Functions and values

Function or valueSignatureDescription
#reduce op clContext workGroupSizeop:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClCell<'a>

+ Reduce an array of values. +

#sum op zero clContext workGroupSizeop:Expr<('a -> 'a -> 'a)> -> zero:'a -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClCell<'a>

+ Summarize array elements. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-sort-radix.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-sort-radix.html new file mode 100644 index 00000000..3219ddd5 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-common-sort-radix.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Radix-GraphBLAS-sharp

Radix

Namespace

GraphBLAS.FSharp.Backend.Common.Sort

Functions and values

Function or valueSignatureDescription
#count clContext workGroupSize maskclContext:ClContext -> workGroupSize:int -> mask:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClCell<int> -> ClCell<int> -> ClArray<int> * ClArray<int>
#defaultBitCountint
#keyBitCountint
#localPrefixSumExpr<(int -> int -> int [] -> unit)>
#runByKeys(...)clContext:ClContext -> workGroupSize:int -> bitCount:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<int> -> ClArray<'a> -> ClArray<'a>
#runByKeysStandard(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<int> -> ClArray<'b> -> ClArray<'b>
#runKeysOnly(...)clContext:ClContext -> workGroupSize:int -> bitCount:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClArray<int>
#scatter clContext workGroupSize maskclContext:ClContext -> workGroupSize:int -> mask:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClCell<int> -> ClCell<int> -> ClArray<int> -> ClArray<int> -> ClArray<int> -> unit
#scatterByKey(...)clContext:ClContext -> workGroupSize:int -> mask:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClArray<'a> -> ClCell<int> -> ClCell<int> -> ClArray<int> -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> unit
#standardRunKeysOnly(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClArray<int>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-coo-matrix.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-coo-matrix.html new file mode 100644 index 00000000..4944bd2c --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-coo-matrix.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Matrix-GraphBLAS-sharp

Matrix

Namespace

GraphBLAS.FSharp.Backend.Matrix.COO

Functions and values

Function or valueSignatureDescription
#getTuples clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'a> -> Tuple<'a>
#mapExpr<('c option -> 'd option)> -> ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'c> -> COO<'d>
#map2Expr<('d option -> 'e option -> 'f option)> -> ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'d> -> COO<'e> -> COO<'f>
#map2AtLeastOne(...)clContext:ClContext -> opAdd:Expr<(AtLeastOne<'a,'b> -> 'c option)> -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'a> -> COO<'b> -> COO<'c>
#toCSR clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'a> -> CSR<'a>
#toCSRInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'a> -> CSR<'a>
#transpose clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> COO<'a> -> COO<'a>
#transposeInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> COO<'a> -> COO<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-coo-merge.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-coo-merge.html new file mode 100644 index 00000000..d598f6fc --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-coo-merge.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Merge-GraphBLAS-sharp

Merge

Namespace

GraphBLAS.FSharp.Backend.Matrix.COO

Functions and values

Function or valueSignatureDescription
#run clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> COO<'a> -> COO<'b> -> ClArray<int> * ClArray<int> * ClArray<'a> * ClArray<'b> * ClArray<int>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-csr-matrix.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-csr-matrix.html new file mode 100644 index 00000000..1257ebe3 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-csr-matrix.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Matrix-GraphBLAS-sharp

Matrix

Namespace

GraphBLAS.FSharp.Backend.Matrix.CSR

Functions and values

Function or valueSignatureDescription
#NNZInRows clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'b> -> ClArray<int>
#byRows clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> seq<Sparse<'a> option>
#byRowsLazy clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> seq<Lazy<Sparse<'a> option>>
#expandRowPointers(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> ClArray<int>
#item clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> int -> int -> CSR<'a> -> ClCell<'a option>
#kroneckerClContext -> int -> Expr<('d option -> 'e option -> 'f option)> -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'d> -> CSR<'e> -> COO<'f> option
#mapExpr<('c option -> 'd option)> -> ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'c> -> COO<'d>
#map2Expr<('d option -> 'e option -> 'f option)> -> ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'d> -> CSR<'e> -> COO<'f>
#map2AtLeastOne(...)clContext:ClContext -> opAdd:Expr<(AtLeastOne<'a,'b> -> 'c option)> -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> CSR<'b> -> COO<'c>
#subRows clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> int -> CSR<'a> -> COO<'a>
#toCOO clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> COO<'a>
#toCOOInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> COO<'a>
#toLIL clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> LIL<'a>
#transpose clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> CSR<'a>
#transposeInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> CSR<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-csr-merge.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-csr-merge.html new file mode 100644 index 00000000..eef4dd71 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-csr-merge.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Merge-GraphBLAS-sharp

Merge

Namespace

GraphBLAS.FSharp.Backend.Matrix.CSR

Functions and values

Function or valueSignatureDescription
#run clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> CSR<'a> -> CSR<'b> -> ClArray<int> * ClArray<int> * ClArray<'a> * ClArray<'b> * ClArray<int> * ClArray<int>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-lil-matrix.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-lil-matrix.html new file mode 100644 index 00000000..913e43e8 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-lil-matrix.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Matrix-GraphBLAS-sharp

Matrix

Namespace

GraphBLAS.FSharp.Backend.Matrix.LIL

Functions and values

Function or valueSignatureDescription
#toCSR clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> LIL<'a> -> CSR<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-matrix-spgemm.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-matrix-spgemm.html new file mode 100644 index 00000000..4e76d085 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-matrix-spgemm.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / SpGeMM-GraphBLAS-sharp

SpGeMM

Namespace

GraphBLAS.FSharp.Backend.Matrix
Parent Module
Matrix

Functions and values

Function or valueSignatureDescription
#expand(...)opAdd:Expr<('c -> 'c -> 'c option)> -> opMul:Expr<('a -> 'b -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'b> -> COO<'c> option
#masked(...)opAdd:Expr<('c -> 'c -> 'c option)> -> opMul:Expr<('a -> 'b -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClMatrix<'a> -> ClMatrix<'b> -> ClMatrix<'?22920> -> ClMatrix<'c>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-matrix.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-matrix.html new file mode 100644 index 00000000..bff4998a --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-matrix.html @@ -0,0 +1,34 @@ + +GraphBLAS-sharp docs / Matrix-GraphBLAS-sharp

Matrix

Namespace

GraphBLAS.FSharp.Backend.Matrix

Nested types and modules

ModuleDescription
#SpGeMM

Functions and values

Function or valueSignatureDescription
#copy clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>
#kronecker op clContext workGroupSizeop:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'b> -> ClMatrix<'c> option
#map opAdd clContext workGroupSizeopAdd:Expr<('a option -> 'b option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'b>
#map2 opAdd clContext workGroupSizeopAdd:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'b> -> ClMatrix<'c>
#map2AtLeastOne(...)opAdd:Expr<(AtLeastOne<'a,'b> -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'b> -> ClMatrix<'c>
#toCOO clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>

+ Creates a new matrix, represented in COO format, that is equal to the given one. +

#toCOOInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>

+ Returns the matrix, represented in COO format, that is equal to the given one. + The given matrix should neither be used afterwards nor be disposed. +

#toCSC clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>

+ Creates a new matrix, represented in CSC format, that is equal to the given one. +

#toCSCInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>

+ Returns the matrix, represented in CSC format, that is equal to the given one. + The given matrix should neither be used afterwards nor be disposed. +

#toCSR clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>

+ Creates a new matrix, represented in CSR format, that is equal to the given one. +

#toCSRInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>

+ Returns the matrix, represented in CSR format, that is equal to the given one. + The given matrix should neither be used afterwards nor be disposed. +

#toLIL clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'a> -> ClMatrix<'a>
#transpose clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClMatrix<'?22909> -> ClMatrix<'?22909>

+ Transposes the given matrix and returns result as a new matrix. + The storage format is not guaranteed to be preserved. +

Remarks

+ The format changes according to the following: + * COO -> COO + * CSR -> CSC + * CSC -> CSR +

#transposeInPlace clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClMatrix<'?22907> -> ClMatrix<'?22907>

+ Transposes the given matrix and returns result. + The given matrix should neither be used afterwards nor be disposed. + The storage format is not guaranteed to be preserved. +

Remarks

+ The format changes according to the following: + * COO -> COO + * CSR -> CSC + * CSC -> CSR +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-spgemm-expand.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-spgemm-expand.html new file mode 100644 index 00000000..16eca8e8 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-matrix-spgemm-expand.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Expand-GraphBLAS-sharp

Expand

Namespace

GraphBLAS.FSharp.Backend.Matrix.SpGeMM

Functions and values

Function or valueSignatureDescription
#expand clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> int -> ClArray<int> -> COO<'a> -> CSR<'b> -> ClArray<'a> * ClArray<'b> * ClArray<int> * ClArray<int>
#getSegmentPointers(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<int> -> ClArray<int> -> int * ClArray<int>
#multiply(...)predicate:Expr<('a -> 'b -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<'b> -> ClArray<int> -> ClArray<int> -> (ClArray<'c> * ClArray<int> * ClArray<int>) option
#reduce opAdd clContext workGroupSizeopAdd:Expr<('a -> 'a -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a> -> ClArray<int> -> ClArray<int> -> (ClArray<'a> * ClArray<int> * ClArray<int>) option
#run opAdd opMul clContext workGroupSizeopAdd:Expr<('d -> 'd -> 'd option)> -> opMul:Expr<('a -> 'b -> 'd option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> CSR<'a> -> CSR<'b> -> COO<'d> option
#runCOO(...)opAdd:Expr<('?22961 -> '?22961 -> '?22961 option)> -> opMul:Expr<('a -> 'b -> '?22961 option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<int> -> CSR<'b> -> COO<'a> -> int * (ClArray<'?22961> * ClArray<int> * ClArray<int>) option
#runManySteps(...)opAdd:Expr<('?22971 -> '?22971 -> '?22971 option)> -> opMul:Expr<('a -> 'b -> '?22971 option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> int -> CSR<'a> -> ClArray<int> -> ClArray<int> -> CSR<'b> -> (ClArray<'?22971> * ClArray<int> * ClArray<int>) list
#runOneStep(...)opAdd:Expr<('?22965 -> '?22965 -> '?22965 option)> -> opMul:Expr<('a -> 'b -> '?22965 option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> ClArray<int> -> CSR<'b> -> COO<'?22965> option
#sortByColumnsAndRows(...)clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a> -> ClArray<int> -> ClArray<int> -> ClArray<'a> * ClArray<int> * ClArray<int>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-arraysextensions.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-arraysextensions.html new file mode 100644 index 00000000..e11da3c3 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-arraysextensions.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ArraysExtensions-GraphBLAS-sharp

ArraysExtensions

Namespace

GraphBLAS.FSharp.Backend.Objects

Functions and values

Function or valueSignatureDescription
#DenseVectorFromArray(array, isZero)(array:'a [] * isZero:('a -> bool)) -> 'a option []
#DenseVectorToString(array)array:'a [] -> string

Type extensions

Type extensionSignatureDescription
#x.Free(q)q:MailboxProcessor<Msg> -> unit

CompiledName:ClArray`1.Free

#x.FreeAndWait(q)q:MailboxProcessor<Msg> -> unit

CompiledName:ClArray`1.FreeAndWait

#x.Sizeint

CompiledName:ClArray`1.get_Size

#x.Sizeint

CompiledName:ClArray`1.get_Size

#x.Sizeint

CompiledName:[]`1.get_Size

#x.Sizeint

CompiledName:[]`1.get_Size

#x.ToDevice(context)context:ClContext -> ClArray<'T>

CompiledName:[]`1.ToDevice

#x.ToHost(q)q:MailboxProcessor<Msg> -> 'a []

CompiledName:ClArray`1.ToHost

#x.ToHostAndFree(q)q:MailboxProcessor<Msg> -> 'a []

CompiledName:ClArray`1.ToHostAndFree

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-atleastone-2.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-atleastone-2.html new file mode 100644 index 00000000..56a7facb --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-atleastone-2.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / AtLeastOne<'a, 'b>-GraphBLAS-sharp

AtLeastOne<'a, 'b>

Namespace

GraphBLAS.FSharp.Backend.Objects

Union Cases

Union CaseSignatureDescription
#Both('a,'b)'a * 'b
#Left('a)'a
#Right('b)'b
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcell.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcell.html new file mode 100644 index 00000000..df35a0d5 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcell.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClCell-GraphBLAS-sharp

ClCell

Namespace

GraphBLAS.FSharp.Backend.Objects

Type extensions

Type extensionSignatureDescription
#x.Free(processor)processor:MailboxProcessor<Msg> -> unit

CompiledName:ClCell`1.Free

#x.ToHost(processor)processor:MailboxProcessor<Msg> -> 'a

CompiledName:ClCell`1.ToHost

#x.ToHostAndFree(processor)processor:MailboxProcessor<Msg> -> 'a

CompiledName:ClCell`1.ToHostAndFree

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcontext-allocationflag.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcontext-allocationflag.html new file mode 100644 index 00000000..e8694cc2 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcontext-allocationflag.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / AllocationFlag-GraphBLAS-sharp

AllocationFlag

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClContext

Union Cases

Union CaseSignatureDescription
#DeviceOnly
#HostInterop
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcontext.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcontext.html new file mode 100644 index 00000000..ee0a4ba2 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clcontext.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClContext-GraphBLAS-sharp

ClContext

Namespace

GraphBLAS.FSharp.Backend.Objects

Nested types and modules

TypeDescription
#AllocationFlag

Type extensions

Type extensionSignatureDescription
#x.CreateClArrayWithSpecificAllocationMode(...)(mode:AllocationFlag * size:int) -> ClArray<'b>

CompiledName:ClContext.CreateClArrayWithSpecificAllocationMode

#x.CreateClArrayWithSpecificAllocationMode(...)(mode:AllocationFlag * array:'a []) -> ClArray<'a>

CompiledName:ClContext.CreateClArrayWithSpecificAllocationMode

#x.MaxMemAllocSizeint<MeasureProduct<Byte,MeasureOne>>

CompiledName:ClContext.get_MaxMemAllocSize

#x.MaxMemAllocSizeint<MeasureProduct<Byte,MeasureOne>>

CompiledName:ClContext.get_MaxMemAllocSize

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-1.html new file mode 100644 index 00000000..39915e4f --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClMatrix<'a>-GraphBLAS-sharp

ClMatrix<'a>

Namespace

GraphBLAS.FSharp.Backend.Objects
Attributes:
[<RequireQualifiedAccess>]

Union Cases

Union CaseSignatureDescription
#COO(COO<'a>)COO<'a>
#CSC(CSC<'a>)CSC<'a>
#CSR(CSR<'a>)CSR<'a>
#LIL(LIL<'a>)LIL<'a>

Instance members

Instance memberSignatureDescription
#x.ColumnCountint

CompiledName:get_ColumnCount

#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.NNZint

CompiledName:get_NNZ

#x.RowCountint

CompiledName:get_RowCount

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-coo-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-coo-1.html new file mode 100644 index 00000000..47f207c7 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-coo-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / COO<'elem>-GraphBLAS-sharp

COO<'elem>

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClMatrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#ColumnsClArray<int>
#ContextClContext
#RowCountint
#RowsClArray<int>
#ValuesClArray<'elem>

Instance members

Instance memberSignatureDescription
#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.NNZint

CompiledName:get_NNZ

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-csc-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-csc-1.html new file mode 100644 index 00000000..aa569b85 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-csc-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / CSC<'elem>-GraphBLAS-sharp

CSC<'elem>

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClMatrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#ColumnPointersClArray<int>
#ContextClContext
#RowCountint
#RowsClArray<int>
#ValuesClArray<'elem>

Instance members

Instance memberSignatureDescription
#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.NNZint

CompiledName:get_NNZ

#x.ToCSRCSR<'elem>

CompiledName:get_ToCSR

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-csr-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-csr-1.html new file mode 100644 index 00000000..e5d0e976 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-csr-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / CSR<'elem>-GraphBLAS-sharp

CSR<'elem>

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClMatrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#ColumnsClArray<int>
#ContextClContext
#RowCountint
#RowPointersClArray<int>
#ValuesClArray<'elem>

Instance members

Instance memberSignatureDescription
#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.NNZint

CompiledName:get_NNZ

#x.ToCSCCSC<'elem>

CompiledName:get_ToCSC

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-lil-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-lil-1.html new file mode 100644 index 00000000..48118260 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-lil-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / LIL<'elem>-GraphBLAS-sharp

LIL<'elem>

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClMatrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#ContextClContext
#NNZint
#RowCountint
#RowsSparse<'elem> option list
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-tuple-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-tuple-1.html new file mode 100644 index 00000000..4f84d930 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix-tuple-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Tuple<'elem>-GraphBLAS-sharp

Tuple<'elem>

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClMatrix

Record Fields

Record FieldSignatureDescription
#ColumnIndicesClArray<int>
#ContextClContext
#RowIndicesClArray<int>
#ValuesClArray<'elem>

Instance members

Instance memberSignatureDescription
#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.NNZint

CompiledName:get_NNZ

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix.html new file mode 100644 index 00000000..5155678d --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clmatrix.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClMatrix-GraphBLAS-sharp

ClMatrix

Namespace

GraphBLAS.FSharp.Backend.Objects

Nested types and modules

TypeDescription
#COO<'elem>
#CSC<'elem>
#CSR<'elem>
#LIL<'elem>
#Tuple<'elem>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector-1.html new file mode 100644 index 00000000..1e254561 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClVector<'a>-GraphBLAS-sharp

ClVector<'a>

Namespace

GraphBLAS.FSharp.Backend.Objects
Attributes:
[<RequireQualifiedAccess>]

Union Cases

Union CaseSignatureDescription
#Dense(ClArray<'a option>)ClArray<'a option>
#Sparse(Sparse<'a>)Sparse<'a>

Instance members

Instance memberSignatureDescription
#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.Sizeint

CompiledName:get_Size

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector-sparse-1.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector-sparse-1.html new file mode 100644 index 00000000..0374b9c5 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector-sparse-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Sparse<'a>-GraphBLAS-sharp

Sparse<'a>

Namespace

GraphBLAS.FSharp.Backend.Objects
Parent Module: ClVector

Record Fields

Record FieldSignatureDescription
#ContextClContext
#IndicesClArray<int>
#Sizeint
#ValuesClArray<'a>

Instance members

Instance memberSignatureDescription
#x.Dispose(q)q:MailboxProcessor<Msg> -> unit
#x.NNZint

CompiledName:get_NNZ

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector.html new file mode 100644 index 00000000..fc7a6797 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-clvector.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClVector-GraphBLAS-sharp

ClVector

Namespace

GraphBLAS.FSharp.Backend.Objects

Nested types and modules

TypeDescription
#Sparse<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-idevicememobject.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-idevicememobject.html new file mode 100644 index 00000000..45cd5673 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-idevicememobject.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / IDeviceMemObject-GraphBLAS-sharp

IDeviceMemObject

Namespace

GraphBLAS.FSharp.Backend.Objects

Instance members

Instance memberSignatureDescription
#x.Dispose(arg1)MailboxProcessor<Msg> -> unit
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-matrixformat.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-matrixformat.html new file mode 100644 index 00000000..23f4f85f --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-matrixformat.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MatrixFormat-GraphBLAS-sharp

MatrixFormat

Namespace

GraphBLAS.FSharp.Backend.Objects

Union Cases

Union CaseSignatureDescription
#COO
#CSC
#CSR
#LIL
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-vectorformat.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-vectorformat.html new file mode 100644 index 00000000..2c2c79a8 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-objects-vectorformat.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / VectorFormat-GraphBLAS-sharp

VectorFormat

Namespace

GraphBLAS.FSharp.Backend.Objects

Union Cases

Union CaseSignatureDescription
#Dense
#Sparse
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-arithmeticoperations.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-arithmeticoperations.html new file mode 100644 index 00000000..e3b6ad86 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-arithmeticoperations.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ArithmeticOperations-GraphBLAS-sharp

ArithmeticOperations

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#addLeftConst zero constantzero:^?23757 -> constant:^?23758 -> Expr<(^?23757 option -> ^?23757 option)>
#addRightConst zero constantzero:^?23761 -> constant:^?23762 -> Expr<(^?23761 option -> ^?23761 option)>
#boolAddExpr<(bool -> bool -> bool option)> * (bool -> bool -> bool option)
#boolMulExpr<(bool -> bool -> bool option)> * (bool -> bool -> bool option)
#boolMulAtLeastOneExpr<(AtLeastOne<bool,bool> -> bool option)>
#boolMulOptionExpr<(bool option -> bool option -> bool option)>
#boolSumAtLeastOneExpr<(AtLeastOne<bool,bool> -> bool option)>
#boolSumOptionExpr<(bool option -> bool option -> bool option)>
#byteMulAtLeastOneExpr<(AtLeastOne<byte,byte> -> byte option)>
#byteMulOptionExpr<(byte option -> byte option -> byte option)>
#byteSumAtLeastOneExpr<(AtLeastOne<byte,byte> -> byte option)>
#byteSumOptionExpr<(byte option -> byte option -> byte option)>
#createPair zero op opQzero:'?23802 -> op:('?23804 -> '?23805 -> '?23802) -> opQ:Expr<('?23806 -> '?23806 -> '?23802)> -> Expr<('?23806 -> '?23806 -> '?23802 option)> * ('?23804 -> '?23805 -> '?23802 option)
#float32AddExpr<(float32 -> float32 -> float32 option)> * (float32 -> float32 -> float32 option)
#float32MulExpr<(float32 -> float32 -> float32 option)> * (float32 -> float32 -> float32 option)
#float32MulAtLeastOneExpr<(AtLeastOne<float32,float32> -> float32 option)>
#float32MulOptionExpr<(float32 option -> float32 option -> float32 option)>
#float32SumAtLeastOneExpr<(AtLeastOne<float32,float32> -> float32 option)>
#float32SumOptionExpr<(float32 option -> float32 option -> float32 option)>
#floatAddExpr<(float -> float -> float option)> * (float -> float -> float option)
#floatMulExpr<(float -> float -> float option)> * (float -> float -> float option)
#floatMulAtLeastOneExpr<(AtLeastOne<float,float> -> float option)>
#floatMulOptionExpr<(float option -> float option -> float option)>
#floatSumAtLeastOneExpr<(AtLeastOne<float,float> -> float option)>
#floatSumOptionExpr<(float option -> float option -> float option)>
#intAddExpr<(int -> int -> int option)> * (int -> int -> int option)
#intMulExpr<(int -> int -> int option)> * (int -> int -> int option)
#intMulAtLeastOneExpr<(AtLeastOne<int,int> -> int option)>
#intMulOptionExpr<(int option -> int option -> int option)>
#intSumAtLeastOneExpr<(AtLeastOne<int,int> -> int option)>
#intSumOptionExpr<(int option -> int option -> int option)>
#mkNumericMul(zero)zero:'?23747 -> Expr<(^t option -> ^t option -> '?23747 option)>
#mkNumericMulAtLeastOne(zero)zero:'?23750 -> Expr<(AtLeastOne<^t,^t> -> '?23750 option)>
#mkNumericSum(zero)zero:^t -> Expr<(^t option -> ^t option -> ^t option)>
#mkNumericSumAtLeastOne(zero)zero:^t -> Expr<(AtLeastOne<^t,^t> -> ^t option)>
#mkUnaryOp zero unaryOpzero:'?23741 -> unaryOp:Expr<('?23741 -> '?23741)> -> Expr<('?23741 option -> '?23741 option)>
#mulLeftConst zero constantzero:^?23777 -> constant:^?23778 -> Expr<(^?23777 option -> ^?23777 option)>
#mulRightConst zero constantzero:^?23781 -> constant:^?23782 -> Expr<(^?23781 option -> ^?23781 option)>
#notOptionExpr<(bool option -> bool option)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-convert.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-convert.html new file mode 100644 index 00000000..6790c3af --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-convert.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Convert-GraphBLAS-sharp

Convert

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#assignComplementedToOption(op)op:Expr<('a option -> 'a option -> 'a option)> -> Expr<('a option -> 'b option -> 'a -> 'a option)>
#assignToOption(op)op:Expr<('a option -> 'a option -> 'a option)> -> Expr<('a option -> 'b option -> 'a -> 'a option)>
#atLeastOneToOption(op)op:Expr<(AtLeastOne<'a,'b> -> 'd option)> -> Expr<('a option -> 'b option -> 'd option)>
#map2ToMapLeftNone(op)op:Expr<('a option -> 'b option -> 'c option)> -> Expr<('b option -> 'c option)>
#map2ToMapRightNone(op)op:Expr<('a option -> 'b option -> 'c option)> -> Expr<('a option -> 'c option)>
#map2ToNoneNone(op)op:Expr<('a option -> 'b option -> 'c option)> -> Expr<'c option>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-map.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-map.html new file mode 100644 index 00000000..935e9add --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-map.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Map-GraphBLAS-sharp

Map

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#choose2Bitmap(map)map:Expr<('a -> 'b -> 'c option)> -> Expr<('a -> 'b -> int)>
#chooseBitmap(map)map:Expr<('a -> 'b option)> -> Expr<('a -> int)>
#fst()unit -> Expr<('b -> 'c -> 'b)>
#idExpr<('a -> 'a)>
#incExpr<(int -> int)>
#option onSome onNoneonSome:'b -> onNone:'b -> Expr<('c option -> 'b)>
#optionToValueOrZero(zero)zero:'a -> Expr<('a option -> 'a)>
#snd()unit -> Expr<('b -> 'c -> 'c)>
#subtractionExpr<(int -> int -> int)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-mask.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-mask.html new file mode 100644 index 00000000..d137d88d --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-mask.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Mask-GraphBLAS-sharp

Mask

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#assignExpr<('a option -> 'a option -> 'a option)>
#complementedOpExpr<('a option -> 'b option -> 'a option)>
#opExpr<('a option -> 'b option -> 'a option)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-predicates.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-predicates.html new file mode 100644 index 00000000..330e0c87 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-predicates.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Predicates-GraphBLAS-sharp

Predicates

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#firstOccurrence()unit -> Expr<(int -> int -> ClArray<'a> -> bool)>
#isSomeExpr<('a option -> bool)>
#lastOccurrence()unit -> Expr<(int -> int -> ClArray<'a> -> bool)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-preparepositions.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-preparepositions.html new file mode 100644 index 00000000..a30ca7ca --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-preparepositions.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / PreparePositions-GraphBLAS-sharp

PreparePositions

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#bothExpr<(int -> 'c option -> ClArray<int> -> ClArray<'c> -> unit)>
#getUniqueBitmapLocalExpr<('a [] -> int -> int -> int [] -> unit)>
#leftRightExpr<(int -> 'c option -> 'c option -> ClArray<int> -> ClArray<'c> -> ClArray<int> -> unit)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-search-bin.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-search-bin.html new file mode 100644 index 00000000..bfe00ec4 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-search-bin.html @@ -0,0 +1,20 @@ + +GraphBLAS-sharp docs / Bin-GraphBLAS-sharp

Bin

Namespace

GraphBLAS.FSharp.Backend.Quotes
Parent Module
Search

Functions and values

Function or valueSignatureDescription
#byKeyExpr<(int -> int -> ClArray<int> -> ClArray<'a> -> 'a option)>

+ Searches value in array by key. + In case there is a value at the given key position, it is returned. +

#byKey2DExpr<(int -> uint64 -> ClArray<int> -> ClArray<int> -> ClArray<'a> -> 'a option)>

+ Searches value in array by two keys. + In case there is a value at the given keys position, it is returned. +

#inRangeExpr<(int -> int -> int -> ClArray<int> -> ClArray<'a> -> 'a option)>

+ Searches a section of the array of indices, bounded by the given left and right edges, for an index, using a binary search algorithm. + In case searched section contains source index, the value at the same position in the array of values is returned. +

Remarks

+ Searched section of index array should be sorted in ascending order. + The index array should have the same length as the array of values. + left edge and right edge should be less than the length of the index array. +

#lowerBoundExpr<(int -> 'a -> ClArray<'a> -> int)>

+ lowerBound is a version of binary search: it attempts to find the element value in an ordered range [first, last). + Specifically, it returns the last position where value could be inserted without violating the ordering. +

#lowerBoundAndValueExpr<(int -> 'a -> ClArray<'a> -> int * 'a)>
#lowerPositionExpr<(int -> 'a -> 'a [] -> int option)>

+ Find lower position of item in array. +

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-search.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-search.html new file mode 100644 index 00000000..29dfc26a --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-search.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Search-GraphBLAS-sharp

Search

Namespace

GraphBLAS.FSharp.Backend.Quotes

Nested types and modules

ModuleDescription
#Bin
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-subreduce.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-subreduce.html new file mode 100644 index 00000000..57159fcd --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-subreduce.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / SubReduce-GraphBLAS-sharp

SubReduce

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#run(opAdd)opAdd:Expr<('a -> 'a -> 'a)> -> Expr<(int -> int -> int -> int -> 'a [] -> unit)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-subsum.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-subsum.html new file mode 100644 index 00000000..4101db89 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-quotes-subsum.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / SubSum-GraphBLAS-sharp

SubSum

Namespace

GraphBLAS.FSharp.Backend.Quotes

Functions and values

Function or valueSignatureDescription
#downSweep(opAdd)opAdd:Expr<('a -> 'a -> 'a)> -> Expr<(int -> int -> 'a [] -> unit)>
#localIntPrefixSumExpr<(int -> int -> int [] -> unit)>
#localPrefixSum(opAdd)opAdd:Expr<('a -> 'a -> 'a)> -> Expr<(int -> int -> 'a [] -> unit)>
#sequentialSumExpr<('a -> 'a -> 'a)> -> Expr<(int -> int -> 'a [] -> unit)>
#upSweepExpr<('a -> 'a -> 'a)> -> Expr<(int -> int -> 'a [] -> unit)>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-dense-vector.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-dense-vector.html new file mode 100644 index 00000000..6779fa7a --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-dense-vector.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Vector-GraphBLAS-sharp

Vector

Namespace

GraphBLAS.FSharp.Backend.Vector.Dense

Functions and values

Function or valueSignatureDescription
#assignByMask(...)maskOp:Expr<('a option -> 'b option -> 'a -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a option> -> ClArray<'b option> -> ClCell<'a> -> ClArray<'a option>
#assignByMaskInPlace(...)maskOp:Expr<('a option -> 'b option -> 'a -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a option> -> ClArray<'b option> -> ClCell<'a> -> ClArray<'a option> -> unit
#map2 opAdd clContext workGroupSizeopAdd:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a option> -> ClArray<'b option> -> ClArray<'c option>
#map2AtLeastOne(...)op:Expr<(AtLeastOne<'d,'e> -> 'f option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'d option> -> ClArray<'e option> -> ClArray<'f option>
#map2InPlace(...)opAdd:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a option> -> ClArray<'b option> -> ClArray<'c option> -> unit
#reduce opAdd clContext workGroupSizeopAdd:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClArray<'a option> -> ClCell<'a>
#toSparse clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClArray<'a option> -> Sparse<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-map-withvalueoption.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-map-withvalueoption.html new file mode 100644 index 00000000..f8c4c29c --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-map-withvalueoption.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / WithValueOption-GraphBLAS-sharp

WithValueOption

Namespace

GraphBLAS.FSharp.Backend.Vector.Sparse
Parent Module
Map

Functions and values

Function or valueSignatureDescription
#preparePositions(...)opAdd:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClCell<'a option> -> Sparse<'b> -> ClArray<int> * ClArray<'c> * ClArray<int>
#run clContext workGroupSize opclContext:ClContext -> workGroupSize:int -> op:Expr<('a option -> 'b option -> 'c option)> -> MailboxProcessor<Msg> -> AllocationFlag -> 'a option -> int -> Sparse<'b> option -> Sparse<'c> option
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-map.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-map.html new file mode 100644 index 00000000..f607dba8 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-map.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Map-GraphBLAS-sharp

Map

Namespace

GraphBLAS.FSharp.Backend.Vector.Sparse

Nested types and modules

ModuleDescription
#WithValueOption
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-vector.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-vector.html new file mode 100644 index 00000000..e51109b8 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-sparse-vector.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Vector-GraphBLAS-sharp

Vector

Namespace

GraphBLAS.FSharp.Backend.Vector.Sparse

Functions and values

Function or valueSignatureDescription
#assignByMaskExpr<('c option -> 'd option -> 'c -> 'c option)> -> ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> Sparse<'c> -> Sparse<'d> -> ClCell<'c> -> Sparse<'c>
#copy clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> Sparse<'a> -> Sparse<'a>
#map2Expr<('d option -> 'e option -> 'f option)> -> ClContext -> int -> MailboxProcessor<Msg> -> AllocationFlag -> Sparse<'d> -> Sparse<'e> -> Sparse<'f>
#map2AtLeastOne(...)opAdd:Expr<(AtLeastOne<'d,'e> -> 'f option)> -> clContext:ClContext -> workGroupSize:int -> allocationMode:MailboxProcessor<Msg> -> AllocationFlag -> Sparse<'d> -> Sparse<'e> -> Sparse<'f>
#mapWithValueClContext -> int -> Expr<('?23261 option -> '?23262 option -> '?23264 option)> -> MailboxProcessor<Msg> -> AllocationFlag -> '?23261 option -> int -> Sparse<'?23262> option -> Sparse<'?23264> option
#reduce opAdd clContext workGroupSizeopAdd:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> Sparse<'a> -> ClCell<'a>
#toDense clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> Sparse<'a> -> ClArray<'a option>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-spmv.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-spmv.html new file mode 100644 index 00000000..9e25ea52 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-spmv.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / SpMV-GraphBLAS-sharp

SpMV

Namespace

GraphBLAS.FSharp.Backend.Vector

Functions and values

Function or valueSignatureDescription
#run add mul clContext workGroupSizeadd:Expr<('c option -> 'c option -> 'c option)> -> mul:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> CSR<'a> -> ClArray<'b option> -> ClArray<'c option>
#runTo add mul clContext workGroupSizeadd:Expr<('c option -> 'c option -> 'c option)> -> mul:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> CSR<'a> -> ClArray<'b option> -> ClArray<'c option> -> unit
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-vector.html b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-vector.html new file mode 100644 index 00000000..24c14a42 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp.Backend/graphblas-fsharp-backend-vector-vector.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Vector-GraphBLAS-sharp

Vector

Namespace

GraphBLAS.FSharp.Backend.Vector

Functions and values

Function or valueSignatureDescription
#assignByMask op clContext workGroupSizeop:Expr<('a option -> 'a option -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'b> -> ClCell<'a> -> ClVector<'a>
#assignByMaskComplemented(...)op:Expr<('a option -> 'a option -> 'a option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'b> -> ClCell<'a> -> ClVector<'a>
#copy clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>
#map2 opAdd clContext workGroupSizeopAdd:Expr<('a option -> 'b option -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'b> -> ClVector<'c>
#map2AtLeastOne(...)opAdd:Expr<(AtLeastOne<'a,'b> -> 'c option)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'b> -> ClVector<'c>
#ofList clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> VectorFormat -> int -> (int * 'a) list -> ClVector<'a>
#reduce opAdd clContext workGroupSizeopAdd:Expr<('a -> 'a -> 'a)> -> clContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> ClVector<'a> -> ClCell<'a>
#toDense clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>
#toSparse clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>
#zeroCreate clContext workGroupSizeclContext:ClContext -> workGroupSize:int -> MailboxProcessor<Msg> -> AllocationFlag -> int -> VectorFormat -> ClVector<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/GraphBLAS-sharp.html b/docs/Api_Reference/GraphBLAS-sharp/GraphBLAS-sharp.html new file mode 100644 index 00000000..660b3da5 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/GraphBLAS-sharp.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / GraphBLAS-sharp.html-GraphBLAS-sharp \ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-dimensionalmismatchexception.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-dimensionalmismatchexception.html new file mode 100644 index 00000000..1302e57d --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-dimensionalmismatchexception.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / DimensionalMismatchException-GraphBLAS-sharp

DimensionalMismatchException

Namespace

GraphBLAS.FSharp

Record Fields

Record FieldSignatureDescription
#Data0string
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxfield.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxfield.html new file mode 100644 index 00000000..001849bd --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxfield.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MtxField-GraphBLAS-sharp

MtxField

Namespace

GraphBLAS.FSharp.IO

Union Cases

Union CaseSignatureDescription
#Complex
#Double
#Integer
#Pattern
#Real

Static members

Static memberSignatureDescription
#MtxField.FromString(str)str:string -> MtxField
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxformat.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxformat.html new file mode 100644 index 00000000..72ba759e --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxformat.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MtxFormat-GraphBLAS-sharp

MtxFormat

Namespace

GraphBLAS.FSharp.IO

Union Cases

Union CaseSignatureDescription
#Array
#Coordinate

Static members

Static memberSignatureDescription
#MtxFormat.FromString(str)str:string -> MtxFormat
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxobject.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxobject.html new file mode 100644 index 00000000..b1f7a79f --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxobject.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MtxObject-GraphBLAS-sharp

MtxObject

Namespace

GraphBLAS.FSharp.IO

Union Cases

Union CaseSignatureDescription
#MtxMatrix
#MtxVector

Static members

Static memberSignatureDescription
#MtxObject.FromString(str)str:string -> MtxObject
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxreader.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxreader.html new file mode 100644 index 00000000..79584917 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxreader.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MtxReader-GraphBLAS-sharp

MtxReader

Namespace

GraphBLAS.FSharp.IO

Contructors

ConstructorSignatureDescription
#new(pathToFile)pathToFile:string -> MtxReader

CompiledName:.ctor

Instance members

Instance memberSignatureDescription
#x.FieldMtxField

CompiledName:get_Field

#x.FormatMtxFormat

CompiledName:get_Format

#x.ObjectMtxObject

CompiledName:get_Object

#x.ReadMatrix(converter)(converter:(string -> 'a)) -> COO<'a>
#x.ReadMatrixShape()unit -> (type)
#x.SymmetryMtxSymmetry

CompiledName:get_Symmetry

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxsymmetry.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxsymmetry.html new file mode 100644 index 00000000..e7588de4 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-io-mtxsymmetry.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MtxSymmetry-GraphBLAS-sharp

MtxSymmetry

Namespace

GraphBLAS.FSharp.IO

Union Cases

Union CaseSignatureDescription
#General
#Hermitian
#SkewSymmetric
#Symmetric

Static members

Static memberSignatureDescription
#MtxSymmetry.FromString(str)str:string -> MtxSymmetry
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-arrayscalar-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-arrayscalar-1.html new file mode 100644 index 00000000..fc57f268 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-arrayscalar-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ArrayScalar<'a>-GraphBLAS-sharp

ArrayScalar<'a>

Namespace

GraphBLAS.FSharp.Objects

Record Fields

Record FieldSignatureDescription
#Value'a []

Static members

Static memberSignatureDescription
#ArrayScalar.FromArray(array)(array:'a []) -> ArrayScalar<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-clvectorextensions.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-clvectorextensions.html new file mode 100644 index 00000000..e99bef80 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-clvectorextensions.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / ClVectorExtensions-GraphBLAS-sharp

ClVectorExtensions

Namespace

GraphBLAS.FSharp.Objects

Type extensions

Type extensionSignatureDescription
#x.ToHost(q)q:MailboxProcessor<Msg> -> Sparse<'a>

CompiledName:Sparse`1.ToHost

#x.ToHost(q)q:MailboxProcessor<Msg> -> Vector<'a>

CompiledName:ClVector`1.ToHost

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-1.html new file mode 100644 index 00000000..05b75502 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Matrix<'a>-GraphBLAS-sharp

Matrix<'a>

Namespace

GraphBLAS.FSharp.Objects
Attributes:
[<RequireQualifiedAccess>]

Union Cases

Union CaseSignatureDescription
#COO(COO<'a>)COO<'a>
#CSC(CSC<'a>)CSC<'a>
#CSR(CSR<'a>)CSR<'a>
#LIL(LIL<'a>)LIL<'a>

Instance members

Instance memberSignatureDescription
#x.ColumnCountint

CompiledName:get_ColumnCount

#x.NNZint

CompiledName:get_NNZ

#x.RowCountint

CompiledName:get_RowCount

#x.ToDevice(context)context:ClContext -> ClMatrix<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-coo-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-coo-1.html new file mode 100644 index 00000000..9bf02d59 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-coo-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / COO<'a>-GraphBLAS-sharp

COO<'a>

Namespace

GraphBLAS.FSharp.Objects
Parent Module: Matrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#Columnsint []
#RowCountint
#Rowsint []
#Values'a []

Instance members

Instance memberSignatureDescription
#x.NNZint

CompiledName:get_NNZ

#x.ToCSRCSR<'a>

CompiledName:get_ToCSR

#x.ToDevice(context)context:ClContext -> COO<'a>

Static members

Static memberSignatureDescription
#COO.FromArray2D(array, isZero)(array:'a [,] * isZero:('a -> bool)) -> COO<'a>
#COO.FromTuples(...)(rowCount:int * columnCount:int * rows:int [] * columns:int [] * values:'a []) -> COO<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-csc-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-csc-1.html new file mode 100644 index 00000000..6fd48350 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-csc-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / CSC<'a>-GraphBLAS-sharp

CSC<'a>

Namespace

GraphBLAS.FSharp.Objects
Parent Module: Matrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#ColumnPointersint []
#RowCountint
#RowIndicesint []
#Values'a []

Instance members

Instance memberSignatureDescription
#x.NNZint

CompiledName:get_NNZ

#x.ToDevice(context)context:ClContext -> CSC<'a>

Static members

Static memberSignatureDescription
#CSC.FromArray2D(array, isZero)(array:'a [,] * isZero:('a -> bool)) -> CSC<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-csr-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-csr-1.html new file mode 100644 index 00000000..57d496a2 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-csr-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / CSR<'a>-GraphBLAS-sharp

CSR<'a>

Namespace

GraphBLAS.FSharp.Objects
Parent Module: Matrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#ColumnIndicesint []
#RowCountint
#RowPointersint []
#Values'a []

Instance members

Instance memberSignatureDescription
#x.NNZint

CompiledName:get_NNZ

#x.ToDevice(context)context:ClContext -> CSR<'a>

Static members

Static memberSignatureDescription
#CSR.FromArray2D(array, isZero)(array:'a [,] * isZero:('a -> bool)) -> CSR<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-lil-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-lil-1.html new file mode 100644 index 00000000..dd092086 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-lil-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / LIL<'a>-GraphBLAS-sharp

LIL<'a>

Namespace

GraphBLAS.FSharp.Objects
Parent Module: Matrix

Record Fields

Record FieldSignatureDescription
#ColumnCountint
#NNZint
#RowCountint
#RowsSparse<'a> option list

Instance members

Instance memberSignatureDescription
#x.ToDevice(context)context:ClContext -> LIL<'a>

Static members

Static memberSignatureDescription
#LIL.FromArray2D(array, isZero)(array:'a [,] * isZero:('a -> bool)) -> LIL<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-tuples-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-tuples-1.html new file mode 100644 index 00000000..ebed1ca3 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix-tuples-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Tuples<'a>-GraphBLAS-sharp

Tuples<'a>

Namespace

GraphBLAS.FSharp.Objects
Parent Module: Matrix

Record Fields

Record FieldSignatureDescription
#ColumnIndicesint []
#RowIndicesint []
#Values'a []
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix.html new file mode 100644 index 00000000..d8c52430 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrix.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Matrix-GraphBLAS-sharp

Matrix

Namespace

GraphBLAS.FSharp.Objects

Nested types and modules

TypeDescription
#COO<'a>
#CSC<'a>
#CSR<'a>
#LIL<'a>
#Tuples<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrixextensions.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrixextensions.html new file mode 100644 index 00000000..21150be6 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-matrixextensions.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / MatrixExtensions-GraphBLAS-sharp

MatrixExtensions

Namespace

GraphBLAS.FSharp.Objects

Type extensions

Type extensionSignatureDescription
#x.Free(q)q:MailboxProcessor<Msg> -> unit

CompiledName:COO`1.Free

#x.Free(q)q:MailboxProcessor<Msg> -> unit

CompiledName:CSR`1.Free

#x.Free(q)q:MailboxProcessor<Msg> -> unit

CompiledName:CSC`1.Free

#x.Free(q)q:MailboxProcessor<Msg> -> unit

CompiledName:LIL`1.Free

#x.Free(q)q:MailboxProcessor<Msg> -> unit

CompiledName:ClMatrix`1.Free

#x.FreeAndWait(processor)processor:MailboxProcessor<Msg> -> unit

CompiledName:ClMatrix`1.FreeAndWait

#x.ToHost(q)q:MailboxProcessor<Msg> -> COO<'elem>

CompiledName:COO`1.ToHost

#x.ToHost(q)q:MailboxProcessor<Msg> -> CSR<'elem>

CompiledName:CSR`1.ToHost

#x.ToHost(q)q:MailboxProcessor<Msg> -> CSC<'elem>

CompiledName:CSC`1.ToHost

#x.ToHost(q)q:MailboxProcessor<Msg> -> LIL<'elem>

CompiledName:LIL`1.ToHost

#x.ToHost(q)q:MailboxProcessor<Msg> -> Matrix<'a>

CompiledName:ClMatrix`1.ToHost

#x.ToHostAndFree(q)q:MailboxProcessor<Msg> -> COO<'elem>

CompiledName:COO`1.ToHostAndFree

#x.ToHostAndFree(q)q:MailboxProcessor<Msg> -> CSR<'elem>

CompiledName:CSR`1.ToHostAndFree

#x.ToHostAndFree(q)q:MailboxProcessor<Msg> -> CSC<'elem>

CompiledName:CSC`1.ToHostAndFree

#x.ToHostAndFree(q)q:MailboxProcessor<Msg> -> LIL<'elem>

CompiledName:LIL`1.ToHostAndFree

#x.ToHostAndFree(processor)processor:MailboxProcessor<Msg> -> Matrix<'a>

CompiledName:ClMatrix`1.ToHostAndFree

\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-scalar-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-scalar-1.html new file mode 100644 index 00000000..88ef9380 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-scalar-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Scalar<'a>-GraphBLAS-sharp

Scalar<'a>

Namespace

GraphBLAS.FSharp.Objects

Union Cases

Union CaseSignatureDescription
#ScalarWrapped(ArrayScalar<'a>)ArrayScalar<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector-1.html new file mode 100644 index 00000000..1a92aece --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Vector<'a>-GraphBLAS-sharp

Vector<'a>

Namespace

GraphBLAS.FSharp.Objects
Attributes:
[<RequireQualifiedAccess>]

Union Cases

Union CaseSignatureDescription
#Dense('a option [])'a option []
#Sparse(Sparse<'a>)Sparse<'a>

Instance members

Instance memberSignatureDescription
#x.NNZint

CompiledName:get_NNZ

#x.Sizeint

CompiledName:get_Size

#x.ToDevice(context)context:ClContext -> ClVector<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector-sparse-1.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector-sparse-1.html new file mode 100644 index 00000000..622f0318 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector-sparse-1.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Sparse<'a>-GraphBLAS-sharp

Sparse<'a>

Namespace

GraphBLAS.FSharp.Objects
Parent Module: Vector

Record Fields

Record FieldSignatureDescription
#Indicesint []
#Sizeint
#Values'a []

Instance members

Instance memberSignatureDescription
#x.NNZint

CompiledName:get_NNZ

#x.ToDevice(context)context:ClContext -> Sparse<'a>

Static members

Static memberSignatureDescription
#Sparse.FromArray(array, isZero)(array:'a [] * isZero:('a -> bool)) -> Sparse<'a>
#Sparse.FromTuples(indices, values, size)(indices:int [] * values:'a [] * size:int) -> Sparse<'a>
\ No newline at end of file diff --git a/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector.html b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector.html new file mode 100644 index 00000000..6042fbb5 --- /dev/null +++ b/docs/Api_Reference/GraphBLAS-sharp/graphblas-fsharp-objects-vector.html @@ -0,0 +1,2 @@ + +GraphBLAS-sharp docs / Vector-GraphBLAS-sharp

Vector

Namespace

GraphBLAS.FSharp.Objects

Nested types and modules

TypeDescription
#Sparse<'a>
\ No newline at end of file diff --git a/docs/Explanations/Background.html b/docs/Explanations/Background.html index 899b5661..d8e26dbc 100644 --- a/docs/Explanations/Background.html +++ b/docs/Explanations/Background.html @@ -1,4 +1,4 @@ -GraphBLAS-sharp docs / Background.html-GraphBLAS-sharp

Background

+GraphBLAS-sharp docs / Background.html-GraphBLAS-sharp

Background

Here's a core concept and reasons why this exists at a deeper level.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/How_Tos/Doing_A_Thing.html b/docs/How_Tos/Doing_A_Thing.html index 64993faa..2164d25c 100644 --- a/docs/How_Tos/Doing_A_Thing.html +++ b/docs/How_Tos/Doing_A_Thing.html @@ -1,3 +1,3 @@ -GraphBLAS-sharp docs / Doing_A_Thing.html-GraphBLAS-sharp
\ No newline at end of file +GraphBLAS-sharp docs / Doing_A_Thing.html-GraphBLAS-sharp
\ No newline at end of file diff --git a/docs/How_Tos/Doing_Another_Thing.html b/docs/How_Tos/Doing_Another_Thing.html index 18351deb..c4f9d65c 100644 --- a/docs/How_Tos/Doing_Another_Thing.html +++ b/docs/How_Tos/Doing_Another_Thing.html @@ -1,3 +1,3 @@ -GraphBLAS-sharp docs / Doing_Another_Thing.html-GraphBLAS-sharp
\ No newline at end of file +GraphBLAS-sharp docs / Doing_Another_Thing.html-GraphBLAS-sharp
\ No newline at end of file diff --git a/docs/Tutorials/Getting_Started.html b/docs/Tutorials/Getting_Started.html index 87e60caa..cf981958 100644 --- a/docs/Tutorials/Getting_Started.html +++ b/docs/Tutorials/Getting_Started.html @@ -1,5 +1,5 @@ -GraphBLAS-sharp docs / Getting_Started.html-GraphBLAS-sharp

Getting Started

+GraphBLAS-sharp docs / Getting_Started.html-GraphBLAS-sharp

Getting Started

@@ -15,4 +15,4 @@

val foo : unit
val myAge : int
-
\ No newline at end of file + \ No newline at end of file diff --git a/docs/benchmarks/data.js b/docs/benchmarks/data.js index 2e1a222d..ad0e8d61 100644 --- a/docs/benchmarks/data.js +++ b/docs/benchmarks/data.js @@ -1,5 +1,5 @@ window.BENCHMARK_DATA = { - "lastUpdate": 1678171382517, + "lastUpdate": 1682712381921, "repoUrl": "https://github.com/YaccConstructor/GraphBLAS-sharp", "entries": { "BFS": [ @@ -98,6 +98,390 @@ window.BENCHMARK_DATA = { "range": "± 6156789.947659613" } ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "gsv", + "username": "gsvgit" + }, + "committer": { + "email": "rsdpisuy@gmail.com", + "name": "gsv", + "username": "gsvgit" + }, + "distinct": true, + "id": "b9ef28731a1f9a4549e7b88d1b88437de2db1a21", + "message": "commit benchmark results to master branch", + "timestamp": "2023-03-07T10:56:49+03:00", + "tree_id": "f9b95290be45e2fce0fce054dc8a739f8a22b532", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/b9ef28731a1f9a4549e7b88d1b88437de2db1a21" + }, + "date": 1678177704142, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 26678315.555555556, + "unit": "ns", + "range": "± 785372.6072255626" + }, + { + "name": "hollywood-2009.mtx", + "value": 244261708.8, + "unit": "ns", + "range": "± 584185.6477264455" + }, + { + "name": "roadNet-CA.mtx", + "value": 420174955, + "unit": "ns", + "range": "± 1677026.0595830712" + }, + { + "name": "wing.mtx", + "value": 65677016.5, + "unit": "ns", + "range": "± 3553506.7302814256" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "gsv", + "username": "gsvgit" + }, + "committer": { + "email": "rsdpisuy@gmail.com", + "name": "gsv", + "username": "gsvgit" + }, + "distinct": false, + "id": "b9ef28731a1f9a4549e7b88d1b88437de2db1a21", + "message": "commit benchmark results to master branch", + "timestamp": "2023-03-07T10:56:49+03:00", + "tree_id": "f9b95290be45e2fce0fce054dc8a739f8a22b532", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/b9ef28731a1f9a4549e7b88d1b88437de2db1a21" + }, + "date": 1678181173045, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 25963451.625, + "unit": "ns", + "range": "± 954755.2351388942" + }, + { + "name": "hollywood-2009.mtx", + "value": 243817018.75, + "unit": "ns", + "range": "± 167646.1163546168" + }, + { + "name": "roadNet-CA.mtx", + "value": 430461088.7222222, + "unit": "ns", + "range": "± 2032426.0915579917" + }, + { + "name": "wing.mtx", + "value": 75843803.3, + "unit": "ns", + "range": "± 6438556.882774501" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "Semyon", + "username": "gsvgit" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "c7bb9b1addaf82693381e3e31f0342a9f068d9a8", + "message": "Merge pull request #69 from IgorErin/reducebykey\n\nReduce by key", + "timestamp": "2023-03-25T16:45:36+03:00", + "tree_id": "1cf782ccbaba3fc18d59dd2a2b11948c2e91d8a5", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/c7bb9b1addaf82693381e3e31f0342a9f068d9a8" + }, + "date": 1679754489415, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 27797693.555555556, + "unit": "ns", + "range": "± 1085948.3029000633" + }, + { + "name": "hollywood-2009.mtx", + "value": 245110875.3, + "unit": "ns", + "range": "± 295194.78967964713" + }, + { + "name": "roadNet-CA.mtx", + "value": 349504742.7, + "unit": "ns", + "range": "± 645222.8029713285" + }, + { + "name": "wing.mtx", + "value": 82190204.125, + "unit": "ns", + "range": "± 2212337.6729892967" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "Semyon", + "username": "gsvgit" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "abdb353aa170e7693660ff32724f42cdc22f99c2", + "message": "Merge pull request #70 from IgorErin/radix\n\nRadix", + "timestamp": "2023-03-25T16:58:31+01:00", + "tree_id": "00a70684ff709afe41374661a72b4191a9a5f673", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/abdb353aa170e7693660ff32724f42cdc22f99c2" + }, + "date": 1679763288411, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 25660785.4, + "unit": "ns", + "range": "± 1871733.485107764" + }, + { + "name": "hollywood-2009.mtx", + "value": 244159003, + "unit": "ns", + "range": "± 497260.95508495334" + }, + { + "name": "roadNet-CA.mtx", + "value": 403044089.5, + "unit": "ns", + "range": "± 1397301.7837235448" + }, + { + "name": "wing.mtx", + "value": 69485855.7, + "unit": "ns", + "range": "± 2810357.923700578" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "Semyon", + "username": "gsvgit" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "7885e8ae7c843c91d05171fda13bd0adb45e4cf8", + "message": "Merge pull request #68 from artemiipatov/map\n\nMatrix.map", + "timestamp": "2023-03-25T18:36:09+01:00", + "tree_id": "9492a851a121fe7717f5e3fa64747cf9f4dc781a", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/7885e8ae7c843c91d05171fda13bd0adb45e4cf8" + }, + "date": 1679768113184, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 26909964.2, + "unit": "ns", + "range": "± 1049217.1722355725" + }, + { + "name": "hollywood-2009.mtx", + "value": 244774463.44444445, + "unit": "ns", + "range": "± 527799.2603715714" + }, + { + "name": "roadNet-CA.mtx", + "value": 322244127.6666667, + "unit": "ns", + "range": "± 1013922.0193185471" + }, + { + "name": "wing.mtx", + "value": 74442988.4, + "unit": "ns", + "range": "± 6109231.5676889345" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "Semyon", + "username": "gsvgit" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "e850a49b54523883645408e6fdc3cb2b6961f60c", + "message": "Merge pull request #71 from IgorErin/scan\n\nScan by key", + "timestamp": "2023-04-07T19:46:36+03:00", + "tree_id": "0b6b72bdc7bd10597aa014096ecb8dfb0c5375e5", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/e850a49b54523883645408e6fdc3cb2b6961f60c" + }, + "date": 1680888083667, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 27406386.9, + "unit": "ns", + "range": "± 2394676.240738445" + }, + { + "name": "hollywood-2009.mtx", + "value": 244177306.05555555, + "unit": "ns", + "range": "± 316373.5189503505" + }, + { + "name": "roadNet-CA.mtx", + "value": 350847521.5, + "unit": "ns", + "range": "± 879532.5109861236" + }, + { + "name": "wing.mtx", + "value": 67526154.6, + "unit": "ns", + "range": "± 4966069.505099905" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "Semyon", + "username": "gsvgit" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "e0485c52128b16b0ba4668655b1c9dfc1b033a05", + "message": "Merge pull request #72 from IgorErin/spgemm\n\nSpgemm", + "timestamp": "2023-04-10T12:25:44+03:00", + "tree_id": "f2669a8402e5927885feb19a3be9dfb7d979d42a", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/e0485c52128b16b0ba4668655b1c9dfc1b033a05" + }, + "date": 1681118956665, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 26644906.7, + "unit": "ns", + "range": "± 2654985.2244110326" + }, + { + "name": "hollywood-2009.mtx", + "value": 244271725.33333334, + "unit": "ns", + "range": "± 405898.50895266916" + }, + { + "name": "roadNet-CA.mtx", + "value": 341630405, + "unit": "ns", + "range": "± 1489655.627393198" + }, + { + "name": "wing.mtx", + "value": 78603232.3, + "unit": "ns", + "range": "± 3960711.5389918624" + } + ] + }, + { + "commit": { + "author": { + "email": "rsdpisuy@gmail.com", + "name": "Semyon", + "username": "gsvgit" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "cb8a79181709f3d138b0777959177ecfdb2cddff", + "message": "Merge pull request #76 from IgorErin/merge\n\nMerge", + "timestamp": "2023-04-28T21:30:04+03:00", + "tree_id": "948b018e76afe327b0749b08bfc12735516ea17b", + "url": "https://github.com/YaccConstructor/GraphBLAS-sharp/commit/cb8a79181709f3d138b0777959177ecfdb2cddff" + }, + "date": 1682712380356, + "tool": "benchmarkdotnet", + "benches": [ + { + "name": "coAuthorsCiteseer.mtx", + "value": 27163855.6, + "unit": "ns", + "range": "± 2068239.192699336" + }, + { + "name": "hollywood-2009.mtx", + "value": 253817078.5, + "unit": "ns", + "range": "± 2019475.7332461313" + }, + { + "name": "roadNet-CA.mtx", + "value": 425694647.9, + "unit": "ns", + "range": "± 2577824.803342688" + }, + { + "name": "wing.mtx", + "value": 78471745.1, + "unit": "ns", + "range": "± 5467576.903812357" + } + ] } ] } diff --git a/docs/files/placeholder.html b/docs/files/placeholder.html index 8a370b05..ad369fb0 100644 --- a/docs/files/placeholder.html +++ b/docs/files/placeholder.html @@ -1,3 +1,3 @@ -GraphBLAS-sharp docs / placeholder.html-GraphBLAS-sharp

place images or other files here

-
\ No newline at end of file +GraphBLAS-sharp docs / placeholder.html-GraphBLAS-sharp

place images or other files here

+
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 0feff9f0..5c192afa 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ -GraphBLAS-sharp docs / index.html-GraphBLAS-sharp

GraphBLAS-sharp

+GraphBLAS-sharp docs / index.html-GraphBLAS-sharp

GraphBLAS-sharp


What is GraphBLAS-sharp?

GraphBLAS-sharp is a library that does this specific thing.

@@ -54,4 +54,4 @@
Api Reference
-
\ No newline at end of file + \ No newline at end of file diff --git a/docsTool/Program.fs b/docsTool/Program.fs index 46f1ea33..3d63cad9 100644 --- a/docsTool/Program.fs +++ b/docsTool/Program.fs @@ -282,7 +282,7 @@ module GenerateDocs = } dotnetPublish cfg - Async.Parallel [generateDocs(*; generateAPI*)] + Async.Parallel [generateDocs; generateAPI] |> Async.RunSynchronously |> Array.toList |> List.collect id diff --git a/paket.lock b/paket.lock index dadffb7c..7cae92f5 100644 --- a/paket.lock +++ b/paket.lock @@ -2,23 +2,23 @@ STORAGE: NONE NUGET remote: https://www.nuget.org/api/v2 altcover (7.6.812) - BenchmarkDotNet (0.13.5) - BenchmarkDotNet.Annotations (>= 0.13.5) - restriction: >= netstandard2.0 - CommandLineParser (>= 2.4.3) - restriction: >= netstandard2.0 + BenchmarkDotNet (0.13.9) + BenchmarkDotNet.Annotations (>= 0.13.9) - restriction: >= netstandard2.0 + CommandLineParser (>= 2.9.1) - restriction: >= netstandard2.0 Gee.External.Capstone (>= 2.3) - restriction: >= netstandard2.0 Iced (>= 1.17) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.CSharp (>= 3.0) - restriction: >= netstandard2.0 + Microsoft.CodeAnalysis.CSharp (>= 4.1) - restriction: >= netstandard2.0 Microsoft.Diagnostics.Runtime (>= 2.2.332302) - restriction: >= netstandard2.0 Microsoft.Diagnostics.Tracing.TraceEvent (>= 3.0.2) - restriction: >= netstandard2.0 Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: >= netstandard2.0 Microsoft.Win32.Registry (>= 5.0) - restriction: && (< net6.0) (>= netstandard2.0) - Perfolizer (>= 0.2.1) - restriction: >= netstandard2.0 - System.Management (>= 6.0) - restriction: >= netstandard2.0 + Perfolizer (0.2.1) - restriction: >= netstandard2.0 + System.Management (>= 5.0) - restriction: >= netstandard2.0 System.Numerics.Vectors (>= 4.5) - restriction: && (< net6.0) (>= netstandard2.0) System.Reflection.Emit (>= 4.7) - restriction: && (< net6.0) (>= netstandard2.0) System.Reflection.Emit.Lightweight (>= 4.7) - restriction: && (< net6.0) (>= netstandard2.0) System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: && (< net6.0) (>= netstandard2.0) - BenchmarkDotNet.Annotations (0.13.5) - restriction: >= netstandard2.0 + BenchmarkDotNet.Annotations (0.13.9) - restriction: >= netstandard2.0 Brahma.FSharp (2.0.5) Brahma.FSharp.OpenCL.Printer (>= 2.0.5) - restriction: >= net7.0 Brahma.FSharp.OpenCL.Shared (>= 2.0.5) - restriction: >= net7.0 @@ -52,8 +52,8 @@ NUGET ExtraConstraints.Fody (1.14) Fody (>= 6.0) - restriction: || (>= net452) (>= netstandard1.4) NETStandard.Library (>= 1.6.1) - restriction: && (< net452) (>= netstandard1.4) - Fody (6.7) - restriction: || (>= net452) (>= netstandard1.4) - FsCheck (2.16.5) - restriction: || (>= net461) (>= netstandard2.0) + Fody (6.8) - restriction: || (>= net452) (>= netstandard1.4) + FsCheck (2.16.6) - restriction: || (>= net461) (>= netstandard2.0) FSharp.Core (>= 4.2.3) - restriction: || (>= net452) (>= netstandard1.6) FSharp.Core (7.0) FSharp.Quotations.Evaluator (2.1) @@ -63,7 +63,7 @@ NUGET FSharpx.Text.StructuredFormat (3.1) FSharp.Core (>= 4.6.2) - restriction: || (>= net452) (>= netstandard2.0) Gee.External.Capstone (2.3) - restriction: >= netstandard2.0 - Iced (1.18) - restriction: >= netstandard2.0 + Iced (1.20) - restriction: >= netstandard2.0 MathNet.Numerics (5.0) - restriction: || (>= net45) (>= netstandard1.6) System.ValueTuple (>= 4.4) - restriction: && (>= net461) (< net48) MathNet.Numerics.FSharp (4.0) @@ -83,26 +83,27 @@ NUGET System.Security.Permissions (>= 4.7) - restriction: && (< net472) (>= netstandard2.0) Microsoft.Build.Tasks.Git (1.1.1) - copy_local: true Microsoft.CodeAnalysis.Analyzers (3.3.4) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.Common (4.6) - restriction: >= netstandard2.0 + Microsoft.CodeAnalysis.Common (4.7) - restriction: >= netstandard2.0 Microsoft.CodeAnalysis.Analyzers (>= 3.3.4) - restriction: >= netstandard2.0 System.Collections.Immutable (>= 7.0) - restriction: >= netstandard2.0 System.Memory (>= 4.5.5) - restriction: && (< net6.0) (>= netstandard2.0) System.Reflection.Metadata (>= 7.0) - restriction: >= netstandard2.0 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= netstandard2.0 - System.Text.Encoding.CodePages (>= 7.0) - restriction: >= netstandard2.0 + System.Text.Encoding.CodePages (>= 7.0) - restriction: && (< net6.0) (>= netstandard2.0) System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: && (< net6.0) (>= netstandard2.0) - Microsoft.CodeAnalysis.CSharp (4.6) - restriction: >= netstandard2.0 - Microsoft.CodeAnalysis.Common (4.6) - restriction: >= netstandard2.0 - Microsoft.CodeCoverage (17.6) - restriction: || (>= net45) (>= netcoreapp2.1) + Microsoft.CodeAnalysis.CSharp (4.7) - restriction: >= netstandard2.0 + Microsoft.CodeAnalysis.Common (4.7) - restriction: >= netstandard2.0 + Microsoft.CodeCoverage (17.7.2) - restriction: || (>= net45) (>= netcoreapp2.1) Microsoft.CSharp (4.7) - restriction: || (&& (< netstandard1.3) (>= uap10.0)) (&& (< netstandard2.0) (>= uap10.0)) - Microsoft.Diagnostics.NETCore.Client (0.2.421201) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (>= 1.1) - restriction: && (< net6.0) (>= netstandard2.0) - Microsoft.Extensions.Logging (>= 2.1.1) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.Runtime (2.4.416101) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.NETCore.Client (>= 0.2.251802) - restriction: >= netstandard2.0 - System.Collections.Immutable (>= 5.0) - restriction: >= netstandard2.0 - System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: >= netstandard2.0 - Microsoft.Diagnostics.Tracing.TraceEvent (3.1.3) - restriction: >= netstandard2.0 + Microsoft.Diagnostics.NETCore.Client (0.2.447801) - restriction: >= netstandard2.0 + Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: && (< net6.0) (>= netstandard2.0) + Microsoft.Extensions.Logging (>= 6.0) - restriction: >= netstandard2.0 + System.Buffers (>= 4.5.1) - restriction: && (< net6.0) (>= netstandard2.0) + Microsoft.Diagnostics.Runtime (3.0.442202) - restriction: >= netstandard2.0 + Microsoft.Diagnostics.NETCore.Client (>= 0.2.410101) - restriction: >= netstandard2.0 + System.Collections.Immutable (>= 6.0) - restriction: >= netstandard2.0 + System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= netstandard2.0 + Microsoft.Diagnostics.Tracing.TraceEvent (3.1.5) - restriction: >= netstandard2.0 System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: >= netstandard2.0 Microsoft.DotNet.PlatformAbstractions (3.1.6) - restriction: >= netstandard2.0 System.Runtime.InteropServices.RuntimeInformation (>= 4.0) - restriction: || (>= net45) (&& (>= netstandard1.3) (< netstandard2.0)) @@ -121,7 +122,7 @@ NUGET Microsoft.Extensions.Options (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) System.Diagnostics.DiagnosticSource (>= 7.0) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.1)) (&& (>= netstandard2.0) (< netstandard2.1)) System.ValueTuple (>= 4.5) - restriction: >= net462 - Microsoft.Extensions.Logging.Abstractions (7.0) - restriction: >= netstandard2.0 + Microsoft.Extensions.Logging.Abstractions (7.0.1) - restriction: >= netstandard2.0 System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) Microsoft.Extensions.Options (7.0.1) - restriction: >= netstandard2.0 @@ -138,17 +139,17 @@ NUGET System.ComponentModel.Primitives (>= 4.1) - restriction: >= uap10.0 System.ComponentModel.TypeConverter (>= 4.1) - restriction: >= uap10.0 System.Runtime.InteropServices.RuntimeInformation (>= 4.0) - restriction: >= uap10.0 - Microsoft.NETCore.Platforms (7.0.2) - restriction: || (&& (>= monoandroid) (>= netcoreapp2.0) (< netstandard1.3)) (&& (>= monoandroid) (>= netcoreapp2.1) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard1.6) (< win8)) (&& (>= monotouch) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (< net45) (>= net46) (< netstandard1.4) (>= netstandard1.6)) (&& (< net45) (>= net461) (>= netstandard1.6) (< netstandard2.0)) (&& (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.4) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (>= net461) (>= netcoreapp2.0)) (&& (>= net461) (>= netcoreapp2.1)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinios)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinmac)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarintvos)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinwatchos)) (&& (>= netcoreapp2.0) (< netstandard2.0)) (&& (>= netcoreapp2.0) (>= uap10.1)) (&& (< netcoreapp2.0) (>= netcoreapp2.1)) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) (&& (>= netcoreapp2.1) (>= uap10.1)) (&& (< netstandard1.0) (>= netstandard1.6) (< portable-net45+win8)) (&& (< netstandard1.0) (>= netstandard1.6) (>= win8)) (&& (< netstandard1.0) (>= netstandard1.6) (< win8)) (&& (< netstandard1.1) (>= netstandard1.6) (>= uap10.0) (< win8)) (&& (< netstandard1.3) (>= netstandard1.6) (>= uap10.0) (< win8) (< wpa81)) (&& (< netstandard1.3) (>= netstandard1.6) (< win8) (>= wpa81)) (&& (< netstandard1.5) (>= netstandard1.6) (>= uap10.0)) (&& (>= netstandard1.6) (< portable-net45+win8+wpa81)) (&& (>= netstandard1.6) (>= uap10.1)) (&& (>= netstandard1.6) (>= wp8)) + Microsoft.NETCore.Platforms (7.0.4) - restriction: || (&& (>= monoandroid) (>= netcoreapp2.0) (< netstandard1.3)) (&& (>= monoandroid) (>= netcoreapp2.1) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard1.6) (< win8)) (&& (>= monotouch) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (< net45) (>= net46) (< netstandard1.4) (>= netstandard1.6)) (&& (< net45) (>= net461) (>= netstandard1.6) (< netstandard2.0)) (&& (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.4) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (>= net461) (>= netcoreapp2.0)) (&& (>= net461) (>= netcoreapp2.1)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinios)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinmac)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarintvos)) (&& (>= netcoreapp2.0) (< netcoreapp2.1) (>= xamarinwatchos)) (&& (>= netcoreapp2.0) (< netstandard2.0)) (&& (>= netcoreapp2.0) (>= uap10.1)) (&& (< netcoreapp2.0) (>= netcoreapp2.1)) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) (&& (>= netcoreapp2.1) (>= uap10.1)) (&& (< netstandard1.0) (>= netstandard1.6) (< portable-net45+win8)) (&& (< netstandard1.0) (>= netstandard1.6) (>= win8)) (&& (< netstandard1.0) (>= netstandard1.6) (< win8)) (&& (< netstandard1.1) (>= netstandard1.6) (>= uap10.0) (< win8)) (&& (< netstandard1.3) (>= netstandard1.6) (>= uap10.0) (< win8) (< wpa81)) (&& (< netstandard1.3) (>= netstandard1.6) (< win8) (>= wpa81)) (&& (< netstandard1.5) (>= netstandard1.6) (>= uap10.0)) (&& (>= netstandard1.6) (< portable-net45+win8+wpa81)) (&& (>= netstandard1.6) (>= uap10.1)) (&& (>= netstandard1.6) (>= wp8)) Microsoft.NETCore.Targets (5.0) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.4) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard1.6) (< win8)) (&& (< monotouch) (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< netstandard1.1) (>= netstandard1.6) (>= uap10.0) (< win8)) (&& (< netstandard1.3) (>= netstandard1.6) (>= uap10.0) (< win8) (< wpa81)) (&& (< netstandard1.5) (>= netstandard1.6) (>= uap10.0) (< win8) (< wpa81)) (&& (>= netstandard1.6) (< portable-net45+win8+wpa81)) Microsoft.SourceLink.Common (1.1.1) - copy_local: true Microsoft.SourceLink.GitHub (1.0) - copy_local: true Microsoft.Build.Tasks.Git (>= 1.0) Microsoft.SourceLink.Common (>= 1.0) - Microsoft.TestPlatform.ObjectModel (17.6) - restriction: >= netcoreapp3.1 - NuGet.Frameworks (>= 5.11) - restriction: || (>= net462) (>= netstandard2.0) + Microsoft.TestPlatform.ObjectModel (17.7.2) - restriction: >= netcoreapp3.1 + NuGet.Frameworks (>= 6.5) - restriction: || (>= net462) (>= netstandard2.0) System.Reflection.Metadata (>= 1.6) - restriction: || (>= net462) (>= netstandard2.0) - Microsoft.TestPlatform.TestHost (17.6) - restriction: >= netcoreapp2.1 - Microsoft.TestPlatform.ObjectModel (>= 17.6) - restriction: >= netcoreapp3.1 + Microsoft.TestPlatform.TestHost (17.7.2) - restriction: >= netcoreapp2.1 + Microsoft.TestPlatform.ObjectModel (>= 17.7.2) - restriction: >= netcoreapp3.1 Newtonsoft.Json (>= 13.0.1) - restriction: >= netcoreapp3.1 Microsoft.Win32.Primitives (4.3) - restriction: || (&& (< net45) (>= net46) (< netstandard1.4) (>= netstandard1.6)) (&& (< net45) (< netstandard1.4) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (< netstandard1.5) (>= netstandard1.6) (>= uap10.0)) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -213,9 +214,9 @@ NUGET System.Runtime.Serialization.Formatters (>= 4.3) - restriction: && (< net20) (>= netstandard1.3) (< netstandard2.0) System.Runtime.Serialization.Primitives (>= 4.3) - restriction: || (&& (< net20) (>= netstandard1.0) (< netstandard1.3)) (&& (< net20) (>= netstandard1.3) (< netstandard2.0)) System.Xml.XmlDocument (>= 4.3) - restriction: && (< net20) (>= netstandard1.3) (< netstandard2.0) - NuGet.Frameworks (6.6) - restriction: >= netcoreapp3.1 - Perfolizer (0.3.4) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.4) - restriction: && (>= netstandard2.0) (< netstandard2.1) + NuGet.Frameworks (6.7) - restriction: >= netcoreapp3.1 + Perfolizer (0.2.1) - restriction: >= netstandard2.0 + System.Memory (>= 4.5.3) - restriction: >= netstandard2.0 QuikGraph (2.5) NETStandard.Library (>= 1.6.1) - restriction: && (< net35) (>= netstandard1.3) (< netstandard2.0) runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monotouch) (< net45) (>= netstandard1.6) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos) @@ -391,9 +392,9 @@ NUGET System.Runtime (>= 4.3) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.3) (< win8) (< wp8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard1.3) (< netstandard1.6) (< win8) (< wpa81)) (&& (< monotouch) (< net45) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) System.Runtime.Extensions (>= 4.3) - restriction: && (< monotouch) (< net45) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Threading (>= 4.3) - restriction: && (< monotouch) (< net45) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Management (7.0.1) - restriction: >= netstandard2.0 + System.Management (7.0.2) - restriction: >= netstandard2.0 System.CodeDom (>= 7.0) - restriction: >= netstandard2.0 - System.Memory (4.5.5) - restriction: || (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net462) (&& (< net6.0) (>= netstandard2.0)) (&& (>= netstandard2.0) (< netstandard2.1)) (&& (>= netstandard2.0) (>= uap10.1)) + System.Memory (4.5.5) - restriction: || (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net462) (>= netstandard2.0) 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) System.Numerics.Vectors (>= 4.4) - restriction: && (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Numerics.Vectors (>= 4.5) - restriction: >= net461 @@ -486,7 +487,7 @@ NUGET Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< win8) (< wp8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Reflection (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< win8) (< wp8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Runtime (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< win8) (< wp8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Reflection.Metadata (7.0.1) - restriction: >= netstandard2.0 + System.Reflection.Metadata (7.0.2) - restriction: >= netstandard2.0 System.Collections.Immutable (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Reflection.Primitives (4.3) - restriction: || (&& (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.4) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (< netstandard1.5) (>= netstandard1.6) (>= uap10.0)) (&& (>= netstandard1.6) (< portable-net45+win8+wpa81)) @@ -655,7 +656,7 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.3) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.3) (< win8) (< wp8) (< wpa81)) Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.3) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.3) (< win8) (< wp8) (< wpa81)) System.Runtime (>= 4.3) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.3) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.3) (< win8) (< wp8) (< wpa81)) - System.Text.Encoding.CodePages (7.0) - restriction: >= netstandard2.0 + System.Text.Encoding.CodePages (7.0) - restriction: && (< net6.0) (>= netstandard2.0) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) System.Text.Encoding.Extensions (4.3) - restriction: || (&& (< net45) (>= net46) (< netstandard1.4) (>= netstandard1.6)) (&& (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.4) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (< netstandard1.5) (>= netstandard1.6) (>= uap10.0)) (&& (>= netstandard1.6) (< portable-net45+win8+wpa81)) @@ -761,59 +762,44 @@ NUGET BinaryDefense.FSharp.Analyzers.Hashing (0.2.2) FSharp.Analyzers.SDK (>= 0.8) - restriction: >= net5.0 FSharp.Core (>= 5.0.1) - restriction: >= net5.0 - FSharp.Analyzers.SDK (0.11) - restriction: >= net5.0 - FSharp.Compiler.Service (>= 41.0.1) - restriction: >= net5.0 - FSharp.Core (>= 6.0.1) - restriction: >= net5.0 - McMaster.NETCore.Plugins (>= 1.4) - restriction: >= net5.0 - FSharp.Compiler.Service (43.7.300) - restriction: >= net5.0 - FSharp.Core (7.0.300) - restriction: >= netstandard2.0 + FSharp.Analyzers.SDK (0.14.1) - restriction: >= net5.0 + FSharp.Compiler.Service (>= 43.7.400) - restriction: >= net6.0 + FSharp.Core (>= 7.0.400) - restriction: >= net6.0 + McMaster.NETCore.Plugins (>= 1.4) - restriction: >= net6.0 + FSharp.Compiler.Service (43.7.400) - restriction: >= net6.0 + FSharp.Core (7.0.400) - restriction: >= netstandard2.0 System.Buffers (>= 4.5.1) - restriction: >= netstandard2.0 - System.Collections.Immutable (>= 6.0) - restriction: >= netstandard2.0 - System.Diagnostics.DiagnosticSource (>= 6.0) - restriction: >= netstandard2.0 + System.Collections.Immutable (>= 7.0) - restriction: >= netstandard2.0 + System.Diagnostics.DiagnosticSource (>= 7.0.2) - restriction: >= netstandard2.0 System.Memory (>= 4.5.5) - restriction: >= netstandard2.0 System.Reflection.Emit (>= 4.7) - restriction: >= netstandard2.0 - System.Reflection.Metadata (>= 6.0.1) - restriction: >= netstandard2.0 + System.Reflection.Metadata (>= 7.0) - restriction: >= netstandard2.0 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= netstandard2.0 - FSharp.Core (7.0.300) - restriction: >= net5.0 - McMaster.NETCore.Plugins (1.4) - restriction: >= net5.0 + FSharp.Core (7.0.400) - restriction: >= net5.0 + McMaster.NETCore.Plugins (1.4) - restriction: >= net6.0 Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: >= netcoreapp2.1 Microsoft.Extensions.DependencyModel (>= 5.0) - restriction: >= netcoreapp2.1 - Microsoft.Bcl.AsyncInterfaces (7.0) - restriction: || (&& (>= net462) (>= net5.0)) (&& (>= net5.0) (< net6.0)) - Microsoft.DotNet.PlatformAbstractions (3.1.6) - restriction: >= net5.0 - Microsoft.Extensions.DependencyModel (7.0) - restriction: >= net5.0 - System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) + Microsoft.DotNet.PlatformAbstractions (3.1.6) - restriction: >= net6.0 + Microsoft.Extensions.DependencyModel (7.0) - restriction: >= net6.0 System.Text.Encodings.Web (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) System.Text.Json (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - System.Buffers (4.5.1) - restriction: >= net5.0 - System.Collections.Immutable (7.0) - restriction: >= net5.0 - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) + System.Buffers (4.5.1) - restriction: >= net6.0 + System.Collections.Immutable (7.0) - restriction: >= net6.0 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - System.Diagnostics.DiagnosticSource (7.0.2) - restriction: >= net5.0 - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) + System.Diagnostics.DiagnosticSource (7.0.2) - restriction: >= net6.0 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (4.5.5) - restriction: >= net5.0 + System.Memory (4.5.5) - restriction: >= net6.0 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) 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) - System.Numerics.Vectors (4.5) - restriction: || (&& (>= net462) (>= net5.0)) (&& (>= net5.0) (< net6.0)) - System.Reflection.Emit (4.7) - restriction: >= net5.0 - System.Reflection.Metadata (7.0.1) - restriction: >= net5.0 + System.Reflection.Emit (4.7) - restriction: >= net6.0 + System.Reflection.Metadata (7.0.2) - restriction: >= net6.0 System.Collections.Immutable (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (>= net5.0) (&& (>= net6.0) (< net7.0)) - System.Text.Encodings.Web (7.0) - restriction: >= net5.0 - System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) + System.Runtime.CompilerServices.Unsafe (6.0) - restriction: >= net6.0 + System.Text.Encodings.Web (7.0) - restriction: >= net6.0 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) - System.Text.Json (7.0.2) - restriction: >= net5.0 - Microsoft.Bcl.AsyncInterfaces (>= 7.0) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Numerics.Vectors (>= 4.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) + System.Text.Json (7.0.3) - restriction: >= net6.0 System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net462) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) System.Text.Encodings.Web (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (>= net462) (>= net5.0)) (&& (>= net5.0) (< net6.0)) GROUP Build STORAGE: NONE @@ -946,17 +932,18 @@ NUGET FSharp.Control.Reactive (5.0.5) - restriction: >= netstandard2.0 FSharp.Core (>= 4.7.2) - restriction: >= netstandard2.0 System.Reactive (>= 5.0 < 6.0) - restriction: >= netstandard2.0 - FSharp.Core (7.0.300) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (17.6.3) - restriction: >= netstandard2.0 + FSharp.Core (7.0.400) - restriction: >= netstandard2.0 + Microsoft.Build.Framework (17.7.2) - restriction: >= netstandard2.0 Microsoft.VisualStudio.Setup.Configuration.Interop (>= 3.2.2146) - restriction: >= net472 Microsoft.Win32.Registry (>= 5.0) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= net472 + System.Memory (>= 4.5.5) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net472) (&& (< net7.0) (>= netstandard2.0)) System.Security.Permissions (>= 7.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net7.0) System.Security.Principal.Windows (>= 5.0) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) - Microsoft.Build.Utilities.Core (17.6.3) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (>= 17.6.3) - restriction: >= netstandard2.0 + Microsoft.Build.Utilities.Core (17.7.2) - restriction: >= netstandard2.0 + Microsoft.Build.Framework (>= 17.7.2) - restriction: >= netstandard2.0 Microsoft.IO.Redist (>= 6.0) - restriction: >= net472 - Microsoft.NET.StringTools (>= 17.6.3) - restriction: >= netstandard2.0 + Microsoft.NET.StringTools (>= 17.7.2) - restriction: >= netstandard2.0 Microsoft.VisualStudio.Setup.Configuration.Interop (>= 3.2.2146) - restriction: || (>= net472) (>= net7.0) Microsoft.Win32.Registry (>= 5.0) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) System.Collections.Immutable (>= 7.0) - restriction: >= netstandard2.0 @@ -969,12 +956,12 @@ NUGET Microsoft.IO.Redist (6.0) - restriction: >= net472 System.Buffers (>= 4.5.1) - restriction: >= net472 System.Memory (>= 4.5.4) - restriction: >= net472 - Microsoft.NET.StringTools (17.6.3) - restriction: >= netstandard2.0 + Microsoft.NET.StringTools (17.7.2) - restriction: >= netstandard2.0 System.Memory (>= 4.5.5) - restriction: || (>= net472) (&& (< net7.0) (>= netstandard2.0)) System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net472) (&& (< net7.0) (>= netstandard2.0)) - Microsoft.NETCore.Platforms (7.0.2) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= net5.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) + Microsoft.NETCore.Platforms (7.0.4) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= net5.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) Microsoft.NETCore.Targets (5.0) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) - Microsoft.VisualStudio.Setup.Configuration.Interop (3.6.2115) - restriction: || (>= net472) (>= net7.0) + Microsoft.VisualStudio.Setup.Configuration.Interop (3.7.2175) - restriction: || (>= net472) (>= net7.0) Microsoft.Win32.Registry (5.0) - restriction: || (&& (< net45) (>= netstandard2.0)) (&& (< net472) (< net7.0) (>= netstandard2.0)) System.Buffers (>= 4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) System.Memory (>= 4.5.4) - restriction: || (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= uap10.1) @@ -982,25 +969,24 @@ NUGET System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.1) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) Microsoft.Win32.SystemEvents (7.0) - restriction: >= net6.0 Mono.Posix.NETStandard (1.0) - restriction: >= netstandard2.0 - MSBuild.StructuredLogger (2.1.820) - restriction: >= netstandard2.0 + MSBuild.StructuredLogger (2.1.858) - restriction: >= netstandard2.0 Microsoft.Build.Framework (>= 17.5) - restriction: >= netstandard2.0 Microsoft.Build.Utilities.Core (>= 17.5) - restriction: >= netstandard2.0 Newtonsoft.Json (13.0.3) - restriction: >= netstandard2.0 - NuGet.Common (6.6) - restriction: >= netstandard2.0 - NuGet.Frameworks (>= 6.6) - restriction: >= netstandard2.0 - NuGet.Configuration (6.6) - restriction: >= netstandard2.0 - NuGet.Common (>= 6.6) - restriction: >= netstandard2.0 + NuGet.Common (6.7) - restriction: >= netstandard2.0 + NuGet.Frameworks (>= 6.7) - restriction: >= netstandard2.0 + NuGet.Configuration (6.7) - restriction: >= netstandard2.0 + NuGet.Common (>= 6.7) - restriction: >= netstandard2.0 System.Security.Cryptography.ProtectedData (>= 4.4) - restriction: && (< net472) (>= netstandard2.0) - NuGet.Frameworks (6.6) - restriction: >= netstandard2.0 - NuGet.Packaging (6.6) - restriction: >= netstandard2.0 + NuGet.Frameworks (6.7) - restriction: >= netstandard2.0 + NuGet.Packaging (6.7) - restriction: >= netstandard2.0 Newtonsoft.Json (>= 13.0.1) - restriction: >= netstandard2.0 - NuGet.Configuration (>= 6.6) - restriction: >= netstandard2.0 - NuGet.Versioning (>= 6.6) - restriction: >= netstandard2.0 - System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) - System.Security.Cryptography.Pkcs (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) - NuGet.Protocol (6.6) - restriction: >= netstandard2.0 - NuGet.Packaging (>= 6.6) - restriction: >= netstandard2.0 - NuGet.Versioning (6.6) - restriction: >= netstandard2.0 + NuGet.Configuration (>= 6.7) - restriction: >= netstandard2.0 + NuGet.Versioning (>= 6.7) - restriction: >= netstandard2.0 + System.Security.Cryptography.Pkcs (>= 6.0.4) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) + NuGet.Protocol (6.7) - restriction: >= netstandard2.0 + NuGet.Packaging (>= 6.7) - restriction: >= netstandard2.0 + NuGet.Versioning (6.7) - restriction: >= netstandard2.0 Octokit (0.48) System.Buffers (4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.1) (>= netstandard2.0)) (&& (>= monoandroid) (< netstandard1.3) (>= netstandard2.0)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard2.0) (< win8)) (&& (>= monotouch) (>= netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (&& (>= net461) (>= netstandard2.0)) (&& (>= net462) (>= netstandard2.0)) (&& (>= net462) (>= netstandard2.1)) (&& (< net462) (< net6.0) (>= netstandard2.0)) (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (>= net472) (&& (>= net5.0) (< netstandard2.1)) (&& (< net6.0) (>= netstandard2.1)) (&& (< netstandard1.1) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= xamarintvos)) (&& (>= netstandard2.0) (>= xamarinwatchos)) (>= xamarinios) (>= xamarinmac) System.Collections.Immutable (7.0) - restriction: >= netstandard2.0 @@ -1013,10 +999,9 @@ NUGET System.Diagnostics.EventLog (7.0) - restriction: >= net7.0 System.Drawing.Common (7.0) - restriction: >= net6.0 Microsoft.Win32.SystemEvents (>= 7.0) - restriction: >= net6.0 - System.Formats.Asn1 (7.0) - restriction: || (&& (< net462) (>= netstandard2.0)) (&& (>= net5.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= netstandard2.1) + System.Formats.Asn1 (7.0) - restriction: || (&& (< net462) (>= netstandard2.0)) (&& (>= net5.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp3.0) (< xamarintvos) (< xamarinwatchos)) (>= netstandard2.1) System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) - System.IO (4.3) - restriction: || (&& (< monoandroid) (< net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netstandard1.6) (>= netstandard2.0)) (&& (< monoandroid) (>= net5.0) (< netstandard1.4)) (&& (< monoandroid) (>= net5.0) (< netstandard1.6)) (&& (< monoandroid) (>= net5.0) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (>= net5.0) (< netstandard1.4)) (&& (< net46) (>= net461) (< netstandard1.4) (>= netstandard2.0)) (&& (< net46) (>= net461) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net462) (< netstandard1.4) (>= netstandard2.0)) (&& (< net46) (>= net462) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net47) (>= netstandard2.0)) (&& (>= net461) (>= net5.0) (< netstandard1.4)) (&& (>= net461) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (>= net5.0) (< netstandard1.4)) (&& (>= net462) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard1.4)) (&& (>= net463) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard2.0)) (&& (>= net463) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net463) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net47) (< net472) (>= netstandard2.0)) (&& (>= net47) (>= net5.0)) System.Memory (4.5.5) - restriction: || (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net462) (>= netstandard2.0)) (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (>= net472) (&& (>= net5.0) (< netstandard2.1)) (&& (< net6.0) (>= netstandard2.0)) (&& (< net7.0) (>= netstandard2.0)) (&& (>= netstandard2.0) (>= uap10.1)) 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) System.Numerics.Vectors (>= 4.4) - restriction: && (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -1026,7 +1011,7 @@ NUGET System.Reactive (5.0) - restriction: >= netstandard2.0 System.Runtime.InteropServices.WindowsRuntime (>= 4.3) - restriction: && (< net472) (< netcoreapp3.1) (>= netstandard2.0) System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net472) (&& (< netcoreapp3.1) (>= netstandard2.0)) (>= uap10.1) - System.Runtime (4.3.1) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netstandard1.6) (>= netstandard2.0)) (&& (< monoandroid) (>= net5.0) (< netstandard1.4)) (&& (< monoandroid) (>= net5.0) (< netstandard1.6)) (&& (< monoandroid) (>= net5.0) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (>= net5.0) (< netstandard1.4)) (&& (< net46) (>= net461) (< netstandard1.4) (>= netstandard2.0)) (&& (< net46) (>= net461) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net462) (< netstandard1.4) (>= netstandard2.0)) (&& (< net46) (>= net462) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net47) (>= netstandard2.0)) (&& (>= net461) (>= net5.0) (< netstandard1.4)) (&& (>= net461) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (>= net5.0) (< netstandard1.4)) (&& (>= net462) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard1.4)) (&& (>= net463) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard2.0)) (&& (>= net463) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net463) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net47) (< net472) (>= netstandard2.0)) (&& (>= net47) (>= net5.0)) + System.Runtime (4.3.1) - restriction: && (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) Microsoft.NETCore.Platforms (>= 1.1.1) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.2) (< win8) (< wp8)) (&& (< monoandroid) (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard1.3) (< netstandard1.5) (< win8) (< wpa81)) (&& (< monotouch) (< net45) (>= netstandard1.5) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) Microsoft.NETCore.Targets (>= 1.1.3) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.2) (< win8) (< wp8)) (&& (< monoandroid) (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard1.3) (< netstandard1.5) (< win8) (< wpa81)) (&& (< monotouch) (< net45) (>= netstandard1.5) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (&& (>= monoandroid) (< netstandard1.1) (>= netstandard2.0)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (< monoandroid) (< netstandard1.0) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard2.0) (< win8)) (&& (>= monotouch) (>= netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net461) (>= netstandard2.0)) (&& (>= net462) (>= netcoreapp2.0)) (&& (>= net462) (>= netstandard2.0)) (&& (>= net462) (>= xamarinios)) (&& (>= net462) (>= xamarinmac)) (>= net472) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netstandard2.0)) (&& (< net6.0) (>= xamarinios)) (&& (< net6.0) (>= xamarinmac)) (&& (< netstandard1.0) (>= netstandard2.0) (>= win8)) (&& (< netstandard1.1) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= uap10.1)) (&& (>= netstandard2.0) (>= wp8)) @@ -1034,22 +1019,14 @@ NUGET System.Runtime (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< win8) (< wp8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Security.AccessControl (6.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3) (>= netstandard2.0)) (&& (< monoandroid) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netstandard2.0)) (&& (< net45) (>= net461) (>= netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (&& (>= net462) (>= netstandard2.0)) (&& (< net6.0) (>= netstandard2.0)) (>= netcoreapp2.1) (&& (>= netstandard2.0) (>= uap10.1)) (&& (>= netstandard2.0) (>= xamarintvos)) (&& (>= netstandard2.0) (>= xamarinwatchos)) (>= xamarinios) (>= xamarinmac) System.Security.Principal.Windows (>= 5.0) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Security.Cryptography.Algorithms (4.3.1) - restriction: || (&& (< monoandroid) (< net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netstandard1.6) (>= netstandard2.0)) (&& (< monoandroid) (>= net5.0) (< netstandard1.4)) (&& (< monoandroid) (>= net5.0) (< netstandard1.6)) (&& (< monoandroid) (>= net5.0) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (>= net5.0) (< netstandard1.4)) (&& (>= net46) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net461) (< net462) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net461) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net47) (< net472) (>= netstandard2.0)) (&& (>= net47) (>= net5.0)) - System.IO (>= 4.3) - restriction: || (&& (< monoandroid) (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< monoandroid) (< net46) (>= netstandard1.4) (< netstandard1.6)) (&& (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net463) - System.Runtime (>= 4.3) - restriction: || (&& (< monoandroid) (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< monoandroid) (< net46) (>= netstandard1.4) (< netstandard1.6)) (&& (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net463) - System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (&& (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net463) - System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (&& (< monoandroid) (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< monoandroid) (< net46) (>= netstandard1.4) (< netstandard1.6)) (&& (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (< netstandard1.4)) (&& (>= net461) (< netstandard1.6)) (>= net463) - System.Security.Cryptography.Cng (5.0) - restriction: || (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (&& (< net472) (>= netstandard2.0)) (>= net5.0) (&& (< net6.0) (>= netstandard2.1)) + System.Security.Cryptography.Cng (5.0) - restriction: || (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (&& (>= net5.0) (< net6.0)) (&& (>= net5.0) (< netstandard2.1)) (&& (< net6.0) (>= netstandard2.1)) Microsoft.NETCore.Platforms (>= 5.0) - restriction: && (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos) System.Formats.Asn1 (>= 5.0) - restriction: && (>= netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Security.Cryptography.Algorithms (>= 4.3.1) - restriction: || (&& (< monoandroid) (< monotouch) (< net46) (>= netstandard1.6) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< monoandroid) (< net46) (>= netstandard1.4) (< netstandard1.6) (< uap10.1)) (&& (>= net46) (< netstandard1.4)) (&& (>= net461) (< net462) (< netstandard1.6)) (&& (>= net462) (< netstandard1.6)) (>= net47) - System.Security.Cryptography.Encoding (4.3) - restriction: || (&& (< monoandroid) (< net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netstandard1.6) (>= netstandard2.0)) (&& (< monoandroid) (>= net5.0) (< netstandard1.4)) (&& (< monoandroid) (>= net5.0) (< netstandard1.6)) (&& (< monoandroid) (>= net5.0) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (>= net5.0) (< netstandard1.4)) (&& (< net46) (>= net461) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net462) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net47) (>= netstandard2.0)) (&& (>= net461) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard1.4)) (&& (>= net463) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard2.0)) (&& (>= net463) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net463) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net47) (< net472) (>= netstandard2.0)) (&& (>= net47) (>= net5.0)) - System.Security.Cryptography.Pkcs (7.0.1) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) + System.Security.Cryptography.Pkcs (7.0.3) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) System.Buffers (>= 4.5.1) - restriction: && (< net462) (>= netstandard2.0) (< netstandard2.1) System.Formats.Asn1 (>= 7.0) - restriction: || (&& (< net462) (>= netstandard2.0)) (>= netstandard2.1) System.Memory (>= 4.5.5) - restriction: && (< net462) (>= netstandard2.0) (< netstandard2.1) System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (&& (< net6.0) (>= netstandard2.1)) - System.Security.Cryptography.Primitives (4.3) - restriction: || (&& (< monoandroid) (< net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netstandard1.6) (>= netstandard2.0)) (&& (< monoandroid) (>= net5.0) (< netstandard1.4)) (&& (< monoandroid) (>= net5.0) (< netstandard1.6)) (&& (< monoandroid) (>= net5.0) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (>= net5.0) (< netstandard1.4)) (&& (>= net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< net46) (>= net461) (< netstandard1.6) (>= netstandard2.0)) (&& (< net46) (>= net47) (>= netstandard2.0)) (&& (>= net461) (< net462) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net461) (>= net5.0) (< netstandard1.4)) (&& (>= net461) (>= net5.0) (< netstandard1.6)) (&& (>= net461) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net462) (>= net5.0) (< netstandard1.4)) (&& (>= net462) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net462) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net463) (>= net5.0) (< netstandard1.4)) (&& (>= net463) (>= net5.0) (< netstandard1.6)) (&& (>= net463) (>= net5.0) (< netstandard2.0)) (&& (>= net463) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net463) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net47) (< net472) (>= netstandard2.0)) (&& (>= net47) (>= net5.0)) (&& (>= net47) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net47) (< netstandard1.6) (>= netstandard2.0)) System.Security.Cryptography.ProtectedData (7.0.1) - restriction: || (&& (< net462) (>= netstandard2.0)) (&& (< net472) (>= netstandard2.0)) (>= net6.0) System.Memory (>= 4.5.5) - restriction: && (< net462) (< net6.0) (>= netstandard2.0) System.Security.Permissions (7.0) - restriction: >= netstandard2.0 @@ -1097,7 +1074,7 @@ NUGET Fable.Browser.Event (>= 1.5) - restriction: >= netstandard2.0 Fable.Core (>= 3.0) - restriction: >= netstandard2.0 FSharp.Core (>= 4.7.2) - restriction: >= netstandard2.0 - Fable.Core (4.0) - restriction: >= netstandard2.0 + Fable.Core (4.1) - restriction: >= netstandard2.0 Fable.React (9.3) Fable.React.Types (>= 18.3) - restriction: >= netstandard2.0 Fable.ReactDom.Types (>= 18.2) - restriction: >= netstandard2.0 @@ -1190,22 +1167,23 @@ NUGET System.Runtime.Loader (>= 4.0) - restriction: && (< net461) (>= netstandard2.0) System.Security.Cryptography.Algorithms (>= 4.3) - restriction: && (< net461) (>= netstandard2.0) System.ValueTuple (>= 4.4) - restriction: >= net461 - FSharp.Core (7.0.300) + FSharp.Core (7.0.400) FSharp.Formatting (4.0.0-rc1) FSharp.Compiler.Service (>= 34.1) - restriction: >= netstandard2.0 FSharp.Literate (4.0.0-rc1) FSharp.Compiler.Service (>= 34.1) - restriction: >= netstandard2.0 FSharp.Core (>= 4.7) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (17.6.3) - restriction: >= netstandard2.0 + Microsoft.Build.Framework (17.7.2) - restriction: >= netstandard2.0 Microsoft.VisualStudio.Setup.Configuration.Interop (>= 3.2.2146) - restriction: >= net472 Microsoft.Win32.Registry (>= 5.0) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= net472 + System.Memory (>= 4.5.5) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net472) (&& (< net7.0) (>= netstandard2.0)) System.Security.Permissions (>= 7.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net7.0) System.Security.Principal.Windows (>= 5.0) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) - Microsoft.Build.Utilities.Core (17.6.3) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (>= 17.6.3) - restriction: >= netstandard2.0 + Microsoft.Build.Utilities.Core (17.7.2) - restriction: >= netstandard2.0 + Microsoft.Build.Framework (>= 17.7.2) - restriction: >= netstandard2.0 Microsoft.IO.Redist (>= 6.0) - restriction: >= net472 - Microsoft.NET.StringTools (>= 17.6.3) - restriction: >= netstandard2.0 + Microsoft.NET.StringTools (>= 17.7.2) - restriction: >= netstandard2.0 Microsoft.VisualStudio.Setup.Configuration.Interop (>= 3.2.2146) - restriction: || (>= net472) (>= net7.0) Microsoft.Win32.Registry (>= 5.0) - restriction: && (< net472) (< net7.0) (>= netstandard2.0) System.Collections.Immutable (>= 7.0) - restriction: >= netstandard2.0 @@ -1218,12 +1196,12 @@ NUGET Microsoft.IO.Redist (6.0) - restriction: >= net472 System.Buffers (>= 4.5.1) - restriction: >= net472 System.Memory (>= 4.5.4) - restriction: >= net472 - Microsoft.NET.StringTools (17.6.3) - restriction: >= netstandard2.0 + Microsoft.NET.StringTools (17.7.2) - restriction: >= netstandard2.0 System.Memory (>= 4.5.5) - restriction: || (>= net472) (&& (< net7.0) (>= netstandard2.0)) System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net472) (&& (< net7.0) (>= netstandard2.0)) - Microsoft.NETCore.Platforms (7.0.2) - restriction: || (&& (>= monoandroid) (>= netcoreapp2.0) (< netstandard1.3)) (&& (>= monoandroid) (>= netcoreapp2.1) (< netstandard1.3)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= net5.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= monotouch) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net461) (>= netcoreapp2.0)) (&& (>= net461) (>= netcoreapp2.1)) (&& (>= netcoreapp2.0) (>= uap10.1)) (&& (< netcoreapp2.0) (>= netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp2.1) (< netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp2.1) (>= uap10.1)) + Microsoft.NETCore.Platforms (7.0.4) - restriction: || (&& (>= monoandroid) (>= netcoreapp2.0) (< netstandard1.3)) (&& (>= monoandroid) (>= netcoreapp2.1) (< netstandard1.3)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= net5.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= monotouch) (>= netcoreapp2.0)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net461) (>= netcoreapp2.0)) (&& (>= net461) (>= netcoreapp2.1)) (&& (>= netcoreapp2.0) (>= uap10.1)) (&& (< netcoreapp2.0) (>= netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp2.1) (< netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp2.1) (>= uap10.1)) Microsoft.NETCore.Targets (5.0) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) - Microsoft.VisualStudio.Setup.Configuration.Interop (3.6.2115) - restriction: || (>= net472) (>= net7.0) + Microsoft.VisualStudio.Setup.Configuration.Interop (3.7.2175) - restriction: || (>= net472) (>= net7.0) Microsoft.Win32.Primitives (4.3) - restriction: && (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -1235,25 +1213,24 @@ NUGET System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.1) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) Microsoft.Win32.SystemEvents (7.0) - restriction: >= net6.0 Mono.Posix.NETStandard (1.0) - restriction: >= netstandard2.0 - MSBuild.StructuredLogger (2.1.820) - restriction: >= netstandard2.0 + MSBuild.StructuredLogger (2.1.858) - restriction: >= netstandard2.0 Microsoft.Build.Framework (>= 17.5) - restriction: >= netstandard2.0 Microsoft.Build.Utilities.Core (>= 17.5) - restriction: >= netstandard2.0 Newtonsoft.Json (13.0.3) - restriction: >= netstandard2.0 - NuGet.Common (6.6) - restriction: >= netstandard2.0 - NuGet.Frameworks (>= 6.6) - restriction: >= netstandard2.0 - NuGet.Configuration (6.6) - restriction: >= netstandard2.0 - NuGet.Common (>= 6.6) - restriction: >= netstandard2.0 + NuGet.Common (6.7) - restriction: >= netstandard2.0 + NuGet.Frameworks (>= 6.7) - restriction: >= netstandard2.0 + NuGet.Configuration (6.7) - restriction: >= netstandard2.0 + NuGet.Common (>= 6.7) - restriction: >= netstandard2.0 System.Security.Cryptography.ProtectedData (>= 4.4) - restriction: && (< net472) (>= netstandard2.0) - NuGet.Frameworks (6.6) - restriction: >= netstandard2.0 - NuGet.Packaging (6.6) - restriction: >= netstandard2.0 + NuGet.Frameworks (6.7) - restriction: >= netstandard2.0 + NuGet.Packaging (6.7) - restriction: >= netstandard2.0 Newtonsoft.Json (>= 13.0.1) - restriction: >= netstandard2.0 - NuGet.Configuration (>= 6.6) - restriction: >= netstandard2.0 - NuGet.Versioning (>= 6.6) - restriction: >= netstandard2.0 - System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) - System.Security.Cryptography.Pkcs (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) - NuGet.Protocol (6.6) - restriction: >= netstandard2.0 - NuGet.Packaging (>= 6.6) - restriction: >= netstandard2.0 - NuGet.Versioning (6.6) - restriction: >= netstandard2.0 + NuGet.Configuration (>= 6.7) - restriction: >= netstandard2.0 + NuGet.Versioning (>= 6.7) - restriction: >= netstandard2.0 + System.Security.Cryptography.Pkcs (>= 6.0.4) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) + NuGet.Protocol (6.7) - restriction: >= netstandard2.0 + NuGet.Packaging (>= 6.7) - restriction: >= netstandard2.0 + NuGet.Versioning (6.7) - restriction: >= netstandard2.0 runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -1357,7 +1334,7 @@ NUGET System.Runtime (>= 4.3) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard1.2) (< win8)) (&& (< monoandroid) (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard1.3) (< netstandard1.5) (< win8) (< wpa81)) (&& (< monotouch) (< net45) (>= netstandard1.5) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) System.Drawing.Common (7.0) - restriction: >= net6.0 Microsoft.Win32.SystemEvents (>= 7.0) - restriction: >= net6.0 - System.Formats.Asn1 (7.0) - restriction: || (&& (< net462) (>= netstandard2.0)) (&& (>= net5.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= netstandard2.1) + System.Formats.Asn1 (7.0) - restriction: || (&& (< net462) (>= netstandard2.0)) (&& (>= net5.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp3.0) (< xamarintvos) (< xamarinwatchos)) (>= netstandard2.1) System.Buffers (>= 4.5.1) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Globalization (4.3) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) @@ -1402,7 +1379,7 @@ NUGET System.Reflection.Emit (4.7) - restriction: && (< net461) (>= netstandard2.0) System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= uap10.1) System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard2.0) (< win8)) (&& (< netstandard1.1) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= uap10.1)) - System.Reflection.Metadata (7.0.1) - restriction: || (>= net461) (>= netstandard2.0) + System.Reflection.Metadata (7.0.2) - restriction: || (>= net461) (>= netstandard2.0) System.Collections.Immutable (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0) System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0)) System.Reflection.Primitives (4.3) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< net45) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) @@ -1446,7 +1423,7 @@ NUGET System.Runtime.Extensions (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net45) (>= netstandard1.3) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Security.AccessControl (6.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3) (>= netstandard2.0)) (&& (< monoandroid) (>= netcoreapp2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= monotouch) (>= netstandard2.0)) (&& (< net46) (>= net461) (>= netstandard2.0)) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net462) (>= netstandard2.0)) (&& (< net6.0) (>= netstandard2.0)) (&& (>= netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netstandard2.0) (>= uap10.1)) System.Security.Principal.Windows (>= 5.0) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Security.Cryptography.Algorithms (4.3.1) - restriction: || (&& (< monoandroid) (< net46) (< netstandard1.4) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netstandard1.6) (>= netstandard2.0)) (&& (< monoandroid) (>= net5.0) (< netstandard1.4)) (&& (< monoandroid) (>= net5.0) (< netstandard1.6)) (&& (< monoandroid) (>= net5.0) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (>= net5.0) (< netstandard1.4)) (&& (>= net46) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net461) (< net462) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net461) (>= net5.0) (< netstandard1.6)) (&& (< net461) (>= netstandard2.0)) (&& (>= net462) (>= net5.0) (< netstandard1.6)) (&& (>= net462) (< netstandard1.6) (>= netstandard2.0)) (&& (>= net47) (< net472) (>= netstandard2.0)) (&& (>= net47) (>= net5.0)) + System.Security.Cryptography.Algorithms (4.3.1) - restriction: && (< net461) (>= netstandard2.0) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) - restriction: && (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - restriction: && (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -1461,10 +1438,9 @@ NUGET System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (&& (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net463) System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (&& (< monoandroid) (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< monoandroid) (< net46) (>= netstandard1.4) (< netstandard1.6)) (&& (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= net46) (< netstandard1.4)) (&& (>= net461) (< netstandard1.6)) (>= net463) System.Text.Encoding (>= 4.3) - restriction: && (< monotouch) (< net46) (>= netstandard1.6) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Security.Cryptography.Cng (5.0) - restriction: || (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (&& (< net472) (>= netstandard2.0)) (>= net5.0) (&& (< net6.0) (>= netstandard2.1)) + System.Security.Cryptography.Cng (5.0) - restriction: || (&& (< net462) (>= netstandard2.0) (< netstandard2.1)) (&& (>= net5.0) (< net6.0)) (&& (>= net5.0) (< netstandard2.1)) (&& (< net6.0) (>= netstandard2.1)) Microsoft.NETCore.Platforms (>= 5.0) - restriction: && (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos) System.Formats.Asn1 (>= 5.0) - restriction: && (>= netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Security.Cryptography.Algorithms (>= 4.3.1) - restriction: || (&& (< monoandroid) (< monotouch) (< net46) (>= netstandard1.6) (< netstandard2.0) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< monoandroid) (< net46) (>= netstandard1.4) (< netstandard1.6) (< uap10.1)) (&& (>= net46) (< netstandard1.4)) (&& (>= net461) (< net462) (< netstandard1.6)) (&& (>= net462) (< netstandard1.6)) (>= net47) System.Security.Cryptography.Encoding (4.3) - restriction: || (&& (< net46) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< net461) (>= net463) (>= netstandard2.0)) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -1478,7 +1454,7 @@ NUGET System.Runtime.InteropServices (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Security.Cryptography.Primitives (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) System.Text.Encoding (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Security.Cryptography.Pkcs (7.0.1) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) + System.Security.Cryptography.Pkcs (7.0.3) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) System.Buffers (>= 4.5.1) - restriction: && (< net462) (>= netstandard2.0) (< netstandard2.1) System.Formats.Asn1 (>= 7.0) - restriction: || (&& (< net462) (>= netstandard2.0)) (>= netstandard2.1) System.Memory (>= 4.5.5) - restriction: && (< net462) (>= netstandard2.0) (< netstandard2.1) diff --git a/src/GraphBLAS-sharp.Backend/Algorithms/Algorithms.fs b/src/GraphBLAS-sharp.Backend/Algorithms/Algorithms.fs new file mode 100644 index 00000000..f46a35cd --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Algorithms/Algorithms.fs @@ -0,0 +1,16 @@ +namespace GraphBLAS.FSharp + +open Microsoft.FSharp.Core +open GraphBLAS.FSharp.Backend.Algorithms + +[] +module Algorithms = + module BFS = + let singleSource = BFS.singleSource + + let singleSourceSparse = BFS.singleSourceSparse + + let singleSourcePushPull = BFS.singleSourcePushPull + + module SSSP = + let singleSource = SSSP.run diff --git a/src/GraphBLAS-sharp.Backend/Algorithms/BFS.fs b/src/GraphBLAS-sharp.Backend/Algorithms/BFS.fs index 9896a557..29384a87 100644 --- a/src/GraphBLAS-sharp.Backend/Algorithms/BFS.fs +++ b/src/GraphBLAS-sharp.Backend/Algorithms/BFS.fs @@ -1,18 +1,15 @@ namespace GraphBLAS.FSharp.Backend.Algorithms -open GraphBLAS.FSharp.Backend open Brahma.FSharp open FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Vector -open GraphBLAS.FSharp.Backend.Vector.Dense -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions -module BFS = +module internal BFS = let singleSource (add: Expr int option -> int option>) (mul: Expr<'a option -> int option -> int option>) @@ -20,54 +17,218 @@ module BFS = workGroupSize = - let spMVTo = - SpMV.runTo add mul clContext workGroupSize + let spMVInPlace = + Operations.SpMVInPlace add mul clContext workGroupSize let zeroCreate = - ClArray.zeroCreate clContext workGroupSize + Vector.zeroCreate clContext workGroupSize let ofList = Vector.ofList clContext workGroupSize - let maskComplementedTo = + let maskComplementedInPlace = Vector.map2InPlace Mask.complementedOp clContext workGroupSize let fillSubVectorTo = - Vector.assignByMaskInPlace (Convert.assignToOption Mask.assign) clContext workGroupSize + Vector.assignByMaskInPlace Mask.assign clContext workGroupSize let containsNonZero = - ClArray.exists Predicates.isSome clContext workGroupSize + Vector.exists Predicates.isSome clContext workGroupSize - fun (queue: MailboxProcessor) (matrix: ClMatrix.CSR<'a>) (source: int) -> + fun (queue: MailboxProcessor) (matrix: ClMatrix<'a>) (source: int) -> let vertexCount = matrix.RowCount - let levels = zeroCreate queue HostInterop vertexCount + let levels = + zeroCreate queue DeviceOnly vertexCount Dense - let frontier = + let front = ofList queue DeviceOnly Dense vertexCount [ source, 1 ] - match frontier with - | ClVector.Dense front -> + let mutable level = 0 + let mutable stop = false - let mutable level = 0 - let mutable stop = false + while not stop do + level <- level + 1 - while not stop do - level <- level + 1 + //Assigning new level values + fillSubVectorTo queue levels front level - //Assigning new level values - fillSubVectorTo queue levels front (clContext.CreateClCell level) levels + //Getting new frontier + spMVInPlace queue matrix front front + maskComplementedInPlace queue front levels + + //Checking if front is empty + stop <- + not + <| (containsNonZero queue front).ToHostAndFree queue + + front.Dispose queue + + levels + + let singleSourceSparse + (add: Expr bool option -> bool option>) + (mul: Expr bool option -> bool option>) + (clContext: ClContext) + workGroupSize + = + + let spMSpV = + Operations.SpMSpVBool add mul clContext workGroupSize + + let zeroCreate = + Vector.zeroCreate clContext workGroupSize + + let ofList = Vector.ofList clContext workGroupSize + + let maskComplemented = + Vector.map2Sparse Mask.complementedOp clContext workGroupSize + + let fillSubVectorTo = + Vector.assignByMaskInPlace Mask.assign clContext workGroupSize + + fun (queue: MailboxProcessor) (matrix: ClMatrix) (source: int) -> + let vertexCount = matrix.RowCount + + let levels = + zeroCreate queue DeviceOnly vertexCount Dense + + let mutable front = + ofList queue DeviceOnly Sparse vertexCount [ source, true ] + + let mutable level = 0 + let mutable stop = false + + while not stop do + level <- level + 1 + + //Assigning new level values + fillSubVectorTo queue levels front level + + //Getting new frontier + match spMSpV queue matrix front with + | None -> + front.Dispose queue + stop <- true + | Some newFrontier -> + front.Dispose queue + //Filtering visited vertices + match maskComplemented queue DeviceOnly newFrontier levels with + | None -> + stop <- true + newFrontier.Dispose queue + | Some f -> + front <- f + newFrontier.Dispose queue + + levels + + + let singleSourcePushPull + (add: Expr bool option -> bool option>) + (mul: Expr bool option -> bool option>) + (clContext: ClContext) + workGroupSize + = + + let spMVInPlace = + Operations.SpMVInPlace add mul clContext workGroupSize + + let spMSpV = + Operations.SpMSpVBool add mul clContext workGroupSize + + let zeroCreate = + Vector.zeroCreate clContext workGroupSize + + let ofList = Vector.ofList clContext workGroupSize + + let maskComplementedInPlace = + Vector.map2InPlace Mask.complementedOp clContext workGroupSize + + let maskComplemented = + Vector.map2Sparse Mask.complementedOp clContext workGroupSize + + let fillSubVectorInPlace = + Vector.assignByMaskInPlace (Mask.assign) clContext workGroupSize + + let toSparse = Vector.toSparse clContext workGroupSize + + let toDense = Vector.toDense clContext workGroupSize + + let countNNZ = + ClArray.count Predicates.isSome clContext workGroupSize + + //Push or pull functions + let getNNZ (queue: MailboxProcessor) (v: ClVector) = + match v with + | ClVector.Sparse v -> v.NNZ + | ClVector.Dense v -> countNNZ queue v + + let SPARSITY = 0.001f + + let push nnz size = + (float32 nnz) / (float32 size) <= SPARSITY + + fun (queue: MailboxProcessor) (matrix: ClMatrix) (source: int) -> + let vertexCount = matrix.RowCount + + let levels = + zeroCreate queue DeviceOnly vertexCount Dense + + let mutable frontier = + ofList queue DeviceOnly Sparse vertexCount [ source, true ] + + let mutable level = 0 + let mutable stop = false + + while not stop do + level <- level + 1 + + //Assigning new level values + fillSubVectorInPlace queue levels frontier level + + match frontier with + | ClVector.Sparse _ -> + //Getting new frontier + match spMSpV queue matrix frontier with + | None -> + frontier.Dispose queue + stop <- true + | Some newFrontier -> + frontier.Dispose queue + //Filtering visited vertices + match maskComplemented queue DeviceOnly newFrontier levels with + | None -> + stop <- true + newFrontier.Dispose queue + | Some newMaskedFrontier -> + newFrontier.Dispose queue + + //Push/pull + let NNZ = getNNZ queue newMaskedFrontier + + if (push NNZ newMaskedFrontier.Size) then + frontier <- newMaskedFrontier + else + frontier <- toDense queue DeviceOnly newMaskedFrontier + newMaskedFrontier.Dispose queue + | ClVector.Dense oldFrontier -> //Getting new frontier - spMVTo queue matrix front front + spMVInPlace queue matrix frontier frontier + + maskComplementedInPlace queue frontier levels - maskComplementedTo queue front levels front + //Emptiness check + let NNZ = getNNZ queue frontier - //Checking if front is empty - stop <- - not - <| (containsNonZero queue front).ToHostAndFree queue + stop <- NNZ = 0 - front.Free queue + //Push/pull + if not stop then + if (push NNZ frontier.Size) then + frontier <- toSparse queue DeviceOnly frontier + oldFrontier.Free queue + else + frontier.Dispose queue - levels - | _ -> failwith "Not implemented" + levels diff --git a/src/GraphBLAS-sharp.Backend/Algorithms/SSSP.fs b/src/GraphBLAS-sharp.Backend/Algorithms/SSSP.fs new file mode 100644 index 00000000..251f7866 --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Algorithms/SSSP.fs @@ -0,0 +1,81 @@ +namespace GraphBLAS.FSharp.Backend.Algorithms + +open Brahma.FSharp +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions + +module SSSP = + let run (clContext: ClContext) workGroupSize = + + let less = ArithmeticOperations.less + let min = ArithmeticOperations.min + let plus = ArithmeticOperations.intSumAsMul + + let spMVInPlace = + Operations.SpMVInPlace min plus clContext workGroupSize + + let create = ClArray.create clContext workGroupSize + + let ofList = Vector.ofList clContext workGroupSize + + let eWiseMulLess = + Vector.map2To less clContext workGroupSize + + let eWiseAddMin = + Vector.map2To min clContext workGroupSize + + let filter = + Vector.map2To Mask.op clContext workGroupSize + + let containsNonZero = + Vector.exists Predicates.isSome clContext workGroupSize + + fun (queue: MailboxProcessor) (matrix: ClMatrix) (source: int) -> + let vertexCount = matrix.RowCount + + //None is System.Int32.MaxValue + let distance = + ofList queue DeviceOnly Dense vertexCount [ source, 0 ] + + let mutable front1 = + ofList queue DeviceOnly Dense vertexCount [ source, 0 ] + + let mutable front2 = + create queue DeviceOnly vertexCount None + |> ClVector.Dense + + let mutable stop = false + + while not stop do + //Getting new frontier + spMVInPlace queue matrix front1 front2 + + //Checking which distances were updated + eWiseMulLess queue front2 distance front1 + //Updating + eWiseAddMin queue distance front2 distance + + //Filtering unproductive vertices + //Front1 is a mask + filter queue front2 front1 front2 + + //Swap fronts + let temp = front1 + front1 <- front2 + front2 <- temp + + //Checking if no distances were updated + stop <- + not + <| (containsNonZero queue front1) + .ToHostAndFree(queue) + + front1.Dispose queue + front2.Dispose queue + + match distance with + | ClVector.Dense dist -> dist + | _ -> failwith "not implemented" diff --git a/src/GraphBLAS-sharp.Backend/AssemblyInfo.fs b/src/GraphBLAS-sharp.Backend/AssemblyInfo.fs index beeaabeb..12bc67b0 100644 --- a/src/GraphBLAS-sharp.Backend/AssemblyInfo.fs +++ b/src/GraphBLAS-sharp.Backend/AssemblyInfo.fs @@ -4,6 +4,8 @@ namespace System open System.Reflection open System.Runtime.CompilerServices +[] +[] [] [] [] diff --git a/src/GraphBLAS-sharp.Backend/Common/Bitmap.fs b/src/GraphBLAS-sharp.Backend/Common/Bitmap.fs new file mode 100644 index 00000000..889cd43f --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Common/Bitmap.fs @@ -0,0 +1,99 @@ +namespace GraphBLAS.FSharp.Backend.Common + +open Brahma.FSharp +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Backend.Common.Map + +module Bitmap = + let private getUniqueBitmapGeneral predicate (clContext: ClContext) workGroupSize = + + let getUniqueBitmap = + <@ fun (ndRange: Range1D) (inputArray: ClArray<'a>) inputLength (isUniqueBitmap: ClArray) -> + + let gid = ndRange.GlobalID0 + + if gid < inputLength then + let isUnique = (%predicate) gid inputLength inputArray // brahma error + + if isUnique then + isUniqueBitmap.[gid] <- 1 + else + isUniqueBitmap.[gid] <- 0 @> + + let kernel = clContext.Compile(getUniqueBitmap) + + fun (processor: MailboxProcessor<_>) allocationMode (inputArray: ClArray<'a>) -> + + let inputLength = inputArray.Length + + let ndRange = + Range1D.CreateValid(inputLength, workGroupSize) + + let bitmap = + clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, inputLength) + + let kernel = kernel.GetKernel() + + processor.Post(Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange inputArray inputLength bitmap)) + + processor.Post(Msg.CreateRunMsg<_, _> kernel) + + bitmap + + /// + /// Gets the bitmap that indicates the first elements of the sequences of consecutive identical elements + /// + /// OpenCL context. + let firstOccurrence clContext = + getUniqueBitmapGeneral + <| Predicates.firstOccurrence () + <| clContext + + /// + /// Gets the bitmap that indicates the last elements of the sequences of consecutive identical elements + /// + /// OpenCL context. + let lastOccurrence clContext = + getUniqueBitmapGeneral + <| Predicates.lastOccurrence () + <| clContext + + let private getUniqueBitmap2General<'a when 'a: equality> getUniqueBitmap (clContext: ClContext) workGroupSize = + + let map = + map2 <@ fun x y -> x ||| y @> clContext workGroupSize + + let firstGetBitmap = getUniqueBitmap clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (firstArray: ClArray<'a>) (secondArray: ClArray<'a>) -> + let firstBitmap = + firstGetBitmap processor DeviceOnly firstArray + + let secondBitmap = + firstGetBitmap processor DeviceOnly secondArray + + let result = + map processor allocationMode firstBitmap secondBitmap + + firstBitmap.Free processor + secondBitmap.Free processor + + result + + /// + /// Gets the bitmap that indicates the first elements of the sequences + /// of consecutive identical elements from either first array or second array. + /// + /// OpenCL context. + let firstOccurrence2 clContext = + getUniqueBitmap2General firstOccurrence clContext + + /// + /// Gets the bitmap that indicates the last elements of the sequences + /// of consecutive identical elements from either first array or second array. + /// + /// OpenCL context. + let lastOccurrence2 clContext = + getUniqueBitmap2General lastOccurrence clContext diff --git a/src/GraphBLAS-sharp.Backend/Common/ClArray.fs b/src/GraphBLAS-sharp.Backend/Common/ClArray.fs index d048c650..dacb249e 100644 --- a/src/GraphBLAS-sharp.Backend/Common/ClArray.fs +++ b/src/GraphBLAS-sharp.Backend/Common/ClArray.fs @@ -1,15 +1,21 @@ -namespace GraphBLAS.FSharp.Backend.Common +namespace GraphBLAS.FSharp -open System.Collections.Generic open Brahma.FSharp open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Backend.Common open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions +[] module ClArray = + /// + /// Creates an array given the dimension and a generator function to compute the elements. + /// + /// The function to generate the initial values for each index. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let init (initializer: Expr 'a>) (clContext: ClContext) workGroupSize = let init = @@ -36,6 +42,11 @@ module ClArray = outputArray + /// + /// Creates an array whose elements are all initially the given value. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let create (clContext: ClContext) workGroupSize = let create = @@ -61,10 +72,15 @@ module ClArray = processor.Post(Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange outputArray length value)) processor.Post(Msg.CreateRunMsg<_, _> kernel) - processor.Post(Msg.CreateFreeMsg(value)) + value.Free processor outputArray + /// + /// Creates an array where the entries are initially the default value of desired type. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let zeroCreate<'a> (clContext: ClContext) workGroupSize = let create = create clContext workGroupSize @@ -72,6 +88,11 @@ module ClArray = fun (processor: MailboxProcessor<_>) allocationMode length -> create processor allocationMode length Unchecked.defaultof<'a> + /// + /// Builds a new array that contains the elements of the given array. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let copy (clContext: ClContext) workGroupSize = let copy = <@ fun (ndRange: Range1D) (inputArrayBuffer: ClArray<'a>) (outputArrayBuffer: ClArray<'a>) inputArrayLength -> @@ -100,6 +121,11 @@ module ClArray = outputArray + /// + /// Creates an array of the given size by replicating the values of the given initial array. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let replicate (clContext: ClContext) workGroupSize = let replicate = @@ -132,184 +158,12 @@ module ClArray = outputArray - let map<'a, 'b> (op: Expr<'a -> 'b>) (clContext: ClContext) workGroupSize = - - let map = - <@ fun (ndRange: Range1D) lenght (inputArray: ClArray<'a>) (result: ClArray<'b>) -> - - let gid = ndRange.GlobalID0 - - if gid < lenght then - result.[gid] <- (%op) inputArray.[gid] @> - - let kernel = clContext.Compile map - - fun (processor: MailboxProcessor<_>) allocationMode (inputArray: ClArray<'a>) -> - - let result = - clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, inputArray.Length) - - let ndRange = - Range1D.CreateValid(inputArray.Length, workGroupSize) - - let kernel = kernel.GetKernel() - - processor.Post(Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange inputArray.Length inputArray result)) - - processor.Post(Msg.CreateRunMsg<_, _>(kernel)) - - result - - let mapWithValue<'a, 'b, 'c> (clContext: ClContext) workGroupSize (op: Expr<'a -> 'b -> 'c>) = - - let map = - <@ fun (ndRange: Range1D) lenght (value: ClCell<'a>) (inputArray: ClArray<'b>) (result: ClArray<'c>) -> - - let gid = ndRange.GlobalID0 - - if gid < lenght then - result.[gid] <- (%op) value.Value inputArray.[gid] @> - - let kernel = clContext.Compile map - - fun (processor: MailboxProcessor<_>) allocationMode (value: 'a) (inputArray: ClArray<'b>) -> - - let result = - clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, inputArray.Length) - - let valueClCell = value |> clContext.CreateClCell - - let ndRange = - Range1D.CreateValid(inputArray.Length, workGroupSize) - - let kernel = kernel.GetKernel() - - processor.Post( - Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange inputArray.Length valueClCell inputArray result) - ) - - processor.Post(Msg.CreateRunMsg<_, _>(kernel)) - - result - - let map2InPlace<'a, 'b, 'c> (map: Expr<'a -> 'b -> 'c>) (clContext: ClContext) workGroupSize = - - let kernel = - <@ fun (ndRange: Range1D) length (leftArray: ClArray<'a>) (rightArray: ClArray<'b>) (resultArray: ClArray<'c>) -> - - let gid = ndRange.GlobalID0 - - if gid < length then - - resultArray.[gid] <- (%map) leftArray.[gid] rightArray.[gid] @> - - let kernel = clContext.Compile kernel - - fun (processor: MailboxProcessor<_>) (leftArray: ClArray<'a>) (rightArray: ClArray<'b>) (resultArray: ClArray<'c>) -> - - let ndRange = - Range1D.CreateValid(resultArray.Length, workGroupSize) - - let kernel = kernel.GetKernel() - - processor.Post( - Msg.MsgSetArguments - (fun () -> kernel.KernelFunc ndRange resultArray.Length leftArray rightArray resultArray) - ) - - processor.Post(Msg.CreateRunMsg<_, _>(kernel)) - - let map2<'a, 'b, 'c> map (clContext: ClContext) workGroupSize = - let map2 = - map2InPlace<'a, 'b, 'c> map clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode (leftArray: ClArray<'a>) (rightArray: ClArray<'b>) -> - - let resultArray = - clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, leftArray.Length) - - map2 processor leftArray rightArray resultArray - - resultArray - - module Bitmap = - let private getUniqueBitmapGeneral predicate (clContext: ClContext) workGroupSize = - - let getUniqueBitmap = - <@ fun (ndRange: Range1D) (inputArray: ClArray<'a>) inputLength (isUniqueBitmap: ClArray) -> - - let gid = ndRange.GlobalID0 - - if gid < inputLength then - let isUnique = (%predicate) gid inputLength inputArray // brahma error - - if isUnique then - isUniqueBitmap.[gid] <- 1 - else - isUniqueBitmap.[gid] <- 0 @> - - let kernel = clContext.Compile(getUniqueBitmap) - - fun (processor: MailboxProcessor<_>) allocationMode (inputArray: ClArray<'a>) -> - - let inputLength = inputArray.Length - - let ndRange = - Range1D.CreateValid(inputLength, workGroupSize) - - let bitmap = - clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, inputLength) - - let kernel = kernel.GetKernel() - - processor.Post(Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange inputArray inputLength bitmap)) - - processor.Post(Msg.CreateRunMsg<_, _> kernel) - - bitmap - - let firstOccurrence clContext = - getUniqueBitmapGeneral - <| Predicates.firstOccurrence () - <| clContext - - let lastOccurrence clContext = - getUniqueBitmapGeneral - <| Predicates.lastOccurrence () - <| clContext - - let private getUniqueBitmap2General<'a when 'a: equality> getUniqueBitmap (clContext: ClContext) workGroupSize = - - let map = - map2 <@ fun x y -> x ||| y @> clContext workGroupSize - - let firstGetBitmap = getUniqueBitmap clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode (firstArray: ClArray<'a>) (secondArray: ClArray<'a>) -> - let firstBitmap = - firstGetBitmap processor DeviceOnly firstArray - - let secondBitmap = - firstGetBitmap processor DeviceOnly secondArray - - let result = - map processor allocationMode firstBitmap secondBitmap - - firstBitmap.Free processor - secondBitmap.Free processor - - result - - let firstOccurrence2 clContext = - getUniqueBitmap2General firstOccurrence clContext - - let lastOccurrence2 clContext = - getUniqueBitmap2General lastOccurrence clContext - - ///Remove duplicates form the given array. - ///Computational context - ///Should be a power of 2 and greater than 1. - ///Should be sorted. + /// + /// Removes duplicates form the given array. + /// + /// Computational context + /// Should be a power of 2 and greater than 1. + /// Should be sorted. let removeDuplications (clContext: ClContext) workGroupSize = let scatter = @@ -335,10 +189,16 @@ module ClArray = scatter processor bitmap inputArray outputArray - processor.Post <| Msg.CreateFreeMsg<_>(bitmap) + bitmap.Free processor outputArray + /// + /// Tests if any element of the array satisfies the given predicate. + /// + /// The function to test the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let exists (predicate: Expr<'a -> bool>) (clContext: ClContext) workGroupSize = let exists = @@ -368,7 +228,15 @@ module ClArray = result - let assignOption (op: Expr<'a -> 'b option>) (clContext: ClContext) workGroupSize = + /// + /// Maps every value from the given value array and, if the result of applying function is Some, + /// places the result to a specific position from the input array of positions. + /// If the result of mapping is None, it is just ignored. + /// + /// Function that maps elements from value array. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let private assignOption (op: Expr<'a -> 'b option>) (clContext: ClContext) workGroupSize = let assign = <@ fun (ndRange: Range1D) length (values: ClArray<'a>) (positions: ClArray) (result: ClArray<'b>) resultLength -> @@ -390,7 +258,7 @@ module ClArray = fun (processor: MailboxProcessor<_>) (values: ClArray<'a>) (positions: ClArray) (result: ClArray<'b>) -> if values.Length <> positions.Length then - failwith "lengths must be the same" + failwith "Lengths must be the same" let ndRange = Range1D.CreateValid(values.Length, workGroupSize) @@ -404,9 +272,17 @@ module ClArray = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + /// + /// Applies the given function to each element of the array. + /// Returns the array comprised of the results x + /// for each element where the function returns Some(x). + /// + /// The function to generate options from the elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let choose<'a, 'b> (predicate: Expr<'a -> 'b option>) (clContext: ClContext) workGroupSize = let getBitmap = - map<'a, int> (Map.chooseBitmap predicate) clContext workGroupSize + Map.map<'a, int> (Map.chooseBitmap predicate) clContext workGroupSize let prefixSum = PrefixSum.standardExcludeInPlace clContext workGroupSize @@ -437,6 +313,14 @@ module ClArray = Some result + /// + /// Maps pair of values from the given value arrays and, if the result of applying function is Some, + /// places the result to a specific position from the input array of positions. + /// If the result of mapping is None, it is just ignored. + /// + /// Function that maps pairs of elements from value arrays. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let assignOption2 (op: Expr<'a -> 'b -> 'c option>) (clContext: ClContext) workGroupSize = let assign = @@ -462,7 +346,7 @@ module ClArray = if firstValues.Length <> secondValues.Length || secondValues.Length <> positions.Length then - failwith "lengths must be the same" + failwith "Lengths must be the same" let ndRange = Range1D.CreateValid(firstValues.Length, workGroupSize) @@ -484,9 +368,17 @@ module ClArray = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + /// + /// Applies the given function to each pair of elements of the two given arrays. + /// Returns the array comprised of the results x + /// for each pairs where the function returns Some(x). + /// + /// The function to generate options from the pairs of elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let choose2 (predicate: Expr<'a -> 'b -> 'c option>) (clContext: ClContext) workGroupSize = let getBitmap = - map2<'a, 'b, int> (Map.choose2Bitmap predicate) clContext workGroupSize + Map.map2<'a, 'b, int> (Map.choose2Bitmap predicate) clContext workGroupSize let prefixSum = PrefixSum.standardExcludeInPlace clContext workGroupSize @@ -510,6 +402,11 @@ module ClArray = result + /// + /// Builds a new array that contains the given subrange specified by starting index and length. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let sub (clContext: ClContext) workGroupSize = let kernel = @@ -549,10 +446,10 @@ module ClArray = result /// - /// Lazy divides the input array into chunks of size at most chunkSize. + /// Divides lazily the input array into chunks of size at most chunkSize. /// - /// Cl context. - /// Work group size. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. /// /// Since calculations are performed lazily, the array should not change. /// @@ -581,8 +478,8 @@ module ClArray = /// /// Divides the input array into chunks of size at most chunkSize. /// - /// Cl context. - /// Work group size. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let chunkBySize (clContext: ClContext) workGroupSize = let chunkBySizeLazy = lazyChunkBySize clContext workGroupSize @@ -592,6 +489,11 @@ module ClArray = |> Seq.map (fun lazyValue -> lazyValue.Value) |> Seq.toArray + /// + /// Reads a range of elements from the first array and write them into the second. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let blit<'a> (clContext: ClContext) workGroupSize = let assign = @@ -635,6 +537,11 @@ module ClArray = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + /// + /// Builds a new array that contains the elements of each of the given sequence of arrays. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let concat (clContext: ClContext) workGroupSize = let blit = blit clContext workGroupSize @@ -659,6 +566,11 @@ module ClArray = result + /// + /// Fills a range of elements of the array with the given value. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let fill (clContext: ClContext) workGroupSize = let fill = @@ -693,6 +605,12 @@ module ClArray = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + /// + /// Returns an array of each element in the input array and its predecessor, + /// with the exception of the first element which is only returned as the predecessor of the second element. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let pairwise (clContext: ClContext) workGroupSize = let idGather = @@ -702,7 +620,7 @@ module ClArray = Gather.runInit Map.inc clContext workGroupSize let map = - map2 <@ fun first second -> (first, second) @> clContext workGroupSize + Map.map2 <@ fun first second -> (first, second) @> clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (values: ClArray<'a>) -> if values.Length > 1 then @@ -729,7 +647,7 @@ module ClArray = None let private bound<'a, 'b when 'a: equality and 'a: comparison> - (lowerBound: Expr<(int -> 'a -> ClArray<'a> -> 'b)>) + (lowerBound: Expr 'a -> ClArray<'a> -> 'b>) (clContext: ClContext) workGroupSize = @@ -759,12 +677,32 @@ module ClArray = result + /// + /// Finds the position of the largest value and the value itself + /// that is less than the given one. + /// + /// + /// Array of values should be sorted. + /// + /// OpenCL context. let upperBoundAndValue<'a when 'a: comparison> clContext = bound<'a, int * 'a> Search.Bin.lowerBoundAndValue clContext + /// + /// Finds the position of the largest value that is less than the given one. + /// + /// + /// Array of values should be sorted. + /// + /// OpenCL context. let upperBound<'a when 'a: comparison> clContext = bound<'a, int> Search.Bin.lowerBound clContext + /// + /// Gets the value at the specified position from the input array. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let item<'a> (clContext: ClContext) workGroupSize = let kernel = @@ -794,6 +732,11 @@ module ClArray = result + /// + /// Sets an element of an array. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let set<'a> (clContext: ClContext) workGroupSize = let kernel = @@ -819,3 +762,22 @@ module ClArray = processor.Post(Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange index array value)) processor.Post(Msg.CreateRunMsg<_, _> kernel) + + let count<'a> (predicate: Expr<'a -> bool>) (clContext: ClContext) workGroupSize = + + let sum = + Reduce.reduce <@ (+) @> clContext workGroupSize + + let getBitmap = + Map.map<'a, int> (Map.predicateBitmap predicate) clContext workGroupSize + + fun (processor: MailboxProcessor<_>) (array: ClArray<'a>) -> + + let bitmap = getBitmap processor DeviceOnly array + + let result = + (sum processor bitmap).ToHostAndFree processor + + bitmap.Free processor + + result diff --git a/src/GraphBLAS-sharp.Backend/Common/Common.fs b/src/GraphBLAS-sharp.Backend/Common/Common.fs new file mode 100644 index 00000000..ae9839f2 --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Common/Common.fs @@ -0,0 +1,446 @@ +namespace GraphBLAS.FSharp + +open Brahma.FSharp +open Microsoft.FSharp.Quotations +open GraphBLAS.FSharp.Backend.Common + +module Common = + module Sort = + module Bitonic = + /// + /// Sorts in-place input array of values by their 2d indices, + /// which are stored in two given arrays of keys: rows and columns. + /// When comparing, it first looks at rows, then columns. + /// + /// + /// + /// let rows = [| 0; 0; 3; 2; 1; 0; 5 |] + /// let columns = [| 0; 2; 1; 2; 0; 3; 5; |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// sortKeyValuesInplace clContext 32 processor rows columns values + /// ... + /// > val rows = [| 0; 0; 0; 1; 2; 3; 5 |] + /// > let columns = [| 0; 2; 3; 0; 2; 1; 5; |] + /// > val values = [| 1.9; 2.8; 6.4; 5.5; 4.6; 3.7; 7.3 |] + /// + /// + let sortKeyValuesInplace<'n, 'a when 'n: comparison> = + Sort.Bitonic.sortKeyValuesInplace<'n, 'a> + + module Radix = + /// + /// Sorts stable input array of values by given integer keys. + /// + /// + /// + /// let keys = [| 0; 4; 3; 1; 2; 6; 5 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// runByKeysStandard clContext 32 processor keys values + /// ... + /// > val keys = [| 0; 1; 2; 3; 4; 5; 6 |] + /// > val values = [| 1.9; 4.6; 5.5; 3.7; 2.8; 7.3; 6.4 |] + /// + /// + let runByKeysStandard = Sort.Radix.runByKeysStandard + + /// + /// Sorts stable input array of values by given integer keys and return only values. + /// + /// + /// + /// let keys = [| 0; 4; 3; 1; 2; 6; 5 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// runByKeysStandard clContext 32 processor keys values + /// ... + /// > val values = [| 1.9; 4.6; 5.5; 3.7; 2.8; 7.3; 6.4 |] + /// + /// + let runByKeysStandardValuesOnly = Sort.Radix.runByKeysStandardValuesOnly + + /// + /// Sorts stable input array of integer keys. + /// + /// + /// + /// let keys = [| 0; 4; 3; 1; 2; 6; 5 |] + /// standardRunKeysOnly clContext 32 processor keys + /// ... + /// > val keys = [| 0; 1; 2; 3; 4; 5; 6 |] + /// + /// + let standardRunKeysOnly = Sort.Radix.standardRunKeysOnly + + module Gather = + /// + /// Fills the given output array using the given value array and a function. The function maps old position + /// of each element of the value array to its position in the output array. + /// + /// + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 1; 0; 2; 6; 4; 3; 5 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 2.8; 1.9; 3.7; 7.3; 5.5; 4.6; 6.4 |] + /// + /// + let runInit positionMap (clContext: ClContext) workGroupSize = + Gather.runInit positionMap clContext workGroupSize + + /// + /// Fills the given output array using the given value and position arrays. Array of positions indicates + /// which element from the value array should be in each position of the output array. + /// + /// + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 1; 0; 2; 6; 4; 3; 5 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 2.8; 1.9; 3.7; 7.3; 5.5; 4.6; 6.4 |] + /// + /// + let run (clContext: ClContext) workGroupSize = Gather.run clContext workGroupSize + + module Scatter = + /// + /// Creates a new array from the given one where it is indicated + /// by the array of positions at which position in the new array + /// should be a value from the given one. + /// + /// + /// Every element of the positions array must not be less than the previous one. + /// If there are several elements with the same indices, the FIRST one of them will be at the common index. + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 0; 0; 1; 1; 1; 2; 3; 3; 4 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; 8.2; 9.1 |] + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 1,9; 3.7; 6.4; 7.3; 9.1 |] + /// + /// + let firstOccurrence clContext = Scatter.firstOccurrence clContext + + /// + /// Creates a new array from the given one where it is indicated by the array of positions at which position in the new array + /// should be a value from the given one. + /// + /// + /// Every element of the positions array must not be less than the previous one. + /// If there are several elements with the same indices, the LAST one of them will be at the common index. + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 0; 0; 1; 1; 1; 2; 3; 3; 4 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; 8.2; 9.1 |] + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 2.8; 5.5; 6.4; 8.2; 9.1 |] + /// + /// + let lastOccurrence clContext = Scatter.lastOccurrence clContext + + /// + /// Creates a new array from the given one where it is indicated by the array of positions at which position in the new array + /// should be a values obtained by applying the mapping to the global id. + /// + /// + /// Every element of the positions array must not be less than the previous one. + /// If there are several elements with the same indices, the FIRST one of them will be at the common index. + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 0; 0; 1; 1; 1; 2; 3; 3; 4 |] + /// let valueMap = id + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 0; 2; 5; 6; 8 |] + /// + /// + /// Maps global id to a value + let initFirstOccurrence valueMap = Scatter.initFirstOccurrence valueMap + + /// + /// Creates a new array from the given one where it is indicated by the array of positions at which position in the new array + /// should be a values obtained by applying the mapping to the global id. + /// + /// + /// Every element of the positions array must not be less than the previous one. + /// If there are several elements with the same indices, the LAST one of them will be at the common index. + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 0; 0; 1; 1; 1; 2; 3; 3; 4 |] + /// let valueMap = id + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 1; 4; 5; 7; 8 |] + /// + /// + /// Maps global id to a value + let initLastOccurrence valueMap = Scatter.initLastOccurrence valueMap + + module PrefixSum = + /// + /// Exclude in-place prefix sum. + /// + /// + /// + /// let arr = [| 1; 1; 1; 1 |] + /// let sum = [| 0 |] + /// runExcludeInplace clContext workGroupSize processor arr sum (+) 0 + /// |> ignore + /// ... + /// > val arr = [| 0; 1; 2; 3 |] + /// > val sum = [| 4 |] + /// + /// + /// ClContext. + /// Should be a power of 2 and greater than 1. + /// Associative binary operation. + /// Zero element for binary operation. + let runExcludeInPlace plus = PrefixSum.runExcludeInPlace plus + + /// + /// Include in-place prefix sum. + /// + /// + /// + /// let arr = [| 1; 1; 1; 1 |] + /// let sum = [| 0 |] + /// runExcludeInplace clContext workGroupSize processor arr sum (+) 0 + /// |> ignore + /// ... + /// > val arr = [| 0; 1; 2; 3 |] + /// > val sum = [| 4 |] + /// + /// + /// Associative binary operation. + /// ClContext. + /// Should be a power of 2 and greater than 1. + /// Zero element for binary operation. + let runIncludeInPlace plus = PrefixSum.runIncludeInPlace plus + + /// + /// Exclude in-place prefix sum. Array is scanned starting from the end. + /// + /// Associative binary operation. + /// ClContext. + /// Should be a power of 2 and greater than 1. + /// Zero element for binary operation. + let runBackwardsExcludeInPlace plus = + PrefixSum.runBackwardsExcludeInPlace plus + + /// + /// Include in-place prefix sum. Array is scanned starting from the end. + /// + /// Associative binary operation. + /// ClContext. + /// Should be a power of 2 and greater than 1. + /// Zero element for binary operation. + let runBackwardsIncludeInPlace plus = + PrefixSum.runBackwardsIncludeInPlace plus + + /// + /// Exclude in-place prefix sum of integer array with addition operation and start value that is equal to 0. + /// + /// + /// + /// let arr = [| 1; 1; 1; 1 |] + /// let sum = [| 0 |] + /// runExcludeInplace clContext workGroupSize processor arr sum (+) 0 + /// |> ignore + /// ... + /// > val arr = [| 0; 1; 2; 3 |] + /// > val sum = [| 4 |] + /// + /// + let standardExcludeInPlace = PrefixSum.standardExcludeInPlace + + /// + /// Include in-place prefix sum of integer array with addition operation and start value that is equal to 0. + /// + /// + /// + /// let arr = [| 1; 1; 1; 1 |] + /// let sum = [| 0 |] + /// runIncludeInplace clContext workGroupSize processor arr sum (+) 0 + /// |> ignore + /// ... + /// > val arr = [| 1; 2; 3; 4 |] + /// > val sum = [| 4 |] + /// + /// + /// ClContext. + /// Should be a power of 2 and greater than 1. + let standardIncludeInPlace = PrefixSum.standardIncludeInPlace + + module ByKey = + /// + /// Exclude scan by key. + /// + /// + /// + /// let arr = [| 1; 1; 1; 1; 1; 1|] + /// let keys = [| 1; 2; 2; 2; 3; 3 |] + /// ... + /// > val result = [| 0; 0; 1; 2; 0; 1 |] + /// + /// + let sequentialExclude op = PrefixSum.ByKey.sequentialExclude op + + /// + /// Include scan by key. + /// + /// + /// + /// let arr = [| 1; 1; 1; 1; 1; 1|] + /// let keys = [| 1; 2; 2; 2; 3; 3 |] + /// ... + /// > val result = [| 1; 1; 2; 3; 1; 2 |] + /// + /// + let sequentialInclude op = PrefixSum.ByKey.sequentialInclude op + + module Reduce = + /// + /// Summarizes array elements. + /// + /// ClContext. + /// Work group size. + /// Summation operation. + /// Neutral element for summation. + let sum op zero (clContext: ClContext) workGroupSize = + Reduce.sum op zero clContext workGroupSize + + /// + /// Reduces an array of values. + /// + /// ClContext. + /// Work group size. + /// Reduction operation. + let reduce op (clContext: ClContext) workGroupSize = + Reduce.reduce op clContext workGroupSize + + /// + /// Reduction of an array of values by an array of keys. + /// + module ByKey = + /// + /// Reduces an array of values by key using a single work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result must be calculated in advance. + /// + let sequential (reduceOp: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = + Reduce.ByKey.sequential reduceOp clContext workGroupSize + + /// + /// Reduces values by key. Each segment is reduced by one work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result must be calculated in advance. + /// + let segmentSequential (reduceOp: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = + Reduce.ByKey.segmentSequential reduceOp clContext workGroupSize + + /// + /// Reduces values by key. One work group participates in the reduction. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// Reduces an array of values that does not exceed the size of the workgroup. + /// The length of the result must be calculated in advance. + /// + let oneWorkGroupSegments (reduceOp: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = + Reduce.ByKey.oneWorkGroupSegments reduceOp clContext workGroupSize + + module Option = + /// + /// Reduces values by key. Each segment is reduced by one work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result must be calculated in advance. + /// + let segmentSequential<'a> + (reduceOp: Expr<'a option -> 'a option -> 'a option>) + (clContext: ClContext) + workGroupSize + = + Reduce.ByKey.Option.segmentSequential reduceOp clContext workGroupSize + /// + /// Reduces values by key. Each segment is reduced by one work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result and offsets for each segment must be calculated in advance. + /// + let segmentSequentialByOffsets<'a> + (reduceOp: Expr<'a -> 'a -> 'a option>) + (clContext: ClContext) + workGroupSize + = + Reduce.ByKey.Option.segmentSequentialByOffsets reduceOp clContext workGroupSize + + module ByKey2D = + /// + /// Reduces an array of values by 2D keys using a single work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result must be calculated in advance. + /// + let sequential (reduceOp: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = + Reduce.ByKey2D.sequential reduceOp clContext workGroupSize + + /// + /// Reduces values by key. Each segment is reduced by one work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result must be calculated in advance. + /// + let segmentSequential (reduceOp: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = + Reduce.ByKey2D.segmentSequential reduceOp clContext workGroupSize + + module Option = + /// + /// Reduces values by key. Each segment is reduced by one work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + /// + /// The length of the result must be calculated in advance. + /// + let segmentSequential (reduceOp: Expr<'a -> 'a -> 'a option>) (clContext: ClContext) workGroupSize = + Reduce.ByKey2D.Option.segmentSequential reduceOp clContext workGroupSize diff --git a/src/GraphBLAS-sharp.Backend/Common/Gather.fs b/src/GraphBLAS-sharp.Backend/Common/Gather.fs index 791c88de..32d90859 100644 --- a/src/GraphBLAS-sharp.Backend/Common/Gather.fs +++ b/src/GraphBLAS-sharp.Backend/Common/Gather.fs @@ -2,7 +2,23 @@ namespace GraphBLAS.FSharp.Backend.Common open Brahma.FSharp -module internal Gather = +module Gather = + /// + /// Fills the given output array using the given value array and a function. The function maps old position + /// of each element of the value array to its position in the output array. + /// + /// + /// If index is out of bounds, the value will be ignored. + /// + /// + /// + /// let positions = [| 1; 0; 2; 6; 4; 3; 5 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// run clContext 32 processor positions values result + /// ... + /// > val result = [| 2.8; 1.9; 3.7; 7.3; 5.5; 4.6; 6.4 |] + /// + /// let runInit positionMap (clContext: ClContext) workGroupSize = let gather = @@ -30,14 +46,19 @@ module internal Gather = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) /// - /// Creates a new array obtained from positions replaced with values from the given array at these positions (indices). + /// Fills the given output array using the given value and position arrays. Array of positions indicates + /// which element from the value array should be in each position of the output array. /// + /// + /// If index is out of bounds, the value will be ignored. + /// /// /// - /// let positions = [| 2; 0; 2; 1 |] - /// let array = [| 1.4; 2.5; 3.6 |] + /// let positions = [| 1; 0; 2; 6; 4; 3; 5 |] + /// let values = [| 1.9; 2.8; 3.7; 4.6; 5.5; 6.4; 7.3; |] + /// run clContext 32 processor positions values result /// ... - /// > val result = [| 3.6; 1.4; 3.6; 2.5 |] + /// > val result = [| 2.8; 1.9; 3.7; 7.3; 5.5; 4.6; 6.4 |] /// /// let run (clContext: ClContext) workGroupSize = diff --git a/src/GraphBLAS-sharp.Backend/Common/Map.fs b/src/GraphBLAS-sharp.Backend/Common/Map.fs new file mode 100644 index 00000000..f22f0f6b --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Common/Map.fs @@ -0,0 +1,141 @@ +namespace GraphBLAS.FSharp.Backend.Common + +open Brahma.FSharp +open Microsoft.FSharp.Quotations +open GraphBLAS.FSharp.Objects.ClContextExtensions + +module Map = + /// + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. + /// + /// The function to transform elements of the array. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map<'a, 'b> (op: Expr<'a -> 'b>) (clContext: ClContext) workGroupSize = + + let map = + <@ fun (ndRange: Range1D) lenght (inputArray: ClArray<'a>) (result: ClArray<'b>) -> + + let gid = ndRange.GlobalID0 + + if gid < lenght then + result.[gid] <- (%op) inputArray.[gid] @> + + let kernel = clContext.Compile map + + fun (processor: MailboxProcessor<_>) allocationMode (inputArray: ClArray<'a>) -> + + let result = + clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, inputArray.Length) + + let ndRange = + Range1D.CreateValid(inputArray.Length, workGroupSize) + + let kernel = kernel.GetKernel() + + processor.Post(Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange inputArray.Length inputArray result)) + + processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + + result + + /// + /// Builds a new array whose elements are the results of applying the given function + /// to the corresponding pairs of values, where the first element of pair is from the given array + /// and the second element is the given value. + /// + /// The function to transform elements of the array. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let mapWithValue<'a, 'b, 'c> (clContext: ClContext) workGroupSize (op: Expr<'a -> 'b -> 'c>) = + + let map = + <@ fun (ndRange: Range1D) lenght (value: ClCell<'a>) (inputArray: ClArray<'b>) (result: ClArray<'c>) -> + + let gid = ndRange.GlobalID0 + + if gid < lenght then + result.[gid] <- (%op) value.Value inputArray.[gid] @> + + let kernel = clContext.Compile map + + fun (processor: MailboxProcessor<_>) allocationMode (value: 'a) (inputArray: ClArray<'b>) -> + + let result = + clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, inputArray.Length) + + let valueClCell = value |> clContext.CreateClCell + + let ndRange = + Range1D.CreateValid(inputArray.Length, workGroupSize) + + let kernel = kernel.GetKernel() + + processor.Post( + Msg.MsgSetArguments(fun () -> kernel.KernelFunc ndRange inputArray.Length valueClCell inputArray result) + ) + + processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + + result + + /// + /// Fills the third given array with the results of applying the given function + /// to the corresponding elements of the first two given arrays pairwise. + /// + /// + /// The first two input arrays must have the same lengths. + /// + /// The function to transform the pairs of the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2InPlace<'a, 'b, 'c> (map: Expr<'a -> 'b -> 'c>) (clContext: ClContext) workGroupSize = + + let kernel = + <@ fun (ndRange: Range1D) length (leftArray: ClArray<'a>) (rightArray: ClArray<'b>) (resultArray: ClArray<'c>) -> + + let gid = ndRange.GlobalID0 + + if gid < length then + + resultArray.[gid] <- (%map) leftArray.[gid] rightArray.[gid] @> + + let kernel = clContext.Compile kernel + + fun (processor: MailboxProcessor<_>) (leftArray: ClArray<'a>) (rightArray: ClArray<'b>) (resultArray: ClArray<'c>) -> + + let ndRange = + Range1D.CreateValid(resultArray.Length, workGroupSize) + + let kernel = kernel.GetKernel() + + processor.Post( + Msg.MsgSetArguments + (fun () -> kernel.KernelFunc ndRange resultArray.Length leftArray rightArray resultArray) + ) + + processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + + /// + /// Builds a new array whose elements are the results of applying the given function + /// to the corresponding elements of the two given arrays pairwise. + /// + /// + /// The two input arrays must have the same lengths. + /// + /// The function to transform the pairs of the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2<'a, 'b, 'c> map (clContext: ClContext) workGroupSize = + let map2 = + map2InPlace<'a, 'b, 'c> map clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (leftArray: ClArray<'a>) (rightArray: ClArray<'b>) -> + + let resultArray = + clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, leftArray.Length) + + map2 processor leftArray rightArray resultArray + + resultArray diff --git a/src/GraphBLAS-sharp.Backend/Common/Merge.fs b/src/GraphBLAS-sharp.Backend/Common/Merge.fs deleted file mode 100644 index 07199ef2..00000000 --- a/src/GraphBLAS-sharp.Backend/Common/Merge.fs +++ /dev/null @@ -1,144 +0,0 @@ -namespace GraphBLAS.FSharp.Backend.Common - -open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ClContext - -module Merge = - let run<'a, 'b when 'a: struct and 'b: struct and 'a: comparison> (clContext: ClContext) workGroupSize = - - let defaultValue = Unchecked.defaultof<'a> - - let merge = - <@ fun (ndRange: Range1D) (firstSide: int) (secondSide: int) (sumOfSides: int) (firstValues: ClArray<'a>) (secondValues: ClArray<'a>) (resultValues: ClArray<'a>) -> - - let gid = ndRange.GlobalID0 - let lid = ndRange.LocalID0 - - let mutable beginIdxLocal = local () - let mutable endIdxLocal = local () - - if lid < 2 then - // (n - 1) * wgSize - 1 for lid = 0 - // n * wgSize - 1 for lid = 1 - // where n in 1 .. wgGroupCount - let x = lid * (workGroupSize - 1) + gid - 1 - - let diagonalNumber = min (sumOfSides - 1) x - - let mutable leftEdge = max 0 (diagonalNumber + 1 - secondSide) - - let mutable rightEdge = min (firstSide - 1) diagonalNumber - - while leftEdge <= rightEdge do - let middleIdx = (leftEdge + rightEdge) / 2 - - let firstIndex = firstValues.[middleIdx] - - let secondIndex = - secondValues.[diagonalNumber - middleIdx] - - if firstIndex <= secondIndex then - leftEdge <- middleIdx + 1 - else - rightEdge <- middleIdx - 1 - - // Here localID equals either 0 or 1 - if lid = 0 then - beginIdxLocal <- leftEdge - else - endIdxLocal <- leftEdge - - barrierLocal () - - let beginIdx = beginIdxLocal - let endIdx = endIdxLocal - let firstLocalLength = endIdx - beginIdx - - let mutable x = workGroupSize - firstLocalLength - - if endIdx = firstSide then - x <- secondSide - gid + lid + beginIdx - - let secondLocalLength = x - - //First indices are from 0 to firstLocalLength - 1 inclusive - //Second indices are from firstLocalLength to firstLocalLength + secondLocalLength - 1 inclusive - let localIndices = localArray<'a> workGroupSize - - if lid < firstLocalLength then - localIndices.[lid] <- firstValues.[beginIdx + lid] - - if lid < secondLocalLength then - localIndices.[firstLocalLength + lid] <- secondValues.[gid - beginIdx] - - barrierLocal () - - if gid < sumOfSides then - let mutable leftEdge = lid + 1 - secondLocalLength - if leftEdge < 0 then leftEdge <- 0 - - let mutable rightEdge = firstLocalLength - 1 - - rightEdge <- min rightEdge lid - - while leftEdge <= rightEdge do - let middleIdx = (leftEdge + rightEdge) / 2 - let firstIndex = localIndices.[middleIdx] - - let secondIndex = - localIndices.[firstLocalLength + lid - middleIdx] - - if firstIndex <= secondIndex then - leftEdge <- middleIdx + 1 - else - rightEdge <- middleIdx - 1 - - let boundaryX = rightEdge - let boundaryY = lid - leftEdge - - // boundaryX and boundaryY can't be off the right edge of array (only off the left edge) - let isValidX = boundaryX >= 0 - let isValidY = boundaryY >= 0 - - let mutable fstIdx = defaultValue - - if isValidX then - fstIdx <- localIndices.[boundaryX] - - let mutable sndIdx = defaultValue - - if isValidY then - sndIdx <- localIndices.[firstLocalLength + boundaryY] - - if not isValidX || isValidY && fstIdx <= sndIdx then - resultValues.[gid] <- sndIdx - else - resultValues.[gid] <- fstIdx @> - - let kernel = clContext.Compile merge - - fun (processor: MailboxProcessor<_>) (firstValues: ClArray<'a>) (secondValues: ClArray<'a>) -> - - let firstSide = firstValues.Length - - let secondSide = secondValues.Length - - let sumOfSides = firstSide + secondSide - - let resultValues = - clContext.CreateClArrayWithSpecificAllocationMode<'a>(DeviceOnly, sumOfSides) - - let ndRange = - Range1D.CreateValid(sumOfSides, workGroupSize) - - let kernel = kernel.GetKernel() - - processor.Post( - Msg.MsgSetArguments - (fun () -> - kernel.KernelFunc ndRange firstSide secondSide sumOfSides firstValues secondValues resultValues) - ) - - processor.Post(Msg.CreateRunMsg<_, _>(kernel)) - - resultValues diff --git a/src/GraphBLAS-sharp.Backend/Common/PrefixSum.fs b/src/GraphBLAS-sharp.Backend/Common/PrefixSum.fs index 09cdfb5d..a56af91f 100644 --- a/src/GraphBLAS-sharp.Backend/Common/PrefixSum.fs +++ b/src/GraphBLAS-sharp.Backend/Common/PrefixSum.fs @@ -3,8 +3,8 @@ namespace GraphBLAS.FSharp.Backend.Common open Brahma.FSharp open FSharp.Quotations open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions module PrefixSum = let private update (opAdd: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = @@ -209,7 +209,7 @@ module PrefixSum = let runBackwardsIncludeInPlace plus = runInPlace plus true scanInclusive /// - /// Exclude inplace prefix sum. + /// Exclude in-place prefix sum of integer array with addition operation and start value that is equal to 0. /// /// /// @@ -222,10 +222,8 @@ module PrefixSum = /// > val sum = [| 4 |] /// /// - ///ClContext. - ///Should be a power of 2 and greater than 1. - ///Associative binary operation. - ///Zero element for binary operation. + /// ClContext. + /// Should be a power of 2 and greater than 1. let standardExcludeInPlace (clContext: ClContext) workGroupSize = let scan = @@ -236,23 +234,21 @@ module PrefixSum = scan processor inputArray 0 /// - /// Include inplace prefix sum. + /// Include in-place prefix sum of integer array with addition operation and start value that is equal to 0. /// /// /// /// let arr = [| 1; 1; 1; 1 |] /// let sum = [| 0 |] - /// runExcludeInplace clContext workGroupSize processor arr sum (+) 0 + /// runIncludeInplace clContext workGroupSize processor arr sum (+) 0 /// |> ignore /// ... /// > val arr = [| 1; 2; 3; 4 |] /// > val sum = [| 4 |] /// /// - ///ClContext. - ///Should be a power of 2 and greater than 1. - ///Associative binary operation. - ///Zero element for binary operation. + /// ClContext. + /// Should be a power of 2 and greater than 1. let standardIncludeInPlace (clContext: ClContext) workGroupSize = let scan = diff --git a/src/GraphBLAS-sharp.Backend/Common/Scatter.fs b/src/GraphBLAS-sharp.Backend/Common/Scatter.fs index 4f51cb93..82980465 100644 --- a/src/GraphBLAS-sharp.Backend/Common/Scatter.fs +++ b/src/GraphBLAS-sharp.Backend/Common/Scatter.fs @@ -3,7 +3,7 @@ namespace GraphBLAS.FSharp.Backend.Common open Brahma.FSharp open GraphBLAS.FSharp.Backend.Quotes -module internal Scatter = +module Scatter = let private general<'a> predicate (clContext: ClContext) workGroupSize = let run = @@ -46,7 +46,8 @@ module internal Scatter = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) /// - /// Creates a new array from the given one where it is indicated by the array of positions at which position in the new array + /// Creates a new array from the given one where it is indicated + /// by the array of positions at which position in the new array /// should be a value from the given one. /// /// @@ -147,7 +148,7 @@ module internal Scatter = /// /// /// Maps global id to a value - let initFirsOccurrence<'a> valueMap = + let initFirstOccurrence<'a> valueMap = generalInit<'a> <| Predicates.firstOccurrence () <| valueMap diff --git a/src/GraphBLAS-sharp.Backend/Common/Sort/Bitonic.fs b/src/GraphBLAS-sharp.Backend/Common/Sort/Bitonic.fs index db833874..f51e94ce 100644 --- a/src/GraphBLAS-sharp.Backend/Common/Sort/Bitonic.fs +++ b/src/GraphBLAS-sharp.Backend/Common/Sort/Bitonic.fs @@ -3,7 +3,7 @@ namespace GraphBLAS.FSharp.Backend.Common.Sort open Brahma.FSharp open GraphBLAS.FSharp.Backend.Common -module internal Bitonic = +module Bitonic = let private localBegin (clContext: ClContext) workGroupSize = let processedSize = workGroupSize * 2 diff --git a/src/GraphBLAS-sharp.Backend/Common/Sort/Radix.fs b/src/GraphBLAS-sharp.Backend/Common/Sort/Radix.fs index feafce5e..b7db92d0 100644 --- a/src/GraphBLAS-sharp.Backend/Common/Sort/Radix.fs +++ b/src/GraphBLAS-sharp.Backend/Common/Sort/Radix.fs @@ -2,18 +2,19 @@ namespace GraphBLAS.FSharp.Backend.Common.Sort open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions -module Radix = +module internal Radix = // the number of bits considered per iteration - let defaultBitCount = 4 + let private defaultBitCount = 4 - let keyBitCount = 32 + let private keyBitCount = 32 - let localPrefixSum = + let private localPrefixSum = <@ fun (lid: int) (workGroupSize: int) (array: int []) -> let mutable offset = 1 @@ -29,7 +30,7 @@ module Radix = barrierLocal () array.[lid] <- value @> - let count (clContext: ClContext) workGroupSize mask = + let private count (clContext: ClContext) workGroupSize mask = let bitCount = mask + 1 @@ -108,7 +109,7 @@ module Radix = globalOffsets, localOffsets - let scatter (clContext: ClContext) workGroupSize mask = + let private scatter (clContext: ClContext) workGroupSize mask = let kernel = <@ fun (ndRange: Range1D) length (keys: ClArray) (shift: ClCell) (workGroupCount: ClCell) (globalOffsets: ClArray) (localOffsets: ClArray) (result: ClArray) -> @@ -147,7 +148,7 @@ module Radix = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) - let runKeysOnly (clContext: ClContext) workGroupSize bitCount = + let private runKeysOnly (clContext: ClContext) workGroupSize bitCount = let copy = ClArray.copy clContext workGroupSize let mask = (pown 2 bitCount) - 1 @@ -198,7 +199,7 @@ module Radix = let standardRunKeysOnly clContext workGroupSize = runKeysOnly clContext workGroupSize defaultBitCount - let scatterByKey (clContext: ClContext) workGroupSize mask = + let private scatterByKey (clContext: ClContext) workGroupSize mask = let kernel = <@ fun (ndRange: Range1D) length (keys: ClArray) (values: ClArray<'a>) (shift: ClCell) (workGroupCount: ClCell) (globalOffsets: ClArray) (localOffsets: ClArray) (resultKeys: ClArray) (resultValues: ClArray<'a>) -> @@ -248,7 +249,7 @@ module Radix = processor.Post(Msg.CreateRunMsg<_, _>(kernel)) - let runByKeys (clContext: ClContext) workGroupSize bitCount = + let private runByKeys (clContext: ClContext) workGroupSize bitCount = let copy = ClArray.copy clContext workGroupSize let dataCopy = ClArray.copy clContext workGroupSize @@ -268,7 +269,7 @@ module Radix = failwith "Mismatch of key lengths and value. Lengths must be the same" if values.Length <= 1 then - dataCopy processor allocationMode values + copy processor DeviceOnly keys, dataCopy processor DeviceOnly values else let firstKeys = copy processor DeviceOnly keys @@ -322,11 +323,22 @@ module Radix = localOffset.Free processor shift.Free processor - (fst keysPair).Free processor (snd keysPair).Free processor (snd valuesPair).Free processor - (fst valuesPair) + (fst keysPair, fst valuesPair) + + let runByKeysStandardValuesOnly clContext workGroupSize = + let runByKeys = + runByKeys clContext workGroupSize defaultBitCount + + fun (processor: MailboxProcessor<_>) allocationMode (keys: ClArray) (values: ClArray<'a>) -> + let keys, values = + runByKeys processor allocationMode keys values + + keys.Free processor + + values let runByKeysStandard clContext workGroupSize = runByKeys clContext workGroupSize defaultBitCount diff --git a/src/GraphBLAS-sharp.Backend/Common/Sum.fs b/src/GraphBLAS-sharp.Backend/Common/Sum.fs index 07d64a27..94a745c2 100644 --- a/src/GraphBLAS-sharp.Backend/Common/Sum.fs +++ b/src/GraphBLAS-sharp.Backend/Common/Sum.fs @@ -1,12 +1,12 @@ namespace GraphBLAS.FSharp.Backend.Common open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Quotes open Microsoft.FSharp.Control open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions module Reduce = /// @@ -133,7 +133,7 @@ module Reduce = resultCell /// - /// Summarize array elements. + /// Summarizes array elements. /// /// ClContext. /// Work group size. @@ -237,7 +237,7 @@ module Reduce = resultCell /// - /// Reduce an array of values. + /// Reduces an array of values. /// /// ClContext. /// Work group size. @@ -259,7 +259,7 @@ module Reduce = /// module ByKey = /// - /// Reduce an array of values by key using a single work item. + /// Reduces an array of values by key using a single work item. /// /// ClContext. /// Work group size. @@ -428,7 +428,7 @@ module Reduce = let itemKeyId = lid + 1 let startKeyIndex = - (%Search.Bin.lowerPosition) length itemKeyId localBitmap + (%Search.Bin.lowerPositionLocal) length itemKeyId localBitmap match startKeyIndex with | Some startPosition -> @@ -473,6 +473,135 @@ module Reduce = reducedValues, reducedKeys module Option = + /// + /// Reduces values by key. Each segment is reduced by one work item. + /// + /// ClContext. + /// Work group size. + /// Operation for reducing values. + let segmentSequential<'a> + (reduceOp: Expr<'a option -> 'a option -> 'a option>) + (clContext: ClContext) + workGroupSize + = + + let kernel = + <@ fun (ndRange: Range1D) uniqueKeyCount keysLength (offsets: ClArray) (keys: ClArray) (values: ClArray<'a option>) (reducedValues: ClArray<'a>) (firstReducedKeys: ClArray) (resultPositions: ClArray) -> + + let gid = ndRange.GlobalID0 + + if gid < uniqueKeyCount then + let startPosition = + (%Search.Bin.lowerPosition) keysLength gid offsets + + match startPosition with + | Some startPosition -> + let firstSourceKey = keys.[startPosition] + + let mutable sum = None + + let mutable currentPosition = startPosition + + while currentPosition < keysLength + && firstSourceKey = keys.[currentPosition] do + let result = (%reduceOp) sum values.[currentPosition] // brahma error + sum <- result + currentPosition <- currentPosition + 1 + + match sum with + | Some value -> + reducedValues.[gid] <- value + resultPositions.[gid] <- 1 + | None -> resultPositions.[gid] <- 0 + + firstReducedKeys.[gid] <- firstSourceKey + | None -> () @> // not possible if done correctly + + let kernel = clContext.Compile kernel + + let getUniqueBitmap = + Bitmap.lastOccurrence clContext workGroupSize + + let scatterData = + Scatter.lastOccurrence clContext workGroupSize + + let scatterIndices = + Scatter.lastOccurrence clContext workGroupSize + + let prefixSum = + PrefixSum.standardExcludeInPlace clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (keys: ClArray) (values: ClArray<'a option>) -> + + let offsets = + getUniqueBitmap processor DeviceOnly keys + + let uniqueKeysCount = + (prefixSum processor offsets) + .ToHostAndFree processor + + let reducedValues = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, uniqueKeysCount) + + let reducedKeys = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, uniqueKeysCount) + + let resultPositions = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, uniqueKeysCount) + + let ndRange = + Range1D.CreateValid(uniqueKeysCount, workGroupSize) + + let kernel = kernel.GetKernel() + + processor.Post( + Msg.MsgSetArguments + (fun () -> + kernel.KernelFunc + ndRange + uniqueKeysCount + keys.Length + offsets + keys + values + reducedValues + reducedKeys + resultPositions) + ) + + processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + + offsets.Free processor + + let resultLength = + (prefixSum processor resultPositions) + .ToHostAndFree processor + + if resultLength = 0 then + reducedValues.Free processor + reducedKeys.Free processor + resultPositions.Free processor + None + else + // write values + let resultValues = + clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, resultLength) + + scatterData processor resultPositions reducedValues resultValues + + reducedValues.Free processor + + // write keys + let resultKeys = + clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, resultLength) + + scatterIndices processor resultPositions reducedKeys resultKeys + + reducedKeys.Free processor + resultPositions.Free processor + + Some(resultValues, resultKeys) + /// /// Reduces values by key. Each segment is reduced by one work item. /// @@ -480,9 +609,13 @@ module Reduce = /// Work group size. /// Operation for reducing values. /// - /// The length of the result must be calculated in advance. + /// The length of the result and offsets for each segment must be calculated in advance. /// - let segmentSequential<'a> (reduceOp: Expr<'a -> 'a -> 'a option>) (clContext: ClContext) workGroupSize = + let segmentSequentialByOffsets<'a> + (reduceOp: Expr<'a -> 'a -> 'a option>) + (clContext: ClContext) + workGroupSize + = let kernel = <@ fun (ndRange: Range1D) uniqueKeyCount keysLength (offsets: ClArray) (keys: ClArray) (values: ClArray<'a>) (reducedValues: ClArray<'a>) (firstReducedKeys: ClArray) (resultPositions: ClArray) -> @@ -595,7 +728,7 @@ module Reduce = module ByKey2D = /// - /// Reduce an array of values by 2D keys using a single work item. + /// Reduces an array of values by 2D keys using a single work item. /// /// ClContext. /// Work group size. diff --git a/src/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.fsproj b/src/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.fsproj index 4709660f..c90f4cb7 100644 --- a/src/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.fsproj +++ b/src/GraphBLAS-sharp.Backend/GraphBLAS-sharp.Backend.fsproj @@ -1,4 +1,4 @@ - + @@ -17,7 +17,7 @@ - + @@ -27,25 +27,27 @@ - + + + + - - + + - @@ -55,14 +57,20 @@ - - - - + + + + + + + + + + diff --git a/src/GraphBLAS-sharp.Backend/Matrix/COO/Map.fs b/src/GraphBLAS-sharp.Backend/Matrix/COO/Map.fs index 7700b476..9b9377f0 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/COO/Map.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/COO/Map.fs @@ -5,13 +5,13 @@ open Brahma.FSharp open GraphBLAS.FSharp.Backend.Matrix open GraphBLAS.FSharp.Backend.Quotes open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions module internal Map = - let preparePositions<'a, 'b> opAdd (clContext: ClContext) workGroupSize = + let private preparePositions<'a, 'b> opAdd (clContext: ClContext) workGroupSize = let preparePositions (op: Expr<'a option -> 'b option>) = <@ fun (ndRange: Range1D) rowCount columnCount valuesLength (values: ClArray<'a>) (rows: ClArray) (columns: ClArray) (resultBitmap: ClArray) (resultValues: ClArray<'b>) (resultRows: ClArray) (resultColumns: ClArray) -> @@ -84,13 +84,13 @@ module internal Map = resultBitmap, resultValues, resultRows, resultColumns let run<'a, 'b when 'a: struct and 'b: struct and 'b: equality> - (opAdd: Expr<'a option -> 'b option>) + (op: Expr<'a option -> 'b option>) (clContext: ClContext) workGroupSize = let map = - preparePositions opAdd clContext workGroupSize + preparePositions op clContext workGroupSize let setPositions = Common.setPositions<'b> clContext workGroupSize diff --git a/src/GraphBLAS-sharp.Backend/Matrix/COO/Map2.fs b/src/GraphBLAS-sharp.Backend/Matrix/COO/Map2.fs index 3d79eb9a..a728d546 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/COO/Map2.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/COO/Map2.fs @@ -1,17 +1,17 @@ namespace GraphBLAS.FSharp.Backend.Matrix.COO open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Matrix open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Backend.Matrix module internal Map2 = - let preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = + let private preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = let preparePositions (op: Expr<'a option -> 'b option -> 'c option>) = <@ fun (ndRange: Range1D) rowCount columnCount leftValuesLength rightValuesLength (leftValues: ClArray<'a>) (leftRows: ClArray) (leftColumns: ClArray) (rightValues: ClArray<'b>) (rightRows: ClArray) (rightColumn: ClArray) (resultBitmap: ClArray) (resultValues: ClArray<'c>) (resultRows: ClArray) (resultColumns: ClArray) -> @@ -135,7 +135,7 @@ module internal Map2 = Values = resultValues } module AtLeastOne = - let preparePositionsAtLeastOne<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality> + let private preparePositionsAtLeastOne<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality> (clContext: ClContext) (opAdd: Expr<'a option -> 'b option -> 'c option>) workGroupSize diff --git a/src/GraphBLAS-sharp.Backend/Matrix/COO/Matrix.fs b/src/GraphBLAS-sharp.Backend/Matrix/COO/Matrix.fs index fd0fc338..327a1b45 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/COO/Matrix.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/COO/Matrix.fs @@ -1,23 +1,49 @@ namespace GraphBLAS.FSharp.Backend.Matrix.COO open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Quotes open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions module Matrix = + /// + /// Builds a new COO matrix whose elements are the results of applying the given function + /// to each of the elements of the matrix. + /// + /// + /// A function to transform values of the input matrix. + /// Operand and result types should be optional to distinguish explicit and implicit zeroes + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let map = Map.run + /// + /// Builds a new COO matrix whose values are the results of applying the given function + /// to the corresponding pairs of values from the two matrices. + /// + /// + /// A function to transform pairs of values from the input matrices. + /// Operands and result types should be optional to distinguish explicit and implicit zeroes + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let map2 = Map2.run - ///. - ///. - ///Should be a power of 2 and greater than 1. + /// + /// Builds a new COO matrix whose values are the results of applying the given function + /// to the corresponding pairs of values from the two matrices. + /// + /// + /// A function to transform pairs of values from the input matrices. + /// Operation assumption: one of the operands should always be non-zero. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let rec map2AtLeastOne<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality> (clContext: ClContext) (opAdd: Expr -> 'c option>) @@ -26,6 +52,11 @@ module Matrix = Map2.AtLeastOne.run clContext (Convert.atLeastOneToOption opAdd) workGroupSize + /// + /// Converts COO matrix format to Tuple. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let getTuples (clContext: ClContext) workGroupSize = let copy = ClArray.copy clContext workGroupSize @@ -48,6 +79,11 @@ module Matrix = ColumnIndices = resultColumns Values = resultValues } + /// + /// Converts rows of given COO matrix to rows in CSR format of the same matrix. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let private compressRows (clContext: ClContext) workGroupSize = let compressRows = @@ -66,7 +102,7 @@ module Matrix = let create = ClArray.create clContext workGroupSize let scan = - PrefixSum.runBackwardsIncludeInPlace <@ min @> clContext workGroupSize + Common.PrefixSum.runBackwardsIncludeInPlace <@ min @> clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (rowIndices: ClArray) rowCount -> @@ -85,6 +121,12 @@ module Matrix = rowPointers + /// + /// Converts the given COO matrix to CSR format. + /// Values and columns are copied and do not depend on input COO matrix anymore. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toCSR (clContext: ClContext) workGroupSize = let prepare = compressRows clContext workGroupSize @@ -109,6 +151,12 @@ module Matrix = Columns = cols Values = values } + /// + /// Converts the given COO matrix to CSR format. + /// Values and columns are NOT copied and still depend on the input COO matrix. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toCSRInPlace (clContext: ClContext) workGroupSize = let prepare = compressRows clContext workGroupSize @@ -125,10 +173,16 @@ module Matrix = Columns = matrix.Columns Values = matrix.Values } + /// + /// Transposes the given matrix and returns result. + /// The given matrix should neither be used afterwards nor be disposed. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let transposeInPlace (clContext: ClContext) workGroupSize = let sort = - Sort.Bitonic.sortKeyValuesInplace clContext workGroupSize + Common.Sort.Bitonic.sortKeyValuesInplace clContext workGroupSize fun (queue: MailboxProcessor<_>) (matrix: ClMatrix.COO<'a>) -> sort queue matrix.Columns matrix.Rows matrix.Values @@ -140,6 +194,11 @@ module Matrix = Columns = matrix.Rows Values = matrix.Values } + /// + /// Transposes the given matrix and returns result as a new matrix. + /// + ///OpenCL context. + ///Should be a power of 2 and greater than 1. let transpose (clContext: ClContext) workGroupSize = let transposeInPlace = transposeInPlace clContext workGroupSize diff --git a/src/GraphBLAS-sharp.Backend/Matrix/COO/Merge.fs b/src/GraphBLAS-sharp.Backend/Matrix/COO/Merge.fs index e9cbf08d..5e847976 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/COO/Merge.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/COO/Merge.fs @@ -1,8 +1,8 @@ namespace GraphBLAS.FSharp.Backend.Matrix.COO open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects module Merge = let run<'a, 'b when 'a: struct and 'b: struct> (clContext: ClContext) workGroupSize = diff --git a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map.fs b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map.fs index a6c2b077..8d068d09 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map.fs @@ -5,14 +5,14 @@ open FSharp.Quotations open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions module internal Map = - let preparePositions<'a, 'b> op (clContext: ClContext) workGroupSize = + let private preparePositions<'a, 'b> op (clContext: ClContext) workGroupSize = let preparePositions (op: Expr<'a option -> 'b option>) = <@ fun (ndRange: Range1D) rowCount columnCount (values: ClArray<'a>) (rowPointers: ClArray) (columns: ClArray) (resultBitmap: ClArray) (resultValues: ClArray<'b>) (resultRows: ClArray) (resultColumns: ClArray) -> @@ -83,13 +83,13 @@ module internal Map = resultBitmap, resultValues, resultRows, resultColumns let run<'a, 'b when 'a: struct and 'b: struct and 'b: equality> - (opAdd: Expr<'a option -> 'b option>) + (op: Expr<'a option -> 'b option>) (clContext: ClContext) workGroupSize = let map = - preparePositions opAdd clContext workGroupSize + preparePositions op clContext workGroupSize let setPositions = Common.setPositions<'b> clContext workGroupSize @@ -115,7 +115,7 @@ module internal Map = Values = resultValues } module WithValue = - let preparePositions<'a, 'b, 'c when 'b: struct> (clContext: ClContext) workGroupSize op = + let private preparePositions<'a, 'b, 'c when 'b: struct> (clContext: ClContext) workGroupSize op = let preparePositions (op: Expr<'a option -> 'b option -> 'c option>) = <@ fun (ndRange: Range1D) (operand: ClCell<'a option>) rowCount columnCount (values: ClArray<'b>) (rowPointers: ClArray) (columns: ClArray) (resultBitmap: ClArray) (resultValues: ClArray<'c>) (resultRows: ClArray) (resultColumns: ClArray) -> diff --git a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map2.fs b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map2.fs index bfd5f161..70599c16 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map2.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Map2.fs @@ -5,13 +5,12 @@ open Microsoft.FSharp.Quotations open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Matrix open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Matrix.COO +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions module internal Map2 = - let preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = + let private preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = let preparePositions (op: Expr<'a option -> 'b option -> 'c option>) = <@ fun (ndRange: Range1D) rowCount columnCount (leftValues: ClArray<'a>) (leftRowPointers: ClArray) (leftColumns: ClArray) (rightValues: ClArray<'b>) (rightRowPointers: ClArray) (rightColumn: ClArray) (resultBitmap: ClArray) (resultValues: ClArray<'c>) (resultRows: ClArray) (resultColumns: ClArray) -> @@ -136,7 +135,7 @@ module internal Map2 = Values = resultValues } module AtLeastOne = - let preparePositions<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality> + let private preparePositions<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality> (opAdd: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize @@ -205,8 +204,7 @@ module internal Map2 = workGroupSize = - let merge = - GraphBLAS.FSharp.Backend.Matrix.CSR.Merge.run clContext workGroupSize + let merge = Merge.run clContext workGroupSize let preparePositions = preparePositions opAdd clContext workGroupSize diff --git a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Matrix.fs b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Matrix.fs index 22171912..5cc805f9 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Matrix.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Matrix.fs @@ -1,18 +1,22 @@ namespace GraphBLAS.FSharp.Backend.Matrix.CSR open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Matrix open GraphBLAS.FSharp.Backend.Quotes open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClVector -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions - +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Objects.ArraysExtensions module Matrix = + /// + /// Converts rows of given CSR matrix to rows in COO format of the same matrix. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let expandRowPointers (clContext: ClContext) workGroupSize = let kernel = @@ -53,6 +57,11 @@ module Matrix = rows + /// + /// Gets an element from the given matrix on the input position. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let item<'a when 'a: struct> (clContext: ClContext) workGroupSize = let kernel = @@ -92,6 +101,11 @@ module Matrix = result + /// + /// Returns matrix composed of all elements from the given row range of the input matrix. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let subRows (clContext: ClContext) workGroupSize = let kernel = @@ -174,6 +188,12 @@ module Matrix = Columns = columns Values = values } + /// + /// Converts the given CSR matrix to COO format. + /// Values and columns are copied and do not depend on input CSR matrix anymore. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toCOO (clContext: ClContext) workGroupSize = let prepare = expandRowPointers clContext workGroupSize @@ -198,6 +218,12 @@ module Matrix = Columns = cols Values = values } + /// + /// Converts the given CSR matrix to COO format. + /// Values and columns are NOT copied and still depend on input CSR matrix. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toCOOInPlace (clContext: ClContext) workGroupSize = let prepare = expandRowPointers clContext workGroupSize @@ -214,10 +240,40 @@ module Matrix = Columns = matrix.Columns Values = matrix.Values } + /// + /// Builds a new COO matrix whose elements are the results of applying the given function + /// to each of the elements of the matrix. + /// + /// + /// A function to transform values of the input matrix. + /// Operand and result types should be optional to distinguish explicit and implicit zeroes + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let map = CSR.Map.run + /// + /// Builds a new COO matrix whose values are the results of applying the given function + /// to the corresponding pairs of values from the two matrices. + /// + /// + /// A function to transform pairs of values from the input matrices. + /// Operands and result types should be optional to distinguish explicit and implicit zeroes + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let map2 = Map2.run + /// + /// Builds a new COO matrix whose values are the results of applying the given function + /// to the corresponding pairs of values from the two matrices. + /// + /// + /// A function to transform pairs of values from the input matrices. + /// Operation assumption: one of the operands should always be non-zero. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let map2AtLeastOne<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct and 'c: equality> (clContext: ClContext) (opAdd: Expr -> 'c option>) @@ -226,6 +282,12 @@ module Matrix = Map2.AtLeastOne.run (Convert.atLeastOneToOption opAdd) clContext workGroupSize + /// + /// Transposes the given matrix and returns result. + /// The given matrix should neither be used afterwards nor be disposed. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let transposeInPlace (clContext: ClContext) workGroupSize = let toCOOInPlace = toCOOInPlace clContext workGroupSize @@ -241,6 +303,11 @@ module Matrix = |> transposeInPlace queue |> toCSRInPlace queue allocationMode + /// + /// Transposes the given matrix and returns result as a new matrix. + /// + ///OpenCL context. + ///Should be a power of 2 and greater than 1. let transpose (clContext: ClContext) workGroupSize = let toCOO = toCOO clContext workGroupSize @@ -256,6 +323,11 @@ module Matrix = |> transposeInPlace queue |> toCSRInPlace queue allocationMode + /// + /// Represents the given matrix as Seq of optional sparse vectors, that are computed lazily. + /// + ///OpenCL context. + ///Should be a power of 2 and greater than 1. let byRowsLazy (clContext: ClContext) workGroupSize = let getChunkValues = ClArray.sub clContext workGroupSize @@ -291,6 +363,11 @@ module Matrix = else None)) + /// + /// Represents the given matrix as Seq of optional sparse vectors. + /// + ///OpenCL context. + ///Should be a power of 2 and greater than 1. let byRows (clContext: ClContext) workGroupSize = let runLazy = byRowsLazy clContext workGroupSize @@ -299,6 +376,11 @@ module Matrix = runLazy processor allocationMode matrix |> Seq.map (fun lazyValue -> lazyValue.Value) + /// + /// Converts the given CSR matrix to LIL format. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toLIL (clContext: ClContext) workGroupSize = let byRows = byRows clContext workGroupSize @@ -314,12 +396,17 @@ module Matrix = Rows = rows NNZ = matrix.NNZ } + /// + /// Gets the number of non-zero elements in each row. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let NNZInRows (clContext: ClContext) workGroupSize = let pairwise = ClArray.pairwise clContext workGroupSize let subtract = - ClArray.map <@ fun (fst, snd) -> snd - fst @> clContext workGroupSize + Backend.Common.Map.map <@ fun (fst, snd) -> snd - fst @> clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (matrix: ClMatrix.CSR<'b>) -> let pointerPairs = @@ -334,5 +421,3 @@ module Matrix = pointerPairs.Free processor rowsLength - - let kronecker = Kronecker.run diff --git a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Merge.fs b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Merge.fs index cf98d531..8376053e 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Merge.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/CSR/Merge.fs @@ -2,9 +2,8 @@ namespace GraphBLAS.FSharp.Backend.Matrix.CSR open Brahma.FSharp open System -open GraphBLAS.FSharp.Backend.Objects - -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions module Merge = let run<'a, 'b when 'a: struct and 'b: struct> (clContext: ClContext) workGroupSize = diff --git a/src/GraphBLAS-sharp.Backend/Matrix/Common.fs b/src/GraphBLAS-sharp.Backend/Matrix/Common.fs index 5588b203..e13b889e 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/Common.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/Common.fs @@ -1,9 +1,9 @@ namespace GraphBLAS.FSharp.Backend.Matrix open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions module internal Common = ///. @@ -11,13 +11,13 @@ module internal Common = let setPositions<'a when 'a: struct> (clContext: ClContext) workGroupSize = let indicesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let valuesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let sum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (allRows: ClArray) (allColumns: ClArray) (allValues: ClArray<'a>) (positions: ClArray) -> @@ -46,13 +46,13 @@ module internal Common = let setPositionsOption<'a when 'a: struct> (clContext: ClContext) workGroupSize = let indicesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let valuesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let sum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (allRows: ClArray) (allColumns: ClArray) (allValues: ClArray<'a>) (positions: ClArray) -> diff --git a/src/GraphBLAS-sharp.Backend/Matrix/LIL/Matrix.fs b/src/GraphBLAS-sharp.Backend/Matrix/LIL/Matrix.fs index 34eff782..838fdead 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/LIL/Matrix.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/LIL/Matrix.fs @@ -1,9 +1,9 @@ namespace GraphBLAS.FSharp.Backend.Matrix.LIL open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClMatrix +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions module Matrix = let toCSR (clContext: ClContext) workGroupSize = diff --git a/src/GraphBLAS-sharp.Backend/Matrix/Matrix.fs b/src/GraphBLAS-sharp.Backend/Matrix/Matrix.fs index cd754379..c56ec5ea 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/Matrix.fs +++ b/src/GraphBLAS-sharp.Backend/Matrix/Matrix.fs @@ -1,15 +1,21 @@ -namespace GraphBLAS.FSharp.Backend.Matrix +namespace GraphBLAS.FSharp open Brahma.FSharp open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClMatrix open GraphBLAS.FSharp.Backend.Vector -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +[] module Matrix = + /// + /// Creates new matrix with the values from the given one. + /// New matrix represented in the format of the given one. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let copy (clContext: ClContext) workGroupSize = let copy = ClArray.copy clContext workGroupSize @@ -166,8 +172,8 @@ module Matrix = /// /// Creates a new matrix, represented in CSC format, that is equal to the given one. /// - ///OpenCL context. - ///Should be a power of 2 and greater than 1. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toCSC (clContext: ClContext) workGroupSize = let COOtoCSR = COO.Matrix.toCSR clContext workGroupSize @@ -228,6 +234,11 @@ module Matrix = |> ClMatrix.CSC | _ -> failwith "Not yet implemented" + /// + /// Creates a new matrix, represented in LIL format, that is equal to the given one. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toLIL (clContext: ClContext) workGroupSize = let copy = copy clContext workGroupSize @@ -255,74 +266,6 @@ module Matrix = |> ClMatrix.LIL | ClMatrix.LIL _ -> copy processor allocationMode matrix - let map (opAdd: Expr<'a option -> 'b option>) (clContext: ClContext) workGroupSize = - let mapCOO = - COO.Matrix.map opAdd clContext workGroupSize - - let mapCSR = - CSR.Matrix.map opAdd clContext workGroupSize - - let transposeCOO = - COO.Matrix.transposeInPlace clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode matrix -> - match matrix with - | ClMatrix.COO m -> mapCOO processor allocationMode m |> ClMatrix.COO - | ClMatrix.CSR m -> mapCSR processor allocationMode m |> ClMatrix.COO - | ClMatrix.CSC m -> - (mapCSR processor allocationMode m.ToCSR) - |> transposeCOO processor - |> ClMatrix.COO - | _ -> failwith "Not yet implemented" - - let map2 (opAdd: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = - let map2COO = - COO.Matrix.map2 opAdd clContext workGroupSize - - let map2CSR = - CSR.Matrix.map2 opAdd clContext workGroupSize - - let transposeCOO = - COO.Matrix.transposeInPlace clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode matrix1 matrix2 -> - match matrix1, matrix2 with - | ClMatrix.COO m1, ClMatrix.COO m2 -> - map2COO processor allocationMode m1 m2 - |> ClMatrix.COO - | ClMatrix.CSR m1, ClMatrix.CSR m2 -> - map2CSR processor allocationMode m1 m2 - |> ClMatrix.COO - | ClMatrix.CSC m1, ClMatrix.CSC m2 -> - (map2CSR processor allocationMode m1.ToCSR m2.ToCSR) - |> transposeCOO processor - |> ClMatrix.COO - | _ -> failwith "Matrix formats are not matching" - - let map2AtLeastOne (opAdd: Expr -> 'c option>) (clContext: ClContext) workGroupSize = - let COOMap2 = - COO.Matrix.map2AtLeastOne clContext opAdd workGroupSize - - let CSRMap2 = - CSR.Matrix.map2AtLeastOne clContext opAdd workGroupSize - - let COOTranspose = - COO.Matrix.transposeInPlace clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode matrix1 matrix2 -> - match matrix1, matrix2 with - | ClMatrix.COO m1, ClMatrix.COO m2 -> - COOMap2 processor allocationMode m1 m2 - |> ClMatrix.COO - | ClMatrix.CSR m1, ClMatrix.CSR m2 -> - CSRMap2 processor allocationMode m1 m2 - |> ClMatrix.COO - | ClMatrix.CSC m1, ClMatrix.CSC m2 -> - (CSRMap2 processor allocationMode m1.ToCSR m2.ToCSR) - |> COOTranspose processor - |> ClMatrix.COO - | _ -> failwith "Matrix formats are not matching" - /// /// Transposes the given matrix and returns result. /// The given matrix should neither be used afterwards nor be disposed. @@ -389,55 +332,3 @@ module Matrix = Values = copyData processor allocationMode m.Values } |> ClMatrix.CSR | ClMatrix.LIL _ -> failwith "Not yet implemented" - - let kronecker (op: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = - let run = - CSR.Matrix.kronecker clContext workGroupSize op - - fun (queue: MailboxProcessor<_>) allocationFlag (matrix1: ClMatrix<'a>) (matrix2: ClMatrix<'b>) -> - match matrix1, matrix2 with - | ClMatrix.CSR m1, ClMatrix.CSR m2 -> - let result = run queue allocationFlag m1 m2 - Option.map ClMatrix.COO result - | _ -> failwith "Both matrices should be in CSR format." - - module SpGeMM = - let masked - (opAdd: Expr<'c -> 'c -> 'c option>) - (opMul: Expr<'a -> 'b -> 'c option>) - (clContext: ClContext) - workGroupSize - = - - let runCSRnCSC = - SpGeMM.Masked.run opAdd opMul clContext workGroupSize - - fun (queue: MailboxProcessor<_>) (matrix1: ClMatrix<'a>) (matrix2: ClMatrix<'b>) (mask: ClMatrix<_>) -> - match matrix1, matrix2, mask with - | ClMatrix.CSR m1, ClMatrix.CSC m2, ClMatrix.COO mask -> runCSRnCSC queue m1 m2 mask |> ClMatrix.COO - | _ -> failwith "Matrix formats are not matching" - - let expand - (opAdd: Expr<'c -> 'c -> 'c option>) - (opMul: Expr<'a -> 'b -> 'c option>) - (clContext: ClContext) - workGroupSize - = - - let run = - SpGeMM.Expand.run opAdd opMul clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode (leftMatrix: ClMatrix<'a>) (rightMatrix: ClMatrix<'b>) -> - match leftMatrix, rightMatrix with - | ClMatrix.CSR leftMatrix, ClMatrix.CSR rightMatrix -> - let allocCapacity = - List.max [ sizeof<'a> - sizeof<'c> - sizeof<'b> ] - * 1 - - let resultCapacity = - (clContext.MaxMemAllocSize / allocCapacity) / 3 - - run processor allocationMode resultCapacity leftMatrix rightMatrix - | _ -> failwith "Matrix formats are not matching" diff --git a/src/GraphBLAS-sharp.Backend/Objects/ArraysExtentions.fs b/src/GraphBLAS-sharp.Backend/Objects/ArraysExtentions.fs index 29aad544..5f5da3ae 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/ArraysExtentions.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/ArraysExtentions.fs @@ -1,4 +1,4 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects open Brahma.FSharp diff --git a/src/GraphBLAS-sharp.Backend/Objects/AtLeastOne.fs b/src/GraphBLAS-sharp.Backend/Objects/AtLeastOne.fs index 758b2a4e..d0ab5aa5 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/AtLeastOne.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/AtLeastOne.fs @@ -1,4 +1,4 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects type AtLeastOne<'a, 'b when 'a: struct and 'b: struct> = | Both of 'a * 'b diff --git a/src/GraphBLAS-sharp.Backend/Objects/ClCell.fs b/src/GraphBLAS-sharp.Backend/Objects/ClCellExtensions.fs similarity index 89% rename from src/GraphBLAS-sharp.Backend/Objects/ClCell.fs rename to src/GraphBLAS-sharp.Backend/Objects/ClCellExtensions.fs index 6b6b188f..20334aae 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/ClCell.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/ClCellExtensions.fs @@ -1,8 +1,8 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects open Brahma.FSharp -module ClCell = +module ClCellExtensions = type ClCell<'a> with member this.ToHost(processor: MailboxProcessor<_>) = processor.PostAndReply(fun ch -> Msg.CreateToHostMsg<_>(this, (Array.zeroCreate<'a> 1), ch)).[0] diff --git a/src/GraphBLAS-sharp.Backend/Objects/ClContextExtensions.fs b/src/GraphBLAS-sharp.Backend/Objects/ClContextExtensions.fs index bd5c8a3a..f525e3cd 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/ClContextExtensions.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/ClContextExtensions.fs @@ -1,8 +1,8 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects open Brahma.FSharp -module ClContext = +module ClContextExtensions = type AllocationFlag = | DeviceOnly | HostInterop @@ -47,5 +47,6 @@ module ClContext = Cl .GetDeviceInfo(this.ClDevice.Device, OpenCL.Net.DeviceInfo.MaxMemAllocSize, error) - .CastTo() - * 1 + .CastTo() + |> uint64 + |> ((*) 1UL) diff --git a/src/GraphBLAS-sharp.Backend/Objects/Common.fs b/src/GraphBLAS-sharp.Backend/Objects/Common.fs index 2c1d83ab..9efb172a 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/Common.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/Common.fs @@ -1,4 +1,4 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects open Brahma.FSharp diff --git a/src/GraphBLAS-sharp.Backend/Objects/Matrix.fs b/src/GraphBLAS-sharp.Backend/Objects/Matrix.fs index 650c40b3..81771bd0 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/Matrix.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/Matrix.fs @@ -1,6 +1,7 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects open Brahma.FSharp +open GraphBLAS.FSharp.Objects type MatrixFormat = | CSR @@ -22,7 +23,6 @@ module ClMatrix = q.Post(Msg.CreateFreeMsg<_>(this.Values)) q.Post(Msg.CreateFreeMsg<_>(this.Columns)) q.Post(Msg.CreateFreeMsg<_>(this.RowPointers)) - q.PostAndReply(Msg.MsgNotifyMe) member this.Dispose q = (this :> IDeviceMemObject).Dispose q @@ -112,13 +112,31 @@ module ClMatrix = member this.NNZ = this.Values.Length +/// +/// Represents an abstraction over matrix, whose values and indices are in OpenCL device memory. +/// [] type ClMatrix<'a when 'a: struct> = + /// + /// Represents an abstraction over matrix in CSR format, whose values and indices are in OpenCL device memory. + /// | CSR of ClMatrix.CSR<'a> + /// + /// Represents an abstraction over matrix in COO format, whose values and indices are in OpenCL device memory. + /// | COO of ClMatrix.COO<'a> + /// + /// Represents an abstraction over matrix in CSC format, whose values and indices are in OpenCL device memory. + /// | CSC of ClMatrix.CSC<'a> + /// + /// Represents an abstraction over matrix in LIL format, whose values and indices are in OpenCL device memory. + /// | LIL of ClMatrix.LIL<'a> + /// + /// Gets the number of rows in matrix. + /// member this.RowCount = match this with | ClMatrix.CSR matrix -> matrix.RowCount @@ -126,6 +144,9 @@ type ClMatrix<'a when 'a: struct> = | ClMatrix.CSC matrix -> matrix.RowCount | ClMatrix.LIL matrix -> matrix.RowCount + /// + /// Gets the number of columns in matrix. + /// member this.ColumnCount = match this with | ClMatrix.CSR matrix -> matrix.ColumnCount @@ -133,6 +154,9 @@ type ClMatrix<'a when 'a: struct> = | ClMatrix.CSC matrix -> matrix.ColumnCount | ClMatrix.LIL matrix -> matrix.ColumnCount + /// + /// Release device resources allocated for the matrix. + /// member this.Dispose q = match this with | ClMatrix.CSR matrix -> (matrix :> IDeviceMemObject).Dispose q @@ -140,6 +164,9 @@ type ClMatrix<'a when 'a: struct> = | ClMatrix.CSC matrix -> (matrix :> IDeviceMemObject).Dispose q | ClMatrix.LIL matrix -> (matrix :> IDeviceMemObject).Dispose q + /// + /// Gets the number of non-zero elements in matrix. + /// member this.NNZ = match this with | ClMatrix.CSR matrix -> matrix.NNZ diff --git a/src/GraphBLAS-sharp.Backend/Objects/Vector.fs b/src/GraphBLAS-sharp.Backend/Objects/Vector.fs index f7430242..e7a221f1 100644 --- a/src/GraphBLAS-sharp.Backend/Objects/Vector.fs +++ b/src/GraphBLAS-sharp.Backend/Objects/Vector.fs @@ -1,7 +1,7 @@ -namespace GraphBLAS.FSharp.Backend.Objects +namespace GraphBLAS.FSharp.Objects open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions type VectorFormat = | Sparse @@ -18,21 +18,36 @@ module ClVector = member this.Dispose(q) = q.Post(Msg.CreateFreeMsg<_>(this.Values)) q.Post(Msg.CreateFreeMsg<_>(this.Indices)) - q.PostAndReply(Msg.MsgNotifyMe) member this.Dispose(q) = (this :> IDeviceMemObject).Dispose(q) member this.NNZ = this.Values.Length +/// +/// Represents an abstraction over vector, whose values and indices are in OpenCL device memory. +/// [] type ClVector<'a when 'a: struct> = + /// + /// Represents an abstraction over sparse vector, whose values and indices are in OpenCL device memory. + /// | Sparse of ClVector.Sparse<'a> + /// + /// Represents an abstraction over dense vector, whose values and indices are in OpenCL device memory. + /// | Dense of ClArray<'a option> + + /// + /// Gets the number of elements in vector. + /// member this.Size = match this with | Sparse vector -> vector.Size | Dense vector -> vector.Size + /// + /// Release device resources allocated for the vector. + /// member this.Dispose(q) = match this with | Sparse vector -> vector.Dispose(q) diff --git a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Kronecker.fs b/src/GraphBLAS-sharp.Backend/Operations/Kronecker.fs similarity index 96% rename from src/GraphBLAS-sharp.Backend/Matrix/CSR/Kronecker.fs rename to src/GraphBLAS-sharp.Backend/Operations/Kronecker.fs index 10151f41..9ff810bf 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/CSR/Kronecker.fs +++ b/src/GraphBLAS-sharp.Backend/Operations/Kronecker.fs @@ -1,17 +1,17 @@ -namespace GraphBLAS.FSharp.Backend.Matrix.CSR +namespace GraphBLAS.FSharp.Backend.Operations open FSharpx.Collections open Microsoft.FSharp.Quotations open FSharp.Quotations.Evaluator.QuotationEvaluationExtensions open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Common open GraphBLAS.FSharp.Backend.Matrix.COO open GraphBLAS.FSharp.Backend.Matrix.CSR -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions module internal Kronecker = let private updateBitmap (clContext: ClContext) workGroupSize op = @@ -67,7 +67,7 @@ module internal Kronecker = let updateBitmap = updateBitmap clContext workGroupSize op let sum = - Reduce.sum <@ fun x y -> x + y @> 0 clContext workGroupSize + Common.Reduce.sum <@ fun x y -> x + y @> 0 clContext workGroupSize let item = ClArray.item clContext workGroupSize @@ -191,7 +191,7 @@ module internal Kronecker = let kernel = clContext.Compile <| setPositions let scan = - PrefixSum.standardIncludeInPlace clContext workGroupSize + Common.PrefixSum.standardIncludeInPlace clContext workGroupSize fun (processor: MailboxProcessor<_>) rowCount columnCount (rowOffset: int) (columnOffset: int) (startIndex: int) (resultMatrix: COO<'c>) (values: ClArray<'c>) (bitmap: ClArray) -> @@ -224,6 +224,9 @@ module internal Kronecker = processor.Post(Msg.CreateRunMsg<_, _> kernel) + rowOffset.Free processor + columnOffset.Free processor + (sum.ToHostAndFree processor) + startIndex let private copyToResult (clContext: ClContext) workGroupSize = @@ -271,6 +274,9 @@ module internal Kronecker = processor.Post(Msg.CreateRunMsg<_, _> kernel) + rowOffset.Free processor + columnOffset.Free processor + let private insertZero (clContext: ClContext) workGroupSize = let copy = copyToResult clContext workGroupSize @@ -430,7 +436,7 @@ module internal Kronecker = let mapAll = mapAll clContext workGroupSize op let bitonic = - Sort.Bitonic.sortKeyValuesInplace clContext workGroupSize + Common.Sort.Bitonic.sortKeyValuesInplace clContext workGroupSize fun (queue: MailboxProcessor<_>) allocationMode (matrixLeft: CSR<'a>) (matrixRight: CSR<'b>) -> diff --git a/src/GraphBLAS-sharp.Backend/Operations/Operations.fs b/src/GraphBLAS-sharp.Backend/Operations/Operations.fs new file mode 100644 index 00000000..06b2a39a --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Operations/Operations.fs @@ -0,0 +1,376 @@ +namespace GraphBLAS.FSharp + +open Brahma.FSharp +open Microsoft.FSharp.Core +open Microsoft.FSharp.Quotations +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Backend.Matrix +open GraphBLAS.FSharp.Backend.Vector +open GraphBLAS.FSharp.Backend.Operations + +[] +module Operations = + module Vector = + /// + /// Builds a new vector whose elements are the results of applying the given function + /// to each of the elements of the vector. + /// + /// + /// A function to transform values of the input vector. + /// Operand and result types should be optional to distinguish explicit and implicit zeroes. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map (op: Expr<'a option -> 'b option>) (clContext: ClContext) workGroupSize = + let mapSparse = + Sparse.Vector.map op clContext workGroupSize + + let mapDense = + Dense.Vector.map op clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode matrix -> + match matrix with + | ClVector.Sparse v -> + mapSparse processor allocationMode v + |> ClVector.Sparse + | ClVector.Dense v -> + mapDense processor allocationMode v + |> ClVector.Dense + + /// + /// Builds a new vector whose values are the results of applying the given function + /// to the corresponding pairs of values from the two vectors. + /// + /// + /// A function to transform pairs of values from the input vectors. + /// Operands and result types should be optional to distinguish explicit and implicit zeroes. + /// + /// + /// Formats of the given vectors should match, otherwise an exception will be thrown. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2 (op: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = + let map2Dense = + Dense.Vector.map2 op clContext workGroupSize + + let map2Sparse = + Sparse.Vector.map2 op clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> + match leftVector, rightVector with + | ClVector.Dense left, ClVector.Dense right -> + map2Dense processor allocationMode left right + |> ClVector.Dense + |> Some + | ClVector.Sparse left, ClVector.Sparse right -> + Option.map ClVector.Sparse (map2Sparse processor allocationMode left right) + | _ -> failwith "Vector formats are not matching." + + /// + /// Builds a new vector whose values are the results of applying the given function + /// to the corresponding pairs of values from the two vectors. + /// + /// + /// A function to transform pairs of values from the input vectors. + /// Operation assumption: one of the operands should always be non-zero. + /// + /// + /// Formats of the given vectors should match, otherwise an exception will be thrown. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2AtLeastOne (op: Expr -> 'c option>) (clContext: ClContext) workGroupSize = + let map2Sparse = + Sparse.Vector.map2AtLeastOne op clContext workGroupSize + + let map2Dense = + Dense.Vector.map2AtLeastOne op clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> + match leftVector, rightVector with + | ClVector.Sparse left, ClVector.Sparse right -> + Option.map ClVector.Sparse (map2Sparse processor allocationMode left right) + | ClVector.Dense left, ClVector.Dense right -> + map2Dense processor allocationMode left right + |> ClVector.Dense + |> Some + | _ -> failwith "Vector formats are not matching." + + module Matrix = + /// + /// Builds a new matrix whose elements are the results of applying the given function + /// to each of the elements of the matrix. + /// + /// + /// A function to transform values of the input matrix. + /// Operand and result types should be optional to distinguish explicit and implicit zeroes + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map (op: Expr<'a option -> 'b option>) (clContext: ClContext) workGroupSize = + let mapCOO = + COO.Matrix.map op clContext workGroupSize + + let mapCSR = + CSR.Matrix.map op clContext workGroupSize + + let transposeCOO = + COO.Matrix.transposeInPlace clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode matrix -> + match matrix with + | ClMatrix.COO m -> mapCOO processor allocationMode m |> ClMatrix.COO + | ClMatrix.CSR m -> mapCSR processor allocationMode m |> ClMatrix.COO + | ClMatrix.CSC m -> + (mapCSR processor allocationMode m.ToCSR) + |> transposeCOO processor + |> ClMatrix.COO + | _ -> failwith "Not yet implemented" + + /// + /// Builds a new matrix whose values are the results of applying the given function + /// to the corresponding pairs of values from the two matrices. + /// + /// + /// A function to transform pairs of values from the input matrices. + /// Operands and result types should be optional to distinguish explicit and implicit zeroes + /// + /// + /// Formats of the given matrices should match, otherwise an exception will be thrown. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2 (op: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = + let map2COO = + COO.Matrix.map2 op clContext workGroupSize + + let map2CSR = + CSR.Matrix.map2 op clContext workGroupSize + + let transposeCOO = + COO.Matrix.transposeInPlace clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode matrix1 matrix2 -> + match matrix1, matrix2 with + | ClMatrix.COO m1, ClMatrix.COO m2 -> + map2COO processor allocationMode m1 m2 + |> ClMatrix.COO + | ClMatrix.CSR m1, ClMatrix.CSR m2 -> + map2CSR processor allocationMode m1 m2 + |> ClMatrix.COO + | ClMatrix.CSC m1, ClMatrix.CSC m2 -> + (map2CSR processor allocationMode m1.ToCSR m2.ToCSR) + |> transposeCOO processor + |> ClMatrix.COO + | _ -> failwith "Matrix formats are not matching" + + /// + /// Builds a new matrix whose values are the results of applying the given function + /// to the corresponding pairs of values from the two matrices. + /// + /// + /// A function to transform pairs of values from the input matrices. + /// Operation assumption: one of the operands should always be non-zero. + /// + /// + /// Formats of the given matrices should match, otherwise an exception will be thrown. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2AtLeastOne (op: Expr -> 'c option>) (clContext: ClContext) workGroupSize = + let COOMap2 = + COO.Matrix.map2AtLeastOne clContext op workGroupSize + + let CSRMap2 = + CSR.Matrix.map2AtLeastOne clContext op workGroupSize + + let COOTranspose = + COO.Matrix.transposeInPlace clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode matrix1 matrix2 -> + match matrix1, matrix2 with + | ClMatrix.COO m1, ClMatrix.COO m2 -> + COOMap2 processor allocationMode m1 m2 + |> ClMatrix.COO + | ClMatrix.CSR m1, ClMatrix.CSR m2 -> + CSRMap2 processor allocationMode m1 m2 + |> ClMatrix.COO + | ClMatrix.CSC m1, ClMatrix.CSC m2 -> + (CSRMap2 processor allocationMode m1.ToCSR m2.ToCSR) + |> COOTranspose processor + |> ClMatrix.COO + | _ -> failwith "Matrix formats are not matching" + + /// + /// Matrix-vector multiplication. + /// Vector, that is going to be the result of the operation, should be passed as an argument. + /// + /// Type of binary function to reduce entries. + /// Type of binary function to combine entries. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let SpMVInPlace + (add: Expr<'c option -> 'c option -> 'c option>) + (mul: Expr<'a option -> 'b option -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + let runTo = + SpMV.runTo add mul clContext workGroupSize + + fun (queue: MailboxProcessor<_>) (matrix: ClMatrix<'a>) (vector: ClVector<'b>) (result: ClVector<'c>) -> + match matrix, vector, result with + | ClMatrix.CSR m, ClVector.Dense v, ClVector.Dense r -> runTo queue m v r + | _ -> failwith "Not implemented yet" + + /// + /// CSR Matrix - dense vector multiplication. + /// + /// Type of binary function to reduce entries. + /// Type of binary function to combine entries. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let SpMV + (add: Expr<'c option -> 'c option -> 'c option>) + (mul: Expr<'a option -> 'b option -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + let run = SpMV.run add mul clContext workGroupSize + + fun (queue: MailboxProcessor<_>) allocationFlag (matrix: ClMatrix<'a>) (vector: ClVector<'b>) -> + match matrix, vector with + | ClMatrix.CSR m, ClVector.Dense v -> run queue allocationFlag m v |> ClVector.Dense + | _ -> failwith "Not implemented yet" + + /// + /// CSR Matrix - sparse vector multiplication. Optimized for bool OR and AND operations. + /// + /// Type of binary function to reduce entries. + /// Type of binary function to combine entries. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let SpMSpVBool + (add: Expr bool option -> bool option>) + (mul: Expr bool option -> bool option>) + (clContext: ClContext) + workGroupSize + = + + let run = + SpMSpV.runBoolStandard add mul clContext workGroupSize + + fun (queue: MailboxProcessor<_>) (matrix: ClMatrix) (vector: ClVector) -> + match matrix, vector with + | ClMatrix.CSR m, ClVector.Sparse v -> Option.map ClVector.Sparse (run queue m v) + | _ -> failwith "Not implemented yet" + + /// + /// CSR Matrix - sparse vector multiplication. + /// + /// Type of binary function to reduce entries. + /// Type of binary function to combine entries. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let SpMSpV + (add: Expr<'c option -> 'c option -> 'c option>) + (mul: Expr<'a option -> 'b option -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + let run = + SpMSpV.run add mul clContext workGroupSize + + fun (queue: MailboxProcessor<_>) (matrix: ClMatrix<'a>) (vector: ClVector<'b>) -> + match matrix, vector with + | ClMatrix.CSR m, ClVector.Sparse v -> Option.map ClVector.Sparse (run queue m v) + | _ -> failwith "Not implemented yet" + + /// + /// Kronecker product for matrices. + /// + /// + /// Element-wise operation. + /// Operands and result types should be optional to distinguish explicit and implicit zeroes + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let kronecker (op: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = + let run = Kronecker.run clContext workGroupSize op + + fun (queue: MailboxProcessor<_>) allocationFlag (matrix1: ClMatrix<'a>) (matrix2: ClMatrix<'b>) -> + match matrix1, matrix2 with + | ClMatrix.CSR m1, ClMatrix.CSR m2 -> + let result = run queue allocationFlag m1 m2 + Option.map ClMatrix.COO result + | _ -> failwith "Both matrices should be in CSR format." + + /// + /// Sparse general matrix-matrix multiplication. + /// + module SpGeMM = + /// + /// Masked matrix-matrix multiplication. + /// + /// Type of binary function to reduce entries. + /// Type of binary function to combine entries. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let masked + (opAdd: Expr<'c -> 'c -> 'c option>) + (opMul: Expr<'a -> 'b -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + let runCSRnCSC = + SpGeMM.Masked.run opAdd opMul clContext workGroupSize + + fun (queue: MailboxProcessor<_>) (matrix1: ClMatrix<'a>) (matrix2: ClMatrix<'b>) (mask: ClMatrix<_>) -> + match matrix1, matrix2, mask with + | ClMatrix.CSR m1, ClMatrix.CSC m2, ClMatrix.COO mask -> runCSRnCSC queue m1 m2 mask |> ClMatrix.COO + | _ -> failwith "Matrix formats are not matching" + + /// + /// Generalized matrix-matrix multiplication. + /// + /// Type of binary function to reduce entries. + /// Type of binary function to combine entries. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let expand + (opAdd: Expr<'c -> 'c -> 'c option>) + (opMul: Expr<'a -> 'b -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + let run = + SpGeMM.Expand.run opAdd opMul clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (leftMatrix: ClMatrix<'a>) (rightMatrix: ClMatrix<'b>) -> + match leftMatrix, rightMatrix with + | ClMatrix.CSR leftMatrix, ClMatrix.CSR rightMatrix -> + let allocCapacity = + List.max [ sizeof<'a> + sizeof<'c> + sizeof<'b> ] + |> uint64 + |> (*) 1UL + + let resultCapacity = + (clContext.MaxMemAllocSize / allocCapacity) / 3UL + + let resultCapacity = + (min + <| uint64 System.Int32.MaxValue + <| resultCapacity) + |> int + + run processor allocationMode resultCapacity leftMatrix rightMatrix + | _ -> failwith "Matrix formats are not matching" diff --git a/src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Expand.fs b/src/GraphBLAS-sharp.Backend/Operations/SpGeMM/Expand.fs similarity index 88% rename from src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Expand.fs rename to src/GraphBLAS-sharp.Backend/Operations/SpGeMM/Expand.fs index 4434472e..e404cf87 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Expand.fs +++ b/src/GraphBLAS-sharp.Backend/Operations/SpGeMM/Expand.fs @@ -1,24 +1,25 @@ -namespace GraphBLAS.FSharp.Backend.Matrix.SpGeMM +namespace GraphBLAS.FSharp.Backend.Operations.SpGeMM open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Common.Sort +open FSharp.Quotations +open GraphBLAS.FSharp +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions open GraphBLAS.FSharp.Backend.Matrix open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClCell -open FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -module Expand = +module internal Expand = let getSegmentPointers (clContext: ClContext) workGroupSize = - let gather = Gather.run clContext workGroupSize + let gather = + Common.Gather.run clContext workGroupSize let prefixSum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize fun (processor: MailboxProcessor<_>) (leftMatrixColumns: ClArray) (rightMatrixRowsLengths: ClArray) -> @@ -37,16 +38,16 @@ module Expand = let multiply (predicate: Expr<'a -> 'b -> 'c option>) (clContext: ClContext) workGroupSize = let getBitmap = - ClArray.map2<'a, 'b, int> (Map.choose2Bitmap predicate) clContext workGroupSize + Backend.Common.Map.map2<'a, 'b, int> (Map.choose2Bitmap predicate) clContext workGroupSize let prefixSum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize let assignValues = ClArray.assignOption2 predicate clContext workGroupSize let scatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize fun (processor: MailboxProcessor<_>) (firstValues: ClArray<'a>) (secondValues: ClArray<'b>) (columns: ClArray) (rows: ClArray) -> @@ -84,30 +85,33 @@ module Expand = let expand (clContext: ClContext) workGroupSize = let idScatter = - Scatter.initLastOccurrence Map.id clContext workGroupSize + Common.Scatter.initLastOccurrence Map.id clContext workGroupSize let scatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let zeroCreate = ClArray.zeroCreate clContext workGroupSize let maxPrefixSum = - PrefixSum.runIncludeInPlace <@ max @> clContext workGroupSize + Common.PrefixSum.runIncludeInPlace <@ max @> clContext workGroupSize let create = ClArray.create clContext workGroupSize - let gather = Gather.run clContext workGroupSize + let gather = + Common.Gather.run clContext workGroupSize let segmentPrefixSum = - PrefixSum.ByKey.sequentialInclude <@ (+) @> 0 clContext workGroupSize + Common.PrefixSum.ByKey.sequentialInclude <@ (+) @> 0 clContext workGroupSize let removeDuplicates = ClArray.removeDuplications clContext workGroupSize - let leftMatrixGather = Gather.run clContext workGroupSize + let leftMatrixGather = + Common.Gather.run clContext workGroupSize - let rightMatrixGather = Gather.run clContext workGroupSize + let rightMatrixGather = + Common.Gather.run clContext workGroupSize fun (processor: MailboxProcessor<_>) (lengths: int) (segmentsPointers: ClArray) (leftMatrix: ClMatrix.COO<'a>) (rightMatrix: ClMatrix.CSR<'b>) -> // Compute left matrix positions @@ -171,13 +175,13 @@ module Expand = let sortByColumnsAndRows (clContext: ClContext) workGroupSize = let sortByKeyIndices = - Radix.runByKeysStandard clContext workGroupSize + Common.Sort.Radix.runByKeysStandardValuesOnly clContext workGroupSize let sortByKeyValues = - Radix.runByKeysStandard clContext workGroupSize + Common.Sort.Radix.runByKeysStandardValuesOnly clContext workGroupSize let sortKeys = - Radix.standardRunKeysOnly clContext workGroupSize + Common.Sort.Radix.standardRunKeysOnly clContext workGroupSize fun (processor: MailboxProcessor<_>) (values: ClArray<'a>) (columns: ClArray) (rows: ClArray) -> // sort by columns @@ -207,16 +211,16 @@ module Expand = let reduce opAdd (clContext: ClContext) workGroupSize = let reduce = - Reduce.ByKey2D.Option.segmentSequential opAdd clContext workGroupSize + Common.Reduce.ByKey2D.Option.segmentSequential opAdd clContext workGroupSize let getUniqueBitmap = - ClArray.Bitmap.lastOccurrence2 clContext workGroupSize + Backend.Common.Bitmap.lastOccurrence2 clContext workGroupSize let prefixSum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize let idScatter = - Scatter.initFirsOccurrence Map.id clContext workGroupSize + Common.Scatter.initFirstOccurrence Map.id clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (values: ClArray<'a>) (columns: ClArray) (rows: ClArray) -> @@ -343,7 +347,8 @@ module Expand = let runManySteps opAdd opMul (clContext: ClContext) workGroupSize = - let gather = Gather.run clContext workGroupSize + let gather = + Common.Gather.run clContext workGroupSize let upperBound = ClArray.upperBound clContext workGroupSize @@ -399,10 +404,6 @@ module Expand = // compute sub result let length, result = runCOO subMatrix - - // release subMatrix (TODO(non blocking Free) - subMatrix.Dispose processor - // increase workOffset according to previous expand let workOffset = workOffset + length @@ -446,15 +447,12 @@ module Expand = let generalLength, segmentLengths = getSegmentPointers processor leftMatrix.Columns rightMatrixRowsNNZ - if generalLength < maxAllocSize then + if generalLength = 0 then + None + elif generalLength < maxAllocSize then segmentLengths.Free processor - let result = - runOneStep processor allocationMode leftMatrix rightMatrixRowsNNZ rightMatrix - - rightMatrixRowsNNZ.Free processor - - result + runOneStep processor allocationMode leftMatrix rightMatrixRowsNNZ rightMatrix else let result = runManySteps diff --git a/src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Masked.fs b/src/GraphBLAS-sharp.Backend/Operations/SpGeMM/Masked.fs similarity index 93% rename from src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Masked.fs rename to src/GraphBLAS-sharp.Backend/Operations/SpGeMM/Masked.fs index 700018c3..8c4e600a 100644 --- a/src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Masked.fs +++ b/src/GraphBLAS-sharp.Backend/Operations/SpGeMM/Masked.fs @@ -1,12 +1,12 @@ -namespace GraphBLAS.FSharp.Backend.Matrix.SpGeMM +namespace GraphBLAS.FSharp.Backend.Operations.SpGeMM -open GraphBLAS.FSharp.Backend.Common open Brahma.FSharp open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClMatrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions module internal Masked = let private calculate @@ -152,13 +152,13 @@ module internal Masked = calculate opAdd opMul context workGroupSize let scatter = - Scatter.lastOccurrence context workGroupSize + Common.Scatter.lastOccurrence context workGroupSize let scatterData = - Scatter.lastOccurrence context workGroupSize + Common.Scatter.lastOccurrence context workGroupSize let scanInPlace = - PrefixSum.standardExcludeInPlace context workGroupSize + Common.PrefixSum.standardExcludeInPlace context workGroupSize fun (queue: MailboxProcessor<_>) (matrixLeft: ClMatrix.CSR<'a>) (matrixRight: ClMatrix.CSC<'b>) (mask: ClMatrix.COO<_>) -> diff --git a/src/GraphBLAS-sharp.Backend/Operations/SpMSpV.fs b/src/GraphBLAS-sharp.Backend/Operations/SpMSpV.fs new file mode 100644 index 00000000..bca119a1 --- /dev/null +++ b/src/GraphBLAS-sharp.Backend/Operations/SpMSpV.fs @@ -0,0 +1,305 @@ +namespace GraphBLAS.FSharp.Backend.Operations + +open Brahma.FSharp +open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp.Backend.Quotes +open Microsoft.FSharp.Quotations +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions + +module SpMSpV = + + //For v in vectorIndices collect R[v] and R[v + 1] + let private collectRows (clContext: ClContext) workGroupSize = + + let collectRows = + <@ fun (ndRange: Range1D) inputSize (vectorIndices: ClArray) (rowOffsets: ClArray) (resultArray: ClArray) -> + + let i = ndRange.GlobalID0 + + //resultArray is twice vector size + if i < (inputSize * 2) then + let columnIndex = vectorIndices.[i / 2] + + if i % 2 = 0 then + resultArray.[i] <- rowOffsets.[columnIndex] + else + resultArray.[i] <- rowOffsets.[columnIndex + 1] + elif i = inputSize * 2 then + resultArray.[i] <- 0 @> + + let collectRows = clContext.Compile collectRows + + fun (queue: MailboxProcessor<_>) size (vectorIndices: ClArray) (rowOffsets: ClArray) -> + + let ndRange = + Range1D.CreateValid(size * 2 + 1, workGroupSize) + + // Last element will contain length of array for gather + let resultRows = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, size * 2 + 1) + + let collectRows = collectRows.GetKernel() + + queue.Post( + Msg.MsgSetArguments(fun () -> collectRows.KernelFunc ndRange size vectorIndices rowOffsets resultRows) + ) + + queue.Post(Msg.CreateRunMsg<_, _>(collectRows)) + + resultRows + + //For above array compute result offsets + let private computeOffsetsInplace (clContext: ClContext) workGroupSize = + + let prepareOffsets = + <@ fun (ndRange: Range1D) inputSize (inputArray: ClArray) -> + + let i = ndRange.GlobalID0 + + if i < inputSize && i % 2 = 0 then + inputArray.[i + 1] <- inputArray.[i + 1] - inputArray.[i] + inputArray.[i] <- 0 @> + + let sum = + PrefixSum.standardExcludeInPlace clContext workGroupSize + + let prepareOffsets = clContext.Compile prepareOffsets + + fun (queue: MailboxProcessor<_>) size (input: ClArray) -> + + let ndRange = Range1D.CreateValid(size, workGroupSize) + + let prepareOffsets = prepareOffsets.GetKernel() + + queue.Post(Msg.MsgSetArguments(fun () -> prepareOffsets.KernelFunc ndRange size input)) + + queue.Post(Msg.CreateRunMsg<_, _>(prepareOffsets)) + + let resSize = (sum queue input).ToHostAndFree queue + + resSize + + //Gather rows from the matrix that will be used in multiplication + let private gather (clContext: ClContext) workGroupSize = + + let gather = + <@ fun (ndRange: Range1D) vectorNNZ (rowOffsets: ClArray) (matrixRowPointers: ClArray) (matrixColumns: ClArray) (matrixValues: ClArray<'a>) (vectorIndices: ClArray) (resultRowsArray: ClArray) (resultIndicesArray: ClArray) (resultValuesArray: ClArray<'a>) -> + + //Serial number of row to gather + let row = ndRange.GlobalID0 + + if row < vectorNNZ then + let offsetIndex = row * 2 + 1 + let rowOffset = rowOffsets.[offsetIndex] + + //vectorIndices.[row] --- actual number of row in matrix + let actualRow = vectorIndices.[row] + let matrixIndexOffset = matrixRowPointers.[actualRow] + + if rowOffset <> rowOffsets.[offsetIndex + 1] then + let rowSize = rowOffsets.[offsetIndex + 1] - rowOffset + + for i in 0 .. rowSize - 1 do + resultRowsArray.[i + rowOffset] <- actualRow + resultIndicesArray.[i + rowOffset] <- matrixColumns.[matrixIndexOffset + i] + resultValuesArray.[i + rowOffset] <- matrixValues.[matrixIndexOffset + i] @> + + let collectRows = collectRows clContext workGroupSize + + let computeOffsetsInplace = + computeOffsetsInplace clContext workGroupSize + + let gather = clContext.Compile gather + + fun (queue: MailboxProcessor<_>) (matrix: ClMatrix.CSR<'a>) (vector: ClVector.Sparse<'b>) -> + + //Collect R[v] and R[v + 1] for each v in vector + let collectedRows = + collectRows queue vector.NNZ vector.Indices matrix.RowPointers + + //Place R[v + 1] - R[v] in previous array and do prefix sum, computing offsets for gather array + let gatherArraySize = + computeOffsetsInplace queue (vector.NNZ * 2 + 1) collectedRows + + if gatherArraySize = 0 then + collectedRows.Free queue + None + else + let ndRange = + Range1D.CreateValid(vector.NNZ, workGroupSize) + + let gather = gather.GetKernel() + + let resultRows = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, gatherArraySize) + + let resultIndices = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, gatherArraySize) + + let resultValues = + clContext.CreateClArrayWithSpecificAllocationMode<'a>(DeviceOnly, gatherArraySize) + + if gatherArraySize > 0 then + queue.Post( + Msg.MsgSetArguments + (fun () -> + gather.KernelFunc + ndRange + vector.NNZ + collectedRows + matrix.RowPointers + matrix.Columns + matrix.Values + vector.Indices + resultRows + resultIndices + resultValues) + ) + + queue.Post(Msg.CreateRunMsg<_, _>(gather)) + + collectedRows.Free queue + + Some(resultRows, resultIndices, resultValues) + + + let private multiplyScalar (clContext: ClContext) (mul: Expr<'a option -> 'b option -> 'c option>) workGroupSize = + + let multiply = + <@ fun (ndRange: Range1D) resultLength vectorLength (rowIndices: ClArray) (matrixValues: ClArray<'a>) (vectorIndices: ClArray) (vectorValues: ClArray<'b>) (resultValues: ClArray<'c option>) -> + let i = ndRange.GlobalID0 + + if i < resultLength then + let index = rowIndices.[i] + let matrixValue = matrixValues.[i] + + let vectorValue = + (%Search.Bin.byKey) vectorLength index vectorIndices vectorValues + + let res = (%mul) (Some matrixValue) vectorValue + resultValues.[i] <- res @> + + let multiply = clContext.Compile multiply + + fun (queue: MailboxProcessor<_>) (columnIndices: ClArray) (matrixValues: ClArray<'a>) (vector: Sparse<'b>) -> + + let resultLength = columnIndices.Length + + let result = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, resultLength) + + let ndRange = + Range1D.CreateValid(resultLength, workGroupSize) + + let multiply = multiply.GetKernel() + + queue.Post( + Msg.MsgSetArguments + (fun () -> + multiply.KernelFunc + ndRange + resultLength + vector.NNZ + columnIndices + matrixValues + vector.Indices + vector.Values + result) + ) + + queue.Post(Msg.CreateRunMsg<_, _>(multiply)) + + result + + let run + (add: Expr<'c option -> 'c option -> 'c option>) + (mul: Expr<'a option -> 'b option -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + //TODO: Common.Gather? + let gather = gather clContext workGroupSize + + //TODO: Radix sort + let sort = + Sort.Bitonic.sortKeyValuesInplace clContext workGroupSize + + let multiplyScalar = + multiplyScalar clContext mul workGroupSize + + let segReduce = + Reduce.ByKey.Option.segmentSequential add clContext workGroupSize + + fun (queue: MailboxProcessor<_>) (matrix: ClMatrix.CSR<'a>) (vector: ClVector.Sparse<'b>) -> + gather queue matrix vector + |> Option.map + (fun (gatherRows, gatherIndices, gatherValues) -> + sort queue gatherIndices gatherRows gatherValues + + let sortedRows, sortedIndices, sortedValues = gatherRows, gatherIndices, gatherValues + + let multipliedValues = + multiplyScalar queue sortedRows sortedValues vector + + sortedValues.Free queue + sortedRows.Free queue + + let result = + segReduce queue DeviceOnly sortedIndices multipliedValues + |> Option.map + (fun (reducedValues, reducedKeys) -> + + { Context = clContext + Indices = reducedKeys + Values = reducedValues + Size = matrix.ColumnCount }) + + multipliedValues.Free queue + sortedIndices.Free queue + + result) + |> Option.bind id + + + let runBoolStandard + (add: Expr<'c option -> 'c option -> 'c option>) + (mul: Expr<'a option -> 'b option -> 'c option>) + (clContext: ClContext) + workGroupSize + = + + let gather = gather clContext workGroupSize + + let sort = + Sort.Radix.standardRunKeysOnly clContext workGroupSize + + let removeDuplicates = + GraphBLAS.FSharp.ClArray.removeDuplications clContext workGroupSize + + let create = + GraphBLAS.FSharp.ClArray.create clContext workGroupSize + + fun (queue: MailboxProcessor<_>) (matrix: ClMatrix.CSR<'a>) (vector: ClVector.Sparse<'b>) -> + + gather queue matrix vector + |> Option.map + (fun (gatherRows, gatherIndices, gatherValues) -> + gatherRows.Free queue + gatherValues.Free queue + + let sortedIndices = sort queue gatherIndices + + let resultIndices = removeDuplicates queue sortedIndices + + gatherIndices.Free queue + sortedIndices.Free queue + + { Context = clContext + Indices = resultIndices + Values = create queue DeviceOnly resultIndices.Length true + Size = matrix.ColumnCount }) diff --git a/src/GraphBLAS-sharp.Backend/Vector/SpMV.fs b/src/GraphBLAS-sharp.Backend/Operations/SpMV.fs similarity index 97% rename from src/GraphBLAS-sharp.Backend/Vector/SpMV.fs rename to src/GraphBLAS-sharp.Backend/Operations/SpMV.fs index 46895b0c..34b5f821 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/SpMV.fs +++ b/src/GraphBLAS-sharp.Backend/Operations/SpMV.fs @@ -1,12 +1,12 @@ -namespace GraphBLAS.FSharp.Backend.Vector +namespace GraphBLAS.FSharp.Backend.Operations open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions -module SpMV = +module internal SpMV = let runTo (add: Expr<'c option -> 'c option -> 'c option>) (mul: Expr<'a option -> 'b option -> 'c option>) diff --git a/src/GraphBLAS-sharp.Backend/Quotes/Arithmetic.fs b/src/GraphBLAS-sharp.Backend/Quotes/Arithmetic.fs index f7d51a89..5d80a0da 100644 --- a/src/GraphBLAS-sharp.Backend/Quotes/Arithmetic.fs +++ b/src/GraphBLAS-sharp.Backend/Quotes/Arithmetic.fs @@ -1,9 +1,9 @@ -namespace GraphBLAS.FSharp.Backend.Quotes +namespace GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects module ArithmeticOperations = - let inline mkUnaryOp zero unaryOp = + let inline private mkUnaryOp zero unaryOp = <@ fun x -> let mutable res = zero @@ -13,7 +13,7 @@ module ArithmeticOperations = if res = zero then None else Some res @> - let inline mkNumericSum zero = + let inline private mkNumericSum zero = <@ fun (x: 't option) (y: 't option) -> let mutable res = zero @@ -25,7 +25,7 @@ module ArithmeticOperations = if res = zero then None else Some res @> - let inline mkNumericSumAtLeastOne zero = + let inline private mkNumericSumAtLeastOne zero = <@ fun (values: AtLeastOne<'t, 't>) -> let mutable res = zero @@ -36,7 +36,17 @@ module ArithmeticOperations = if res = zero then None else Some res @> - let inline mkNumericMul zero = + let inline private mkNumericSumAsMul zero = + <@ fun (x: 't option) (y: 't option) -> + let mutable res = None + + match x, y with + | Some f, Some s -> res <- Some(f + s) + | _ -> () + + res @> + + let inline private mkNumericMul zero = <@ fun (x: 't option) (y: 't option) -> let mutable res = zero @@ -46,7 +56,7 @@ module ArithmeticOperations = if res = zero then None else Some res @> - let inline mkNumericMulAtLeastOne zero = + let inline private mkNumericMulAtLeastOne zero = <@ fun (values: AtLeastOne<'t, 't>) -> let mutable res = zero @@ -173,6 +183,8 @@ module ArithmeticOperations = let floatMulAtLeastOne = mkNumericMulAtLeastOne 0.0 let float32MulAtLeastOne = mkNumericMulAtLeastOne 0f + let intSumAsMul = mkNumericSumAsMul System.Int32.MaxValue + let notOption = <@ fun x -> match x with @@ -197,7 +209,7 @@ module ArithmeticOperations = else Some result - let inline createPair zero op opQ = binOpQ zero opQ, binOp zero op + let inline private createPair zero op opQ = binOpQ zero opQ, binOp zero op // addition let intAdd = createPair 0 (+) <@ (+) @> @@ -216,3 +228,19 @@ module ArithmeticOperations = let floatMul = createPair 0.0 (*) <@ (*) @> let float32Mul = createPair 0.0f (*) <@ (*) @> + + // other operations + let less<'a when 'a: comparison> = + <@ fun (x: 'a option) (y: 'a option) -> + match x, y with + | Some x, Some y -> if (x < y) then Some 1 else None + | Some x, None -> Some 1 + | _ -> None @> + + let min<'a when 'a: comparison> = + <@ fun (x: 'a option) (y: 'a option) -> + match x, y with + | Some x, Some y -> Some(min x y) + | Some x, None -> Some x + | None, Some y -> Some y + | _ -> None @> diff --git a/src/GraphBLAS-sharp.Backend/Quotes/Convert.fs b/src/GraphBLAS-sharp.Backend/Quotes/Convert.fs index d779ba5a..3491dfa8 100644 --- a/src/GraphBLAS-sharp.Backend/Quotes/Convert.fs +++ b/src/GraphBLAS-sharp.Backend/Quotes/Convert.fs @@ -1,7 +1,7 @@ namespace GraphBLAS.FSharp.Backend.Quotes open FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects module Convert = let atLeastOneToOption op = diff --git a/src/GraphBLAS-sharp.Backend/Quotes/Map.fs b/src/GraphBLAS-sharp.Backend/Quotes/Map.fs index 2f74a7c5..9a518e40 100644 --- a/src/GraphBLAS-sharp.Backend/Quotes/Map.fs +++ b/src/GraphBLAS-sharp.Backend/Quotes/Map.fs @@ -28,6 +28,11 @@ module Map = | Some _ -> 1 | None -> 0 @> + let predicateBitmap<'a> (predicate: Expr<'a -> bool>) = + <@ fun (x: 'a) -> + let res = (%predicate) x + if res then 1 else 0 @> + let inc = <@ fun item -> item + 1 @> let subtraction = <@ fun first second -> first - second @> diff --git a/src/GraphBLAS-sharp.Backend/Quotes/Mask.fs b/src/GraphBLAS-sharp.Backend/Quotes/Mask.fs index 3a27b5d6..9b19b5b1 100644 --- a/src/GraphBLAS-sharp.Backend/Quotes/Mask.fs +++ b/src/GraphBLAS-sharp.Backend/Quotes/Mask.fs @@ -7,6 +7,12 @@ module Mask = | _, None -> left | _ -> right @> + let assignComplemented<'a when 'a: struct> = + <@ fun (left: 'a option) (right: 'a option) -> + match left, right with + | _, None -> right + | _ -> left @> + let op<'a, 'b when 'a: struct and 'b: struct> = <@ fun (left: 'a option) (right: 'b option) -> match right with diff --git a/src/GraphBLAS-sharp.Backend/Quotes/PreparePositions.fs b/src/GraphBLAS-sharp.Backend/Quotes/PreparePositions.fs index d219e7ec..4252cd18 100644 --- a/src/GraphBLAS-sharp.Backend/Quotes/PreparePositions.fs +++ b/src/GraphBLAS-sharp.Backend/Quotes/PreparePositions.fs @@ -2,7 +2,7 @@ namespace GraphBLAS.FSharp.Backend.Quotes open Brahma.FSharp -module PreparePositions = +module internal PreparePositions = let both<'c> = <@ fun index (result: 'c option) (rawPositionsBuffer: ClArray) (allValuesBuffer: ClArray<'c>) -> rawPositionsBuffer.[index] <- 0 diff --git a/src/GraphBLAS-sharp.Backend/Quotes/Search.fs b/src/GraphBLAS-sharp.Backend/Quotes/Search.fs index d2ea346a..183d3e4c 100644 --- a/src/GraphBLAS-sharp.Backend/Quotes/Search.fs +++ b/src/GraphBLAS-sharp.Backend/Quotes/Search.fs @@ -5,8 +5,10 @@ open Brahma.FSharp module Search = module Bin = /// - /// Searches a section of the array of indices, bounded by the given left and right edges, for an index, using a binary search algorithm. - /// In case searched section contains source index, the value at the same position in the array of values is returned. + /// Searches a section of the array of indices, bounded by the given left and right edges, + /// for an index, using a binary search algorithm. + /// In case searched section contains source index, + /// the value at the same position in the array of values is returned. /// /// /// Searched section of index array should be sorted in ascending order. @@ -42,10 +44,10 @@ module Search = /// In case there is a value at the given key position, it is returned. /// let byKey<'a> = - <@ fun lenght sourceIndex (keys: ClArray) (values: ClArray<'a>) -> + <@ fun length sourceIndex (keys: ClArray) (values: ClArray<'a>) -> let mutable leftEdge = 0 - let mutable rightEdge = lenght - 1 + let mutable rightEdge = length - 1 let mutable result = None @@ -69,10 +71,10 @@ module Search = /// In case there is a value at the given keys position, it is returned. /// let byKey2D<'a> = - <@ fun lenght sourceIndex (rowIndices: ClArray) (columnIndices: ClArray) (values: ClArray<'a>) -> + <@ fun length sourceIndex (rowIndices: ClArray) (columnIndices: ClArray) (values: ClArray<'a>) -> let mutable leftEdge = 0 - let mutable rightEdge = lenght - 1 + let mutable rightEdge = length - 1 let mutable result = None @@ -98,10 +100,36 @@ module Search = /// Find lower position of item in array. /// let lowerPosition<'a when 'a: equality and 'a: comparison> = - <@ fun lenght sourceItem (keys: 'a []) -> + <@ fun length sourceItem (keys: ClArray<'a>) -> let mutable leftEdge = 0 - let mutable rightEdge = lenght - 1 + let mutable rightEdge = length - 1 + let mutable resultPosition = None + + while leftEdge <= rightEdge do + let currentPosition = (leftEdge + rightEdge) / 2 + let currentKey = keys.[currentPosition] + + if sourceItem = currentKey then + // remember positions and move left + resultPosition <- Some currentPosition + + rightEdge <- currentPosition - 1 + elif sourceItem < currentKey then + rightEdge <- currentPosition - 1 + else + leftEdge <- currentPosition + 1 + + resultPosition @> + + /// + /// Find lower position of item in array. + /// + let lowerPositionLocal<'a when 'a: equality and 'a: comparison> = + <@ fun length sourceItem (keys: 'a []) -> + + let mutable leftEdge = 0 + let mutable rightEdge = length - 1 let mutable resultPosition = None @@ -138,15 +166,15 @@ module Search = /// /// let lowerBound<'a when 'a: comparison> = - <@ fun lenght sourceItem (keys: ClArray<'a>) -> + <@ fun length sourceItem (keys: ClArray<'a>) -> let mutable leftEdge = 0 - let mutable rightEdge = lenght - 1 + let mutable rightEdge = length - 1 let mutable resultPosition = 0 - if sourceItem >= keys.[lenght - 1] then - lenght - 1 + if sourceItem >= keys.[length - 1] then + length - 1 else while leftEdge <= rightEdge do let currentPosition = (leftEdge + rightEdge) / 2 @@ -164,15 +192,15 @@ module Search = let lowerBoundAndValue<'a when 'a: comparison> = let defaultValue = Unchecked.defaultof<'a> - <@ fun lenght sourceItem (keys: ClArray<'a>) -> + <@ fun length sourceItem (keys: ClArray<'a>) -> let mutable leftEdge = 0 - let mutable rightEdge = lenght - 1 + let mutable rightEdge = length - 1 let mutable resultPosition = 0, defaultValue - if sourceItem >= keys.[lenght - 1] then - (lenght - 1), keys.[lenght - 1] + if sourceItem >= keys.[length - 1] then + (length - 1), keys.[length - 1] else while leftEdge <= rightEdge do let currentPosition = (leftEdge + rightEdge) / 2 diff --git a/src/GraphBLAS-sharp.Backend/Vector/Dense/Vector.fs b/src/GraphBLAS-sharp.Backend/Vector/Dense/Vector.fs index 53f8de3e..6401a580 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Dense/Vector.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Dense/Vector.fs @@ -1,14 +1,27 @@ namespace GraphBLAS.FSharp.Backend.Vector.Dense open Brahma.FSharp +open Microsoft.FSharp.Quotations +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Common open GraphBLAS.FSharp.Backend.Quotes -open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Objects.ClVector -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions module Vector = + let map<'a, 'b when 'a: struct and 'b: struct> + (op: Expr<'a option -> 'b option>) + (clContext: ClContext) + workGroupSize + = + + let map = Map.map op clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClArray<'a option>) -> + + map processor allocationMode leftVector + let map2InPlace<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct> (opAdd: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) @@ -16,27 +29,24 @@ module Vector = = let map2InPlace = - ClArray.map2InPlace opAdd clContext workGroupSize + Map.map2InPlace opAdd clContext workGroupSize fun (processor: MailboxProcessor<_>) (leftVector: ClArray<'a option>) (rightVector: ClArray<'b option>) (resultVector: ClArray<'c option>) -> map2InPlace processor leftVector rightVector resultVector - let map2<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct> (opAdd: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = - let map2 = - ClArray.map2 opAdd clContext workGroupSize + let map2 = Map.map2 opAdd clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClArray<'a option>) (rightVector: ClArray<'b option>) -> map2 processor allocationMode leftVector rightVector - let map2AtLeastOne op clContext workGroupSize = map2 (Convert.atLeastOneToOption op) clContext workGroupSize @@ -56,20 +66,24 @@ module Vector = let kernel = clContext.Compile(fillSubVectorKernel) - fun (processor: MailboxProcessor<_>) (leftVector: ClArray<'a option>) (maskVector: ClArray<'b option>) (value: ClCell<'a>) (resultVector: ClArray<'a option>) -> + fun (processor: MailboxProcessor<_>) (leftVector: ClArray<'a option>) (maskVector: ClArray<'b option>) (value: 'a) (resultVector: ClArray<'a option>) -> let ndRange = Range1D.CreateValid(leftVector.Length, workGroupSize) let kernel = kernel.GetKernel() + let valueCell = clContext.CreateClCell(value) + processor.Post( Msg.MsgSetArguments - (fun () -> kernel.KernelFunc ndRange leftVector.Length leftVector maskVector value resultVector) + (fun () -> kernel.KernelFunc ndRange leftVector.Length leftVector maskVector valueCell resultVector) ) processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + valueCell.Free processor + let assignByMask<'a, 'b when 'a: struct and 'b: struct> (maskOp: Expr<'a option -> 'b option -> 'a -> 'a option>) (clContext: ClContext) @@ -79,7 +93,7 @@ module Vector = let assignByMask = assignByMaskInPlace maskOp clContext workGroupSize - fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClArray<'a option>) (maskVector: ClArray<'b option>) (value: ClCell<'a>) -> + fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClArray<'a option>) (maskVector: ClArray<'b option>) (value: 'a) -> let resultVector = clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, leftVector.Length) @@ -87,25 +101,68 @@ module Vector = resultVector + let assignBySparseMaskInPlace<'a, 'b when 'a: struct and 'b: struct> + (maskOp: Expr<'a option -> 'b option -> 'a -> 'a option>) + (clContext: ClContext) + workGroupSize + = + + let fillSubVectorKernel = + <@ fun (ndRange: Range1D) resultLength (leftVector: ClArray<'a option>) (maskVectorIndices: ClArray) (maskVectorValues: ClArray<'b>) (value: ClCell<'a>) (resultVector: ClArray<'a option>) -> + + let gid = ndRange.GlobalID0 + + if gid < resultLength then + let i = maskVectorIndices.[gid] + resultVector.[i] <- (%maskOp) leftVector.[i] (Some maskVectorValues.[gid]) value.Value @> + + let kernel = clContext.Compile(fillSubVectorKernel) + + fun (processor: MailboxProcessor<_>) (leftVector: ClArray<'a option>) (maskVector: Sparse<'b>) (value: 'a) (resultVector: ClArray<'a option>) -> + + let ndRange = + Range1D.CreateValid(maskVector.NNZ, workGroupSize) + + let kernel = kernel.GetKernel() + + let valueCell = clContext.CreateClCell(value) + + processor.Post( + Msg.MsgSetArguments + (fun () -> + kernel.KernelFunc + ndRange + maskVector.NNZ + leftVector + maskVector.Indices + maskVector.Values + valueCell + resultVector) + ) + + processor.Post(Msg.CreateRunMsg<_, _>(kernel)) + + valueCell.Free processor + let toSparse<'a when 'a: struct> (clContext: ClContext) workGroupSize = let scatterValues = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let scatterIndices = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let getBitmap = - ClArray.map (Map.option 1 0) clContext workGroupSize + Map.map (Map.option 1 0) clContext workGroupSize let prefixSum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize let allIndices = ClArray.init Map.id clContext workGroupSize let allValues = - ClArray.map (Map.optionToValueOrZero Unchecked.defaultof<'a>) clContext workGroupSize + Map.map (Map.optionToValueOrZero Unchecked.defaultof<'a>) clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (vector: ClArray<'a option>) -> @@ -149,7 +206,7 @@ module Vector = ClArray.choose Map.id clContext workGroupSize let reduce = - Reduce.reduce opAdd clContext workGroupSize + Common.Reduce.reduce opAdd clContext workGroupSize fun (processor: MailboxProcessor<_>) (vector: ClArray<'a option>) -> choose processor DeviceOnly vector diff --git a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Common.fs b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Common.fs index cb6a8971..8ad13044 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Common.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Common.fs @@ -1,23 +1,24 @@ namespace GraphBLAS.FSharp.Backend.Vector.Sparse open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ClVector open Microsoft.FSharp.Control -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions module internal Common = let setPositions<'a when 'a: struct> (clContext: ClContext) workGroupSize = let sum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize let valuesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let indicesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (allValues: ClArray<'a>) (allIndices: ClArray) (positions: ClArray) -> @@ -39,13 +40,13 @@ module internal Common = let setPositionsOption<'a when 'a: struct> (clContext: ClContext) workGroupSize = let sum = - PrefixSum.standardExcludeInPlace clContext workGroupSize + Common.PrefixSum.standardExcludeInPlace clContext workGroupSize let valuesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let indicesScatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (allValues: ClArray<'a>) (allIndices: ClArray) (positions: ClArray) -> @@ -74,7 +75,7 @@ module internal Common = let concatIndices = ClArray.concat clContext workGroupSize let mapIndices = - ClArray.mapWithValue clContext workGroupSize <@ fun x y -> x + y @> + Common.Map.mapWithValue clContext workGroupSize <@ fun x y -> x + y @> fun (processor: MailboxProcessor<_>) allocationMode (vectors: Sparse<'a> seq) -> diff --git a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map.fs b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map.fs index 3d804101..f0a69a41 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map.fs @@ -3,18 +3,104 @@ open FSharp.Quotations.Evaluator.QuotationEvaluationExtensions open Microsoft.FSharp.Quotations open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Backend.Vector.Sparse -open GraphBLAS.FSharp.Backend.Objects.ClVector -open GraphBLAS.FSharp.Backend.Common.ClArray -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions + +module internal Map = + let preparePositions<'a, 'b> opAdd (clContext: ClContext) workGroupSize = + + let preparePositions (op: Expr<'a option -> 'b option>) = + <@ fun (ndRange: Range1D) size valuesLength (values: ClArray<'a>) (indices: ClArray) (resultBitmap: ClArray) (resultValues: ClArray<'b>) (resultIndices: ClArray) -> + + let gid = ndRange.GlobalID0 + + if gid < size then + + let value = + (%Search.Bin.byKey) valuesLength gid indices values + + match (%op) value with + | Some resultValue -> + resultValues.[gid] <- resultValue + resultIndices.[gid] <- gid + + resultBitmap.[gid] <- 1 + | None -> resultBitmap.[gid] <- 0 @> + + let kernel = + clContext.Compile <| preparePositions opAdd + + fun (processor: MailboxProcessor<_>) (size: int) (values: ClArray<'a>) (indices: ClArray) -> + + let resultBitmap = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, size) + + let resultIndices = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, size) + + let resultValues = + clContext.CreateClArrayWithSpecificAllocationMode<'b>(DeviceOnly, size) + + let ndRange = Range1D.CreateValid(size, workGroupSize) + + let kernel = kernel.GetKernel() + + processor.Post( + Msg.MsgSetArguments + (fun () -> + kernel.KernelFunc + ndRange + size + values.Length + values + indices + resultBitmap + resultValues + resultIndices) + ) + + processor.Post(Msg.CreateRunMsg<_, _> kernel) + + resultBitmap, resultValues, resultIndices + + let run<'a, 'b when 'a: struct and 'b: struct and 'b: equality> + (op: Expr<'a option -> 'b option>) + (clContext: ClContext) + workGroupSize + = + + let map = + preparePositions op clContext workGroupSize + + let setPositions = + Common.setPositions<'b> clContext workGroupSize + + fun (queue: MailboxProcessor<_>) allocationMode (vector: ClVector.Sparse<'a>) -> + + let bitmap, values, indices = + map queue vector.Size vector.Values vector.Indices + + let resultValues, resultIndices = + setPositions queue allocationMode values indices bitmap + + queue.Post(Msg.CreateFreeMsg<_>(bitmap)) + queue.Post(Msg.CreateFreeMsg<_>(values)) + queue.Post(Msg.CreateFreeMsg<_>(indices)) + + { Context = clContext + Indices = resultIndices + Values = resultValues + Size = vector.Size } -module Map = module WithValueOption = - let preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = + let private preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = let preparePositions (op: Expr<'a option -> 'b option -> 'c option>) = <@ fun (ndRange: Range1D) (operand: ClCell<'a option>) size valuesLength (indices: ClArray) (values: ClArray<'b>) (resultIndices: ClArray) (resultValues: ClArray<'c>) (resultBitmap: ClArray) -> @@ -85,9 +171,10 @@ module Map = let setPositions = Common.setPositionsOption<'c> clContext workGroupSize - let create = create clContext workGroupSize + let create = ClArray.create clContext workGroupSize - let init = init <@ id @> clContext workGroupSize + let init = + ClArray.init <@ id @> clContext workGroupSize fun (queue: MailboxProcessor<_>) allocationMode (value: 'a option) size -> function diff --git a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map2.fs b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map2.fs index 1b8ef660..fb91840f 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map2.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Map2.fs @@ -3,10 +3,12 @@ namespace GraphBLAS.FSharp.Backend.Vector.Sparse open Brahma.FSharp open FSharp.Quotations open Microsoft.FSharp.Control -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClVector -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Backend.Quotes +open Microsoft.FSharp.Core module internal Map2 = let private preparePositions<'a, 'b, 'c> opAdd (clContext: ClContext) workGroupSize = @@ -78,7 +80,7 @@ module internal Map2 = preparePositions<'a, 'b, 'c> op clContext workGroupSize let setPositions = - Common.setPositions clContext workGroupSize + Common.setPositionsOption clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClVector.Sparse<'b>) -> @@ -91,17 +93,113 @@ module internal Map2 = rightVector.Values rightVector.Indices - let resultValues, resultIndices = + let result = setPositions processor allocationMode allValues allIndices bitmap + |> Option.map + (fun (resultValues, resultIndices) -> + { Context = clContext + Values = resultValues + Indices = resultIndices + Size = leftVector.Size }) - processor.Post(Msg.CreateFreeMsg<_>(allIndices)) - processor.Post(Msg.CreateFreeMsg<_>(allValues)) - processor.Post(Msg.CreateFreeMsg<_>(bitmap)) + allIndices.Free processor + allValues.Free processor + bitmap.Free processor - { Context = clContext - Values = resultValues - Indices = resultIndices - Size = max leftVector.Size rightVector.Size } + result + + let private preparePositionsSparseDense<'a, 'b, 'c> (clContext: ClContext) workGroupSize opAdd = + + let preparePositions (op: Expr<'a option -> 'b option -> 'c option>) = + <@ fun (ndRange: Range1D) length (leftValues: ClArray<'a>) (leftIndices: ClArray) (rightValues: ClArray<'b option>) (resultBitmap: ClArray) (resultValues: ClArray<'c>) (resultIndices: ClArray) -> + + let gid = ndRange.GlobalID0 + + if gid < length then + + let i = leftIndices.[gid] + + let (leftValue: 'a option) = Some leftValues.[gid] + + let (rightValue: 'b option) = rightValues.[i] + + match (%op) leftValue rightValue with + | Some value -> + resultValues.[gid] <- value + resultIndices.[gid] <- i + + resultBitmap.[gid] <- 1 + | None -> resultBitmap.[gid] <- 0 @> + + let kernel = + clContext.Compile <| preparePositions opAdd + + fun (processor: MailboxProcessor<_>) (vectorLenght: int) (leftValues: ClArray<'a>) (leftIndices: ClArray) (rightValues: ClArray<'b option>) -> + + let resultBitmap = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, vectorLenght) + + let resultIndices = + clContext.CreateClArrayWithSpecificAllocationMode(DeviceOnly, vectorLenght) + + let resultValues = + clContext.CreateClArrayWithSpecificAllocationMode<'c>(DeviceOnly, vectorLenght) + + let ndRange = + Range1D.CreateValid(vectorLenght, workGroupSize) + + let kernel = kernel.GetKernel() + + processor.Post( + Msg.MsgSetArguments + (fun () -> + kernel.KernelFunc + ndRange + vectorLenght + leftValues + leftIndices + rightValues + resultBitmap + resultValues + resultIndices) + ) + + processor.Post(Msg.CreateRunMsg<_, _> kernel) + + resultBitmap, resultValues, resultIndices + + //TODO: unify with sparseXsparse + let runSparseDense<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct> + op + (clContext: ClContext) + workGroupSize + = + + let prepare = + preparePositionsSparseDense<'a, 'b, 'c> clContext workGroupSize op + + let setPositions = + Common.setPositionsOption clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClArray<'b option>) -> + + let bitmap, allValues, allIndices = + prepare processor leftVector.NNZ leftVector.Values leftVector.Indices rightVector + + let result = + setPositions processor allocationMode allValues allIndices bitmap + |> Option.map + (fun (resultValues, resultIndices) -> + { Context = clContext + Values = resultValues + Indices = resultIndices + Size = leftVector.Size }) + + allIndices.Free processor + allValues.Free processor + bitmap.Free processor + + result let private preparePositionsAssignByMask<'a, 'b when 'a: struct and 'b: struct> op @@ -183,7 +281,9 @@ module internal Map2 = let setPositions = Common.setPositions clContext workGroupSize - fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClVector.Sparse<'b>) (value: ClCell<'a>) -> + fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClVector.Sparse<'b>) (value: 'a) -> + + let valueCell = clContext.CreateClCell(value) let bitmap, values, indices = prepare @@ -193,11 +293,12 @@ module internal Map2 = leftVector.Indices rightVector.Values rightVector.Indices - value + valueCell let resultValues, resultIndices = setPositions processor allocationMode values indices bitmap + processor.Post(Msg.CreateFreeMsg<_>(valueCell)) processor.Post(Msg.CreateFreeMsg<_>(indices)) processor.Post(Msg.CreateFreeMsg<_>(values)) processor.Post(Msg.CreateFreeMsg<_>(bitmap)) @@ -280,7 +381,7 @@ module internal Map2 = preparePositions<'a, 'b, 'c> op clContext workGroupSize let setPositions = - Common.setPositions clContext workGroupSize + Common.setPositionsOption clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClVector.Sparse<'b>) -> @@ -293,14 +394,17 @@ module internal Map2 = processor.Post(Msg.CreateFreeMsg<_>(rightValues)) processor.Post(Msg.CreateFreeMsg<_>(isLeft)) - let resultValues, resultIndices = + let result = setPositions processor allocationMode allValues allIndices positions + |> Option.map + (fun (resultValues, resultIndices) -> + { Context = clContext + Values = resultValues + Indices = resultIndices + Size = max leftVector.Size rightVector.Size }) processor.Post(Msg.CreateFreeMsg<_>(allIndices)) processor.Post(Msg.CreateFreeMsg<_>(allValues)) processor.Post(Msg.CreateFreeMsg<_>(positions)) - { Context = clContext - Values = resultValues - Indices = resultIndices - Size = max leftVector.Size rightVector.Size } + result diff --git a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Merge.fs b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Merge.fs index 459ab6d5..4c310edf 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Merge.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Merge.fs @@ -1,8 +1,8 @@ namespace GraphBLAS.FSharp.Backend.Vector.Sparse open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions module internal Merge = let run<'a, 'b when 'a: struct and 'b: struct> (clContext: ClContext) workGroupSize = diff --git a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Vector.fs b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Vector.fs index 5b3594ae..6d5bc25d 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Sparse/Vector.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Sparse/Vector.fs @@ -3,11 +3,10 @@ namespace GraphBLAS.FSharp.Backend.Vector.Sparse open Brahma.FSharp open Microsoft.FSharp.Control open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClVector open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClVector -open GraphBLAS.FSharp.Backend.Vector.Sparse module Vector = let copy (clContext: ClContext) workGroupSize = @@ -21,10 +20,14 @@ module Vector = Values = copyData processor allocationMode vector.Values Size = vector.Size } + let map = Map.run + let mapWithValue = Map.WithValueOption.run let map2 = Map2.run + let map2SparseDense = Map2.runSparseDense + let map2AtLeastOne opAdd (clContext: ClContext) workGroupSize allocationMode = Map2.AtLeastOne.run (Convert.atLeastOneToOption opAdd) clContext workGroupSize allocationMode @@ -68,6 +71,6 @@ module Vector = let reduce<'a when 'a: struct> (opAdd: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = let reduce = - Reduce.reduce opAdd clContext workGroupSize + Common.Reduce.reduce opAdd clContext workGroupSize fun (processor: MailboxProcessor<_>) (vector: ClVector.Sparse<'a>) -> reduce processor vector.Values diff --git a/src/GraphBLAS-sharp.Backend/Vector/Vector.fs b/src/GraphBLAS-sharp.Backend/Vector/Vector.fs index 9c94992b..f02798d6 100644 --- a/src/GraphBLAS-sharp.Backend/Vector/Vector.fs +++ b/src/GraphBLAS-sharp.Backend/Vector/Vector.fs @@ -1,16 +1,24 @@ -namespace GraphBLAS.FSharp.Backend.Vector +namespace GraphBLAS.FSharp open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Quotes open Microsoft.FSharp.Control +open Microsoft.FSharp.Core open Microsoft.FSharp.Quotations -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ClVector - +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClVector +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Backend.Vector +[] module Vector = + /// + /// Builds vector of given format with fixed size and fills it with the default values of desired type. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let zeroCreate (clContext: ClContext) workGroupSize = let zeroCreate = ClArray.zeroCreate clContext workGroupSize @@ -31,15 +39,20 @@ module Vector = ClVector.Dense <| zeroCreate processor allocationMode size + /// + /// Builds vector of given format with fixed size and fills it with the values from the given list. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let ofList (clContext: ClContext) workGroupSize = let scatter = - Scatter.lastOccurrence clContext workGroupSize + Common.Scatter.lastOccurrence clContext workGroupSize let zeroCreate = ClArray.zeroCreate clContext workGroupSize let map = - ClArray.map <@ Some @> clContext workGroupSize + Common.Map.map <@ Some @> clContext workGroupSize fun (processor: MailboxProcessor<_>) allocationMode format size (elements: (int * 'a) list) -> match format with @@ -76,6 +89,12 @@ module Vector = ClVector.Dense result + /// + /// Creates new vector with the values from the given one. + /// New vector represented in the format of the given one. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let copy (clContext: ClContext) workGroupSize = let sparseCopy = Sparse.Vector.copy clContext workGroupSize @@ -91,6 +110,12 @@ module Vector = ClVector.Dense <| copyOptionData processor allocationMode vector + /// + /// Sparsifies the given vector if it is in a dense format. + /// If the given vector is already sparse, copies it. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toSparse (clContext: ClContext) workGroupSize = let toSparse = Dense.Vector.toSparse clContext workGroupSize @@ -104,6 +129,12 @@ module Vector = <| toSparse processor allocationMode vector | ClVector.Sparse _ -> copy processor allocationMode vector + /// + /// Densifies the given vector if it is in a sparse format. + /// If the given vector is already dense, copies it. + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let toDense (clContext: ClContext) workGroupSize = let toDense = Sparse.Vector.toDense clContext workGroupSize @@ -119,40 +150,6 @@ module Vector = ClVector.Dense <| toDense processor allocationMode vector - let map2 (opAdd: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = - let map2Dense = - Dense.Vector.map2 opAdd clContext workGroupSize - - let map2Sparse = - Sparse.Vector.map2 opAdd clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> - match leftVector, rightVector with - | ClVector.Dense left, ClVector.Dense right -> - ClVector.Dense - <| map2Dense processor allocationMode left right - | ClVector.Sparse left, ClVector.Sparse right -> - ClVector.Sparse - <| map2Sparse processor allocationMode left right - | _ -> failwith "Vector formats are not matching." - - let map2AtLeastOne (opAdd: Expr -> 'c option>) (clContext: ClContext) workGroupSize = - let map2Sparse = - Sparse.Vector.map2AtLeastOne opAdd clContext workGroupSize - - let map2Dense = - Dense.Vector.map2AtLeastOne opAdd clContext workGroupSize - - fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> - match leftVector, rightVector with - | ClVector.Sparse left, ClVector.Sparse right -> - ClVector.Sparse - <| map2Sparse processor allocationMode left right - | ClVector.Dense left, ClVector.Dense right -> - ClVector.Dense - <| map2Dense processor allocationMode left right - | _ -> failwith "Vector formats are not matching." - let private assignByMaskGeneral<'a, 'b when 'a: struct and 'b: struct> op (clContext: ClContext) workGroupSize = let sparseFillVector = @@ -161,7 +158,7 @@ module Vector = let denseFillVector = Dense.Vector.assignByMask op clContext workGroupSize - fun (processor: MailboxProcessor<_>) allocationMode (vector: ClVector<'a>) (mask: ClVector<'b>) (value: ClCell<'a>) -> + fun (processor: MailboxProcessor<_>) allocationMode (vector: ClVector<'a>) (mask: ClVector<'b>) (value: 'a) -> match vector, mask with | ClVector.Sparse vector, ClVector.Sparse mask -> ClVector.Sparse @@ -171,12 +168,162 @@ module Vector = <| denseFillVector processor allocationMode vector mask value | _ -> failwith "Vector formats are not matching." + /// + /// Assign given value to all entries covered by mask. + /// + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let assignByMask<'a, 'b when 'a: struct and 'b: struct> op clContext workGroupSize = assignByMaskGeneral<'a, 'b> (Convert.assignToOption op) clContext workGroupSize + /// + /// Assign given value to all entries NOT covered by mask. + /// + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let assignByMaskComplemented<'a, 'b when 'a: struct and 'b: struct> op clContext workGroupSize = assignByMaskGeneral<'a, 'b> (Convert.assignComplementedToOption op) clContext workGroupSize + let private assignByMaskInPlaceGeneral<'a, 'b when 'a: struct and 'b: struct> + op + (clContext: ClContext) + workGroupSize + = + + let assignByDense = + Dense.Vector.assignByMaskInPlace op clContext workGroupSize + + let assignBySparse = + Dense.Vector.assignBySparseMaskInPlace op clContext workGroupSize + + fun (processor: MailboxProcessor<_>) (vector: ClVector<'a>) (mask: ClVector<'b>) (value: 'a) -> + match vector, mask with + | ClVector.Dense vector, ClVector.Dense mask -> assignByDense processor vector mask value vector + | ClVector.Dense vector, ClVector.Sparse mask -> assignBySparse processor vector mask value vector + | _ -> failwith "Unsupported format" + + /// + /// Assign given value to all entries covered by mask. + /// Does it in-place. + /// + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let assignByMaskInPlace<'a, 'b when 'a: struct and 'b: struct> op clContext workGroupSize = + assignByMaskInPlaceGeneral<'a, 'b> (Convert.assignToOption op) clContext workGroupSize + + /// + /// Applying the given function to the corresponding elements of the two given arrays pairwise. + /// Stores the result in the left vector. + /// + /// + /// The two input arrays must have the same lengths. + /// + /// The function to transform the pairs of the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2InPlace (map: Expr<'a option -> 'b option -> 'a option>) (clContext: ClContext) workGroupSize = + let map2Dense = + Dense.Vector.map2InPlace map clContext workGroupSize + + fun (processor: MailboxProcessor<_>) (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> + match leftVector, rightVector with + | ClVector.Dense left, ClVector.Dense right -> map2Dense processor left right left + | _ -> failwith "Unsupported vector format" + + /// + /// Applying the given function to the corresponding elements of the two given arrays pairwise. + /// Stores the result in the given vector. + /// + /// + /// The two input arrays must have the same lengths. + /// + /// The function to transform the pairs of the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2To (map: Expr<'a option -> 'b option -> 'c option>) (clContext: ClContext) workGroupSize = + let map2Dense = + Dense.Vector.map2InPlace map clContext workGroupSize + + fun (processor: MailboxProcessor<_>) (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) (resultVector: ClVector<'c>) -> + match leftVector, rightVector, resultVector with + | ClVector.Dense left, ClVector.Dense right, ClVector.Dense result -> map2Dense processor left right result + | _ -> failwith "Unsupported vector format" + + /// + /// Applying the given function to the corresponding elements of the two given arrays pairwise. + /// Returns new vector. + /// + /// + /// The two input arrays must have the same lengths. + /// + /// The function to transform the pairs of the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2Dense (map: Expr<'a option -> 'b option -> 'a option>) (clContext: ClContext) workGroupSize = + let map2Dense = + Dense.Vector.map2 map clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationFlag (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> + match leftVector, rightVector with + | ClVector.Dense left, ClVector.Dense right -> map2Dense processor allocationFlag left right + | _ -> failwith "Unsupported vector format" + + /// + /// Applying the given function to the corresponding elements of the two given arrays pairwise. + /// Returns new vector as option. + /// + /// + /// The two input arrays must have the same lengths. + /// + /// The function to transform the pairs of the input elements. + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let map2Sparse (map: Expr<'a option -> 'b option -> 'a option>) (clContext: ClContext) workGroupSize = + let map2Sparse = + Sparse.Map2.run map clContext workGroupSize + + let map2SparseDense = + Sparse.Map2.runSparseDense map clContext workGroupSize + + fun (processor: MailboxProcessor<_>) allocationFlag (leftVector: ClVector<'a>) (rightVector: ClVector<'b>) -> + match leftVector, rightVector with + | ClVector.Sparse left, ClVector.Sparse right -> + Option.map ClVector.Sparse (map2Sparse processor allocationFlag left right) + | ClVector.Sparse left, ClVector.Dense right -> + Option.map ClVector.Sparse (map2SparseDense processor allocationFlag left right) + | _ -> failwith "Unsupported vector format" + + /// + /// Check if vector contains such element that satisfies the predicate. + /// + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. + let exists (predicate: Expr<'a option -> bool>) (clContext: ClContext) workGroupSize = + + let existsDense = + ClArray.exists predicate clContext workGroupSize + + fun (processor: MailboxProcessor<_>) (vector: ClVector<'a>) -> + match vector with + | ClVector.Dense vector -> existsDense processor vector + | _ -> failwith "Unsupported format" + + /// + /// Applies a function to each value of the vector, threading an accumulator argument through the computation. + /// Begin by applying the function to the first two values. + /// Then feed this result into the function along with the third value and so on. + /// Return the final result. + /// + /// + /// Implicit zeroes are ignored during the computation. + /// + /// + /// OpenCL context. + /// Should be a power of 2 and greater than 1. let reduce (opAdd: Expr<'a -> 'a -> 'a>) (clContext: ClContext) workGroupSize = let sparseReduce = Sparse.Vector.reduce opAdd clContext workGroupSize diff --git a/src/GraphBLAS-sharp/Objects/Matrix.fs b/src/GraphBLAS-sharp/Objects/Matrix.fs index 45754431..e74e9153 100644 --- a/src/GraphBLAS-sharp/Objects/Matrix.fs +++ b/src/GraphBLAS-sharp/Objects/Matrix.fs @@ -1,8 +1,8 @@ namespace GraphBLAS.FSharp.Objects open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClMatrix +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClMatrix module Matrix = type CSR<'a when 'a: struct> = diff --git a/src/GraphBLAS-sharp/Objects/MatrixExtensions.fs b/src/GraphBLAS-sharp/Objects/MatrixExtensions.fs index f310ca31..a0e8332a 100644 --- a/src/GraphBLAS-sharp/Objects/MatrixExtensions.fs +++ b/src/GraphBLAS-sharp/Objects/MatrixExtensions.fs @@ -1,9 +1,9 @@ namespace GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects open Brahma.FSharp open Matrix -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ArraysExtensions open GraphBLAS.FSharp.Objects.ClVectorExtensions module MatrixExtensions = diff --git a/src/GraphBLAS-sharp/Objects/Vector.fs b/src/GraphBLAS-sharp/Objects/Vector.fs index 19b7e01a..6462109d 100644 --- a/src/GraphBLAS-sharp/Objects/Vector.fs +++ b/src/GraphBLAS-sharp/Objects/Vector.fs @@ -1,9 +1,9 @@ namespace GraphBLAS.FSharp.Objects open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClVector +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClVector module Vector = type Sparse<'a> = diff --git a/src/GraphBLAS-sharp/Objects/VectorExtensions.fs b/src/GraphBLAS-sharp/Objects/VectorExtensions.fs index 4bdb6a01..cfe098e7 100644 --- a/src/GraphBLAS-sharp/Objects/VectorExtensions.fs +++ b/src/GraphBLAS-sharp/Objects/VectorExtensions.fs @@ -1,8 +1,8 @@ namespace GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.Vector +open GraphBLAS.FSharp.Objects.ArraysExtensions module ClVectorExtensions = type ClVector.Sparse<'a> with diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/BFS.fs b/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/BFS.fs index a85d8424..110dddec 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/BFS.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/BFS.fs @@ -1,14 +1,12 @@ module GraphBLAS.FSharp.Tests.Backend.Algorithms.BFS open Expecto -open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Tests.Backend.QuickGraph.Algorithms open GraphBLAS.FSharp.Tests.Backend.QuickGraph.CreateGraph -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions open GraphBLAS.FSharp.Objects @@ -28,6 +26,20 @@ let testFixtures (testContext: TestContext) = context workGroupSize + let bfsSparse = + Algorithms.BFS.singleSourceSparse + ArithmeticOperations.boolSumOption + ArithmeticOperations.boolMulOption + context + workGroupSize + + let bfsPushPull = + Algorithms.BFS.singleSourcePushPull + ArithmeticOperations.boolSumOption + ArithmeticOperations.boolMulOption + context + workGroupSize + testPropertyWithConfig config testName <| fun (matrix: int [,]) -> @@ -46,23 +58,41 @@ let testFixtures (testContext: TestContext) = let matrixHost = Utils.createMatrixFromArray2D CSR matrix ((=) 0) + let matrixHostBool = + Utils.createMatrixFromArray2D CSR (Array2D.map (fun x -> x <> 0) matrix) ((=) false) + let matrix = matrixHost.ToDevice context + let matrixBool = matrixHostBool.ToDevice context + + let res = bfs queue matrix source + + let resSparse = bfsSparse queue matrixBool source + + let resPushPull = bfsPushPull queue matrixBool source + + let resHost = res.ToHost queue + let resHostSparse = resSparse.ToHost queue + let resHostPushPull = resPushPull.ToHost queue - match matrix with - | ClMatrix.CSR mtx -> - let res = bfs queue mtx source |> ClVector.Dense + matrix.Dispose queue + matrixBool.Dispose queue + res.Dispose queue + resSparse.Dispose queue + resPushPull.Dispose queue - let resHost = res.ToHost queue + match resHost, resHostSparse, resHostPushPull with + | Vector.Dense resHost, Vector.Dense resHostSparse, Vector.Dense resHostPushPull -> + let actual = resHost |> Utils.unwrapOptionArray 0 - (mtx :> IDeviceMemObject).Dispose queue - res.Dispose queue + let actualSparse = + resHostSparse |> Utils.unwrapOptionArray 0 - match resHost with - | Vector.Dense resHost -> - let actual = resHost |> Utils.unwrapOptionArray 0 + let actualPushPull = + resHostPushPull |> Utils.unwrapOptionArray 0 - Expect.sequenceEqual actual expected "Sequences must be equal" - | _ -> failwith "Not implemented" + Expect.sequenceEqual actual expected "Dense bfs is not as expected" + Expect.sequenceEqual actualSparse expected "Sparse bfs is not as expected" + Expect.sequenceEqual actualPushPull expected "Push-pull bfs is not as expected" | _ -> failwith "Not implemented" ] let tests = diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/SSSP.fs b/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/SSSP.fs new file mode 100644 index 00000000..fa9cdff7 --- /dev/null +++ b/tests/GraphBLAS-sharp.Tests/Backend/Algorithms/SSSP.fs @@ -0,0 +1,64 @@ +module GraphBLAS.FSharp.Tests.Backend.Algorithms.SSSP + +open Expecto +open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Tests.Context +open GraphBLAS.FSharp.Tests.Backend.QuickGraph.Algorithms +open GraphBLAS.FSharp.Tests.Backend.QuickGraph.CreateGraph +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClVectorExtensions + +let testFixtures (testContext: TestContext) = + [ let config = Utils.undirectedAlgoConfig + let context = testContext.ClContext + let queue = testContext.Queue + let workGroupSize = Utils.defaultWorkGroupSize + + let testName = + sprintf "Test on %A" testContext.ClContext + + let ssspDense = + Algorithms.SSSP.run context workGroupSize + + testPropertyWithConfig config testName + <| fun (matrix: int [,]) -> + + let matrix = Array2D.map (fun x -> abs x) matrix + + let graph = undirectedFromArray2D matrix 0 + + let largestComponent = + ConnectedComponents.largestComponent graph + + if largestComponent.Length > 0 then + let source = largestComponent.[0] + + let expected = + SSSP.runUndirected matrix (directedFromArray2D matrix 0) source + |> Array.map (Option.map int) + + let matrixHost = + Utils.createMatrixFromArray2D CSR matrix ((=) 0) + + let matrix = matrixHost.ToDevice context + + let resDense = + ssspDense queue matrix source |> ClVector.Dense + + let resHost = resDense.ToHost queue + + matrix.Dispose queue + resDense.Dispose queue + + match resHost with + | Vector.Dense resHost -> + let actual = resHost + + Expect.sequenceEqual actual expected "Sequences must be equal" + | _ -> failwith "Not implemented" ] + +let tests = + TestCases.gpuTests "SSSP tests" testFixtures diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Blit.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Blit.fs index 771f3501..8387bdcc 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Blit.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Blit.fs @@ -2,10 +2,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Blit open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Choose.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Choose.fs index c79d035f..3fd89e84 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Choose.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Choose.fs @@ -1,13 +1,13 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Choose -open GraphBLAS.FSharp.Backend.Common open Expecto +open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context -open GraphBLAS.FSharp.Backend.Objects.ClContext -open Brahma.FSharp open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions let workGroupSize = Utils.defaultWorkGroupSize @@ -65,18 +65,19 @@ let makeTest2 testContext isEqual opMap testFun (firstArray: 'a [], secondArray: Array.map2 opMap firstArray secondArray |> Array.choose id - let clFirstArray = context.CreateClArray firstArray - let clSecondArray = context.CreateClArray secondArray + if expected.Length > 0 then + let clFirstArray = context.CreateClArray firstArray + let clSecondArray = context.CreateClArray secondArray - let (clActual: ClArray<_>) = - testFun processor HostInterop clFirstArray clSecondArray + let (clActual: ClArray<_>) = + testFun processor HostInterop clFirstArray clSecondArray - let actual = clActual.ToHostAndFree processor - clFirstArray.Free processor - clSecondArray.Free processor + let actual = clActual.ToHostAndFree processor + clFirstArray.Free processor + clSecondArray.Free processor - "Results must be the same" - |> Utils.compareArrays isEqual actual expected + "Results must be the same" + |> Utils.compareArrays isEqual actual expected let createTest2 testsContext (isEqual: 'a -> 'a -> bool) (opMapQ, opMap) testFun = testFun opMapQ testsContext.ClContext Utils.defaultWorkGroupSize diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/ChunkBySize.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/ChunkBySize.fs index ae282f9a..2cc3133e 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/ChunkBySize.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/ChunkBySize.fs @@ -2,11 +2,11 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.ChunkBySize open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Concat.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Concat.fs index d27cdebf..48dcb77c 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Concat.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Concat.fs @@ -2,10 +2,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Concat open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Copy.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Copy.fs index 2c8d2ba2..c36475a0 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Copy.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Copy.fs @@ -4,10 +4,10 @@ open Expecto open Expecto.Logging open Expecto.Logging.Message open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let logger = Log.create "ClArray.Copy.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Exists.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Exists.fs index ff061074..ac991951 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Exists.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Exists.fs @@ -2,13 +2,13 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Exists open Expecto open Expecto.Logging -open GraphBLAS.FSharp.Backend.Common +open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests open Context -open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClCellExtensions open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Objects.ClCell let logger = Log.create "ClArray.containsNonZero.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Fill.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Fill.fs index 0921ff26..8a285a2f 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Fill.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Fill.fs @@ -2,11 +2,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Fill open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Item.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Item.fs index 352f2517..a3786832 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Item.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Item.fs @@ -2,11 +2,11 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Item open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map.fs index a49ea492..b87816ba 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map.fs @@ -1,12 +1,12 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Map +open Expecto open Brahma.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Backend.Common open GraphBLAS.FSharp.Backend.Quotes -open Expecto -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let context = defaultContext.Queue @@ -44,7 +44,7 @@ let createTest<'a when 'a: equality> (testContext: TestContext) (zero: 'a) isEqu let context = testContext.ClContext let map = - ClArray.map (Map.optionToValueOrZero zero) context wgSize + Map.map (Map.optionToValueOrZero zero) context wgSize makeTest testContext map zero isEqual |> testPropertyWithConfig config $"Correctness on {typeof<'a>}" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map2.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map2.fs index ae4342b8..69b28dad 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map2.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Map2.fs @@ -1,11 +1,12 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Map2 +open Expecto open Brahma.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Backend.Common -open Expecto -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions + let context = defaultContext.Queue @@ -42,7 +43,7 @@ let createTest<'a when 'a: equality> (testContext: TestContext) isEqual hostMapF let context = testContext.ClContext - let map = ClArray.map2 mapFunQ context wgSize + let map = Map.map2 mapFunQ context wgSize makeTest<'a> testContext map hostMapFun isEqual |> testPropertyWithConfig config $"Correctness on {typeof<'a>}" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Pairwise.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Pairwise.fs index 5bd6957d..12db7aa8 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Pairwise.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Pairwise.fs @@ -2,11 +2,11 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Pairwise open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/RemoveDuplicates.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/RemoveDuplicates.fs index 1f8e3f7d..276cf286 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/RemoveDuplicates.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/RemoveDuplicates.fs @@ -4,8 +4,8 @@ open Expecto open Expecto.Logging open Expecto.Logging.Message open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Common let logger = Log.create "RemoveDuplicates.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Replicate.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Replicate.fs index 0299eb05..2d6ecc6b 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Replicate.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Replicate.fs @@ -4,10 +4,10 @@ open Expecto open Expecto.Logging open Expecto.Logging.Message open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let logger = Log.create "Replicate.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Set.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Set.fs index a393b499..cf1d09e5 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Set.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/Set.fs @@ -2,10 +2,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.Set open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/UpperBound.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/UpperBound.fs index 78905478..7f1f2c81 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/UpperBound.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/UpperBound.fs @@ -2,10 +2,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.ClArray.UpperBound open Expecto open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp.Objects.ClCellExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Gather.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Gather.fs index 3019d9d3..b82b65d6 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Gather.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Gather.fs @@ -1,11 +1,11 @@ module GraphBLAS.FSharp.Tests.Backend.Common.Gather -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Tests open Expecto open Microsoft.FSharp.Collections -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Backend.Quotes let context = Context.defaultContext.ClContext @@ -55,14 +55,14 @@ let createTest<'a> (isEqual: 'a -> 'a -> bool) testFun = |> testPropertyWithConfig Utils.defaultConfig $"test on %A{typeof<'a>}" let tests = - [ createTest (=) Gather.run + [ createTest (=) Common.Gather.run if Utils.isFloat64Available context.ClDevice then - createTest Utils.floatIsEqual Gather.run + createTest Utils.floatIsEqual Common.Gather.run - createTest Utils.float32IsEqual Gather.run - createTest (=) Gather.run - createTest (=) Gather.run ] + createTest Utils.float32IsEqual Common.Gather.run + createTest (=) Common.Gather.run + createTest (=) Common.Gather.run ] |> testList "Gather" @@ -98,27 +98,27 @@ let createTestInit<'a> (isEqual: 'a -> 'a -> bool) testFun indexMapQ indexMap = let initTests = let idTests = - [ createTestInit (=) Gather.runInit Map.id id + [ createTestInit (=) Common.Gather.runInit Map.id id if Utils.isFloat64Available context.ClDevice then - createTestInit Utils.floatIsEqual Gather.runInit Map.id id + createTestInit Utils.floatIsEqual Common.Gather.runInit Map.id id - createTestInit Utils.float32IsEqual Gather.runInit Map.id id - createTestInit (=) Gather.runInit Map.id id - createTestInit (=) Gather.runInit Map.id id ] + createTestInit Utils.float32IsEqual Common.Gather.runInit Map.id id + createTestInit (=) Common.Gather.runInit Map.id id + createTestInit (=) Common.Gather.runInit Map.id id ] |> testList "id" let inc = ((+) 1) let incTests = - [ createTestInit (=) Gather.runInit Map.inc inc + [ createTestInit (=) Common.Gather.runInit Map.inc inc if Utils.isFloat64Available context.ClDevice then - createTestInit Utils.floatIsEqual Gather.runInit Map.inc inc + createTestInit Utils.floatIsEqual Common.Gather.runInit Map.inc inc - createTestInit Utils.float32IsEqual Gather.runInit Map.inc inc - createTestInit (=) Gather.runInit Map.inc inc - createTestInit (=) Gather.runInit Map.inc inc ] + createTestInit Utils.float32IsEqual Common.Gather.runInit Map.inc inc + createTestInit (=) Common.Gather.runInit Map.inc inc + createTestInit (=) Common.Gather.runInit Map.inc inc ] |> testList "inc" testList "init" [ idTests; incTests ] diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Merge.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Merge.fs deleted file mode 100644 index d937da3c..00000000 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Merge.fs +++ /dev/null @@ -1,54 +0,0 @@ -module GraphBLAS.FSharp.Tests.Common.Merge - -open Expecto -open Brahma.FSharp -open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions - -let context = Context.defaultContext.ClContext - -let processor = Context.defaultContext.Queue - -let config = - { Utils.defaultConfig with - endSize = 10000000 } - -let makeTest isEqual testFun (leftArray: 'a []) (rightArray: 'a []) = - if leftArray.Length > 0 && rightArray.Length > 0 then - - let leftArray = Array.sort leftArray |> Array.distinct - - let rightArray = Array.sort rightArray |> Array.distinct - - let clLeftArray = context.CreateClArray leftArray - let clRightArray = context.CreateClArray rightArray - - let clResult: ClArray<'a> = - testFun processor clLeftArray clRightArray - - let result = clResult.ToHostAndFree processor - clLeftArray.Free processor - clRightArray.Free processor - - let expected = - Array.concat [ leftArray; rightArray ] - |> Array.sort - - "Results must be the same" - |> Utils.compareArrays isEqual result expected - -let createTest<'a> isEqual = - Merge.run context Utils.defaultWorkGroupSize - |> makeTest isEqual - |> testPropertyWithConfig config $"test on {typeof<'a>}" - -let tests = - [ createTest (=) - - if Utils.isFloat64Available context.ClDevice then - createTest (=) - - createTest (=) - createTest (=) ] - |> testList "Merge" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Reduce.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Reduce.fs index 3500e639..54dfee30 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Reduce.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Reduce.fs @@ -4,10 +4,10 @@ open Expecto open Expecto.Logging open Expecto.Logging.Message open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let logger = Log.create "Reduce.Tests" @@ -52,7 +52,8 @@ let makeTest (reduce: MailboxProcessor<_> -> ClArray<'a> -> ClCell<'a>) plus zer |> Expect.equal actualSum expectedSum let testFixtures plus plusQ zero name = - let reduce = Reduce.reduce plusQ context wgSize + let reduce = + Common.Reduce.reduce plusQ context wgSize makeTest reduce plus zero |> testPropertyWithConfig config $"Correctness on %s{name}" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/ReduceByKey.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/ReduceByKey.fs index 772eafb5..1ff419ef 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/ReduceByKey.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/ReduceByKey.fs @@ -1,13 +1,13 @@ module GraphBLAS.FSharp.Tests.Backend.Common.Reduce.ByKey open Expecto -open GraphBLAS.FSharp.Backend.Common +open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ClContext -open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext @@ -63,7 +63,7 @@ let makeTest isEqual reduce reduceOp (arrayAndKeys: (int * 'a) []) = let createTestSequential<'a> (isEqual: 'a -> 'a -> bool) reduceOp reduceOpQ = let reduce = - Reduce.ByKey.sequential reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey.sequential reduceOpQ context Utils.defaultWorkGroupSize makeTest isEqual reduce reduceOp |> testPropertyWithConfig config $"test on {typeof<'a>}" @@ -97,7 +97,7 @@ let sequentialTest = let createTestOneWorkGroup<'a> (isEqual: 'a -> 'a -> bool) reduceOp reduceOpQ = let reduce = - Reduce.ByKey.oneWorkGroupSegments reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey.oneWorkGroupSegments reduceOpQ context Utils.defaultWorkGroupSize makeTest isEqual reduce reduceOp |> testPropertyWithConfig @@ -166,7 +166,7 @@ let makeTestSequentialSegments isEqual reduce reduceOp (valuesAndKeys: (int * 'a let createTestSequentialSegments<'a> (isEqual: 'a -> 'a -> bool) reduceOp reduceOpQ = let reduce = - Reduce.ByKey.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize makeTestSequentialSegments isEqual reduce reduceOp |> testPropertyWithConfig { config with startSize = 1000 } $"test on {typeof<'a>}" @@ -252,7 +252,7 @@ let makeTest2D isEqual reduce reduceOp (array: (int * int * 'a) []) = let createTestSequential2D<'a> (isEqual: 'a -> 'a -> bool) reduceOp reduceOpQ = let reduce = - Reduce.ByKey2D.sequential reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey2D.sequential reduceOpQ context Utils.defaultWorkGroupSize makeTest2D isEqual reduce reduceOp |> testPropertyWithConfig @@ -331,7 +331,7 @@ let makeTestSequentialSegments2D isEqual reduce reduceOp (array: (int * int * 'a let createTestSequentialSegments2D<'a> (isEqual: 'a -> 'a -> bool) reduceOp reduceOpQ = let reduce = - Reduce.ByKey2D.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey2D.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize makeTestSequentialSegments2D isEqual reduce reduceOp |> testPropertyWithConfig @@ -430,7 +430,7 @@ let testOption<'a> isEqual reduceOp testFun (array: (int * 'a) []) = |> checkResultOption isEqual keys values reduceOp let createTestOption (isEqual: 'a -> 'a -> bool) (reduceOpQ, reduceOp) = - Reduce.ByKey.Option.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey.Option.segmentSequentialByOffsets reduceOpQ context Utils.defaultWorkGroupSize |> testOption<'a> isEqual reduceOp |> testPropertyWithConfig { config with @@ -518,7 +518,7 @@ let test2DOption<'a> isEqual reduceOp reduce (array: (int * int * 'a) []) = |> checkResult2DOption isEqual firstKeys secondKeys values reduceOp let createTest2DOption (isEqual: 'a -> 'a -> bool) (reduceOpQ, reduceOp) = - Reduce.ByKey2D.Option.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize + Common.Reduce.ByKey2D.Option.segmentSequential reduceOpQ context Utils.defaultWorkGroupSize |> test2DOption<'a> isEqual reduceOp |> testPropertyWithConfig { config with diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Sum.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Sum.fs index 977b085e..3953c3c0 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Sum.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Reduce/Sum.fs @@ -3,13 +3,13 @@ module GraphBLAS.FSharp.Tests.Backend.Common.Reduce.Sum open Expecto open Expecto.Logging open Expecto.Logging.Message +open FSharp.Quotations open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common open GraphBLAS.FSharp.Tests -open FSharp.Quotations open Context -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open GraphBLAS.FSharp.Backend.Objects.ClCell +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClCellExtensions let logger = Log.create "Sum.Test" @@ -51,7 +51,7 @@ let makeTest plus zero sum (array: 'a []) = |> Expect.equal actualSum expectedSum let testFixtures plus (plusQ: Expr<'a -> 'a -> 'a>) zero name = - Reduce.sum plusQ zero context wgSize + Common.Reduce.sum plusQ zero context wgSize |> makeTest plus zero |> testPropertyWithConfig config (sprintf "Correctness on %s" name) diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/ByKey.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/ByKey.fs index a89b5f36..1cea79dd 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/ByKey.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/ByKey.fs @@ -1,10 +1,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.Scan.ByKey -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ClContext open Expecto +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions let context = Context.defaultContext.ClContext @@ -60,7 +60,7 @@ let createTest (zero: 'a) opAddQ opAdd isEqual deviceScan hostScan = let sequentialSegmentsTests = let excludeTests = - [ createTest 0 <@ (+) @> (+) (=) PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude + [ createTest 0 <@ (+) @> (+) (=) Common.PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude if Utils.isFloat64Available context.ClDevice then createTest @@ -68,7 +68,7 @@ let sequentialSegmentsTests = <@ (+) @> (+) Utils.floatIsEqual - PrefixSum.ByKey.sequentialExclude + Common.PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude createTest @@ -76,15 +76,15 @@ let sequentialSegmentsTests = <@ (+) @> (+) Utils.float32IsEqual - PrefixSum.ByKey.sequentialExclude + Common.PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude - createTest false <@ (||) @> (||) (=) PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude - createTest 0u <@ (+) @> (+) (=) PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude ] + createTest false <@ (||) @> (||) (=) Common.PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude + createTest 0u <@ (+) @> (+) (=) Common.PrefixSum.ByKey.sequentialExclude HostPrimitives.prefixSumExclude ] |> testList "exclude" let includeTests = - [ createTest 0 <@ (+) @> (+) (=) PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude + [ createTest 0 <@ (+) @> (+) (=) Common.PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude if Utils.isFloat64Available context.ClDevice then createTest @@ -92,7 +92,7 @@ let sequentialSegmentsTests = <@ (+) @> (+) Utils.floatIsEqual - PrefixSum.ByKey.sequentialInclude + Common.PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude createTest @@ -100,12 +100,15 @@ let sequentialSegmentsTests = <@ (+) @> (+) Utils.float32IsEqual - PrefixSum.ByKey.sequentialInclude + Common.PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude - createTest false <@ (||) @> (||) (=) PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude - createTest 0u <@ (+) @> (+) (=) PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude ] + createTest false <@ (||) @> (||) (=) Common.PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude + createTest 0u <@ (+) @> (+) (=) Common.PrefixSum.ByKey.sequentialInclude HostPrimitives.prefixSumInclude ] |> testList "include" testList "Sequential segments" [ excludeTests; includeTests ] + +let tests = + testList "ByKey" [ sequentialSegmentsTests ] diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/PrefixSum.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/PrefixSum.fs index fbf12398..f94b0564 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/PrefixSum.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Scan/PrefixSum.fs @@ -4,11 +4,10 @@ open Expecto open Expecto.Logging open Expecto.Logging.Message open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Tests.Context +open GraphBLAS.FSharp.Objects.ClCellExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let logger = Log.create "ClArray.PrefixSum.Tests" @@ -61,7 +60,7 @@ let makeTest plus zero isEqual scan (array: 'a []) = |> Tests.Utils.compareArrays isEqual actual expected let testFixtures plus plusQ zero isEqual name = - PrefixSum.runIncludeInPlace plusQ context wgSize + Common.PrefixSum.runIncludeInPlace plusQ context wgSize |> makeTest plus zero isEqual |> testPropertyWithConfig config $"Correctness on %s{name}" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Scatter.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Scatter.fs index a72de22b..c1d71dca 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Scatter.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Scatter.fs @@ -3,11 +3,11 @@ module GraphBLAS.FSharp.Tests.Backend.Common.Scatter open Expecto open Expecto.Logging open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let logger = Log.create "Scatter.Tests" @@ -41,12 +41,12 @@ let makeTest<'a when 'a: equality> hostScatter scatter (array: (int * 'a) []) (r |> Utils.compareArrays (=) actual expected let testFixturesLast<'a when 'a: equality> = - Scatter.lastOccurrence context wgSize + Common.Scatter.lastOccurrence context wgSize |> makeTest<'a> HostPrimitives.scatterLastOccurrence |> testPropertyWithConfig config $"Correctness on %A{typeof<'a>}" let testFixturesFirst<'a when 'a: equality> = - Scatter.firstOccurrence context wgSize + Common.Scatter.firstOccurrence context wgSize |> makeTest<'a> HostPrimitives.scatterFirstOccurrence |> testPropertyWithConfig config $"Correctness on %A{typeof<'a>}" @@ -100,13 +100,13 @@ let initTests = let inc = ((+) 1) let firstOccurrence = - [ createInitTest Scatter.initFirsOccurrence HostPrimitives.scatterFirstOccurrence "id" id Map.id - createInitTest Scatter.initFirsOccurrence HostPrimitives.scatterFirstOccurrence "inc" inc Map.inc ] + [ createInitTest Common.Scatter.initFirstOccurrence HostPrimitives.scatterFirstOccurrence "id" id Map.id + createInitTest Common.Scatter.initFirstOccurrence HostPrimitives.scatterFirstOccurrence "inc" inc Map.inc ] |> testList "first occurrence" let lastOccurrence = - [ createInitTest Scatter.initLastOccurrence HostPrimitives.scatterLastOccurrence "id" id Map.id - createInitTest Scatter.initLastOccurrence HostPrimitives.scatterLastOccurrence "inc" inc Map.inc ] + [ createInitTest Common.Scatter.initLastOccurrence HostPrimitives.scatterLastOccurrence "id" id Map.id + createInitTest Common.Scatter.initLastOccurrence HostPrimitives.scatterLastOccurrence "inc" inc Map.inc ] |> testList "last occurrence" testList "init" [ firstOccurrence; lastOccurrence ] diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Bitonic.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Bitonic.fs index 60705e76..6297fe13 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Bitonic.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Bitonic.fs @@ -3,11 +3,10 @@ namespace GraphBLAS.FSharp.Tests.Backend.Common.Sort open Expecto open Expecto.Logging open Expecto.Logging.Message -open GraphBLAS.FSharp.Backend.Common open Brahma.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions module Bitonic = let logger = Log.create "BitonicSort.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Radix.fs b/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Radix.fs index 2f565f3e..44206379 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Radix.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Common/Sort/Radix.fs @@ -1,11 +1,10 @@ module GraphBLAS.FSharp.Tests.Backend.Common.Sort.Radix open Expecto -open GraphBLAS.FSharp.Backend.Common.Sort -open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions let config = { Utils.defaultConfig with @@ -17,8 +16,13 @@ let processor = Context.defaultContext.Queue let context = Context.defaultContext.ClContext -let checkResultByKeys (inputArray: (int * 'a) []) (actualValues: 'a []) = - let expectedValues = Seq.sortBy fst inputArray |> Seq.map snd +let checkResultByKeys (inputArray: (int * 'a) []) (actualKeys: int []) (actualValues: 'a []) = + let expected = Seq.sortBy fst inputArray + let expectedKeys = expected |> Seq.map fst + let expectedValues = expected |> Seq.map snd + + "Keys must be the same" + |> Expect.sequenceEqual expectedKeys actualKeys "Values must be the same" |> Expect.sequenceEqual expectedValues actualValues @@ -32,16 +36,17 @@ let makeTestByKeys<'a when 'a: equality> sortFun (array: (int * 'a) []) = let clKeys = keys.ToDevice context let clValues = values.ToDevice context - let clActualValues: ClArray<'a> = + let clActualKeys, clActualValues: ClArray * ClArray<'a> = sortFun processor HostInterop clKeys clValues + let actualKeys = clActualKeys.ToHostAndFree processor let actualValues = clActualValues.ToHostAndFree processor - checkResultByKeys array actualValues + checkResultByKeys array actualKeys actualValues let createTestByKeys<'a when 'a: equality and 'a: struct> = let sort = - Radix.runByKeysStandard context workGroupSize + Sort.Radix.runByKeysStandard context workGroupSize makeTestByKeys<'a> sort |> testPropertyWithConfig config $"test on {typeof<'a>}" @@ -74,7 +79,7 @@ let makeTestKeysOnly sort (keys: uint []) = let testKeysOnly = let sort = - Radix.standardRunKeysOnly context workGroupSize + Sort.Radix.standardRunKeysOnly context workGroupSize makeTestKeysOnly sort |> testPropertyWithConfig config $"keys only" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ByRows.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ByRows.fs index 98270784..caa86e58 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ByRows.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ByRows.fs @@ -1,12 +1,12 @@ -module GraphBLAS.FSharp.Tests.Matrix.ByRows +module GraphBLAS.FSharp.Tests.Backend.Matrix.ByRows open Expecto open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Objects.ClVectorExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Convert.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Convert.fs index c27bf511..8e88e216 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Convert.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Convert.fs @@ -3,14 +3,13 @@ module GraphBLAS.FSharp.Tests.Backend.Matrix.Convert open Expecto open Expecto.Logging open Expecto.Logging.Message +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Objects.MatrixExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Convert.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ExpandRows.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ExpandRows.fs index 413df587..63cd8bee 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ExpandRows.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/ExpandRows.fs @@ -1,13 +1,13 @@ module GraphBLAS.FSharp.Tests.Backend.Matrix.ExpandRows open Expecto +open Brahma.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Kronecker.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Kronecker.fs index add171ee..6d0f8d01 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Kronecker.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Kronecker.fs @@ -2,15 +2,13 @@ open Expecto open Expecto.Logging +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Tests.TestCases -open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.MatrixExtensions +open GraphBLAS.FSharp.Backend.Quotes let config = { Utils.defaultConfig with @@ -48,7 +46,7 @@ let makeTest testContext zero isEqual op kroneckerFun (leftMatrix: 'a [,], right let m2 = m2.ToDevice context let result = - kroneckerFun processor ClContext.HostInterop m1 m2 + kroneckerFun processor ClContextExtensions.HostInterop m1 m2 let actual = Option.map (fun (m: ClMatrix<'a>) -> m.ToHost processor) result @@ -65,7 +63,7 @@ let makeTest testContext zero isEqual op kroneckerFun (leftMatrix: 'a [,], right |> Expect.equal actual expectedOption let createGeneralTest testContext (zero: 'a) isEqual op opQ testName = - Matrix.kronecker opQ testContext.ClContext workGroupSize + Operations.kronecker opQ testContext.ClContext workGroupSize |> makeTest testContext zero isEqual op |> testPropertyWithConfig config $"test on %A{typeof<'a>} %s{testName}" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map.fs index 6276019b..e61d65bf 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map.fs @@ -4,15 +4,14 @@ open Expecto open Expecto.Logging open Expecto.Logging.Message open Microsoft.FSharp.Collections +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Objects.ClContext open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Backend open GraphBLAS.FSharp.Tests.TestCases open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Objects.MatrixExtensions let logger = Log.create "Map.Tests" @@ -98,7 +97,8 @@ let createTestMap case (zero: 'a) (constant: 'a) binOp isEqual opQ = let unaryOp = binOp constant let unaryOpQ = opQ zero constant - let map = Matrix.map unaryOpQ context wgSize + let map = + Operations.Matrix.map unaryOpQ context wgSize let toCOO = Matrix.toCOO context wgSize diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map2.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map2.fs index 1a8e2dab..9d746f11 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map2.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Map2.fs @@ -3,24 +3,23 @@ module GraphBLAS.FSharp.Tests.Backend.Matrix.Map2 open Expecto open Expecto.Logging open Expecto.Logging.Message +open Microsoft.FSharp.Collections +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.TestCases -open Microsoft.FSharp.Collections -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Tests.Backend +open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.MatrixExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Map2.Tests" let config = Utils.defaultConfig let wgSize = Utils.defaultWorkGroupSize -let getCorrectnessTestName case datatype = +let getCorrectTestName case datatype = $"Correctness on %s{datatype}, %A{case}" let checkResult isEqual op zero (baseMtx1: 'a [,]) (baseMtx2: 'a [,]) (actual: Matrix<'a>) = @@ -95,8 +94,8 @@ let correctnessGenericTest | ex when ex.Message = "InvalidBufferSize" -> () | ex -> raise ex -let creatTestMap2Add case (zero: 'a) add isEqual addQ map2 = - let getCorrectnessTestName = getCorrectnessTestName case +let createTestMap2Add case (zero: 'a) add isEqual addQ map2 = + let getCorrectnessTestName = getCorrectTestName case let context = case.TestContext.ClContext let q = case.TestContext.Queue @@ -114,14 +113,14 @@ let testFixturesMap2Add case = let q = case.TestContext.Queue q.Error.Add(fun e -> failwithf "%A" e) - creatTestMap2Add case false (||) (=) ArithmeticOperations.boolSumOption Matrix.map2 - creatTestMap2Add case 0 (+) (=) ArithmeticOperations.intSumOption Matrix.map2 + createTestMap2Add case false (||) (=) ArithmeticOperations.boolSumOption Operations.Matrix.map2 + createTestMap2Add case 0 (+) (=) ArithmeticOperations.intSumOption Operations.Matrix.map2 if Utils.isFloat64Available context.ClDevice then - creatTestMap2Add case 0.0 (+) Utils.floatIsEqual ArithmeticOperations.floatSumOption Matrix.map2 + createTestMap2Add case 0.0 (+) Utils.floatIsEqual ArithmeticOperations.floatSumOption Operations.Matrix.map2 - creatTestMap2Add case 0.0f (+) Utils.float32IsEqual ArithmeticOperations.float32SumOption Matrix.map2 - creatTestMap2Add case 0uy (+) (=) ArithmeticOperations.byteSumOption Matrix.map2 ] + createTestMap2Add case 0.0f (+) Utils.float32IsEqual ArithmeticOperations.float32SumOption Operations.Matrix.map2 + createTestMap2Add case 0uy (+) (=) ArithmeticOperations.byteSumOption Operations.Matrix.map2 ] let addTests = operationGPUTests "Backend.Matrix.map2 add tests" testFixturesMap2Add @@ -131,21 +130,27 @@ let testFixturesMap2AddAtLeastOne case = let q = case.TestContext.Queue q.Error.Add(fun e -> failwithf "%A" e) - creatTestMap2Add case false (||) (=) ArithmeticOperations.boolSumAtLeastOne Matrix.map2AtLeastOne - creatTestMap2Add case 0 (+) (=) ArithmeticOperations.intSumAtLeastOne Matrix.map2AtLeastOne + createTestMap2Add case false (||) (=) ArithmeticOperations.boolSumAtLeastOne Operations.Matrix.map2AtLeastOne + createTestMap2Add case 0 (+) (=) ArithmeticOperations.intSumAtLeastOne Operations.Matrix.map2AtLeastOne if Utils.isFloat64Available context.ClDevice then - creatTestMap2Add case 0.0 (+) Utils.floatIsEqual ArithmeticOperations.floatSumAtLeastOne Matrix.map2AtLeastOne - - creatTestMap2Add + createTestMap2Add + case + 0.0 + (+) + Utils.floatIsEqual + ArithmeticOperations.floatSumAtLeastOne + Operations.Matrix.map2AtLeastOne + + createTestMap2Add case 0.0f (+) Utils.float32IsEqual ArithmeticOperations.float32SumAtLeastOne - Matrix.map2AtLeastOne + Operations.Matrix.map2AtLeastOne - creatTestMap2Add case 0uy (+) (=) ArithmeticOperations.byteSumAtLeastOne Matrix.map2AtLeastOne ] + createTestMap2Add case 0uy (+) (=) ArithmeticOperations.byteSumAtLeastOne Operations.Matrix.map2AtLeastOne ] let addAtLeastOneTests = @@ -156,21 +161,27 @@ let testFixturesMap2MulAtLeastOne case = let q = case.TestContext.Queue q.Error.Add(fun e -> failwithf "%A" e) - creatTestMap2Add case false (&&) (=) ArithmeticOperations.boolMulAtLeastOne Matrix.map2AtLeastOne - creatTestMap2Add case 0 (*) (=) ArithmeticOperations.intMulAtLeastOne Matrix.map2AtLeastOne + createTestMap2Add case false (&&) (=) ArithmeticOperations.boolMulAtLeastOne Operations.Matrix.map2AtLeastOne + createTestMap2Add case 0 (*) (=) ArithmeticOperations.intMulAtLeastOne Operations.Matrix.map2AtLeastOne if Utils.isFloat64Available context.ClDevice then - creatTestMap2Add case 0.0 (*) Utils.floatIsEqual ArithmeticOperations.floatMulAtLeastOne Matrix.map2AtLeastOne - - creatTestMap2Add + createTestMap2Add + case + 0.0 + (*) + Utils.floatIsEqual + ArithmeticOperations.floatMulAtLeastOne + Operations.Matrix.map2AtLeastOne + + createTestMap2Add case 0.0f (*) Utils.float32IsEqual ArithmeticOperations.float32MulAtLeastOne - Matrix.map2AtLeastOne + Operations.Matrix.map2AtLeastOne - creatTestMap2Add case 0uy (*) (=) ArithmeticOperations.byteMulAtLeastOne Matrix.map2AtLeastOne ] + createTestMap2Add case 0uy (*) (=) ArithmeticOperations.byteMulAtLeastOne Operations.Matrix.map2AtLeastOne ] let mulAtLeastOneTests = operationGPUTests "Backend.Matrix.map2AtLeastOne multiplication tests" testFixturesMap2MulAtLeastOne diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Merge.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Merge.fs index fef357de..554fbff2 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Merge.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Merge.fs @@ -1,14 +1,13 @@ -module GraphBLAS.FSharp.Tests.Matrix.Merge +module GraphBLAS.FSharp.Tests.Backend.Matrix.Merge open Brahma.FSharp open Expecto open Microsoft.FSharp.Collections open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Backend.Matrix open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Backend open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions let context = Context.defaultContext.ClContext diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/RowsLengths.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/RowsLengths.fs index 6aab0988..f690ca3e 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/RowsLengths.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/RowsLengths.fs @@ -2,14 +2,14 @@ module GraphBLAS.FSharp.Tests.Backend.Matrix.RowsLengths open Expecto open Microsoft.FSharp.Collections +open Brahma.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Matrix open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Backend open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions let processor = Context.defaultContext.Queue diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Expand.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Expand.fs index 67eac9d3..46b1d204 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Expand.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Expand.fs @@ -1,20 +1,18 @@ -module GraphBLAS.FSharp.Tests.Matrix.SpGeMM.Expand +module GraphBLAS.FSharp.Tests.Backend.Matrix.SpGeMM.Expand open Expecto -open GraphBLAS.FSharp.Backend.Matrix.SpGeMM +open Microsoft.FSharp.Collections +open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Backend.Operations.SpGeMM +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.MatrixExtensions open GraphBLAS.FSharp.Test -open Microsoft.FSharp.Collections -open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Backend -open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions -open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Objects.MatrixExtensions let context = Context.defaultContext.ClContext @@ -215,7 +213,7 @@ let createGeneralTest (zero: 'a) isEqual (opAddQ, opAdd) (opMulQ, opMul) testFun |> testPropertyWithConfig config $"test on %A{typeof<'a>}" let generalTests = - [ createGeneralTest 0 (=) ArithmeticOperations.intAdd ArithmeticOperations.intMul Matrix.SpGeMM.expand + [ createGeneralTest 0 (=) ArithmeticOperations.intAdd ArithmeticOperations.intMul Operations.SpGeMM.expand if Utils.isFloat64Available context.ClDevice then createGeneralTest @@ -223,13 +221,16 @@ let generalTests = Utils.floatIsEqual ArithmeticOperations.floatAdd ArithmeticOperations.floatMul - Matrix.SpGeMM.expand + Operations.SpGeMM.expand createGeneralTest 0.0f Utils.float32IsEqual ArithmeticOperations.float32Add ArithmeticOperations.float32Mul - Matrix.SpGeMM.expand - createGeneralTest false (=) ArithmeticOperations.boolAdd ArithmeticOperations.boolMul Matrix.SpGeMM.expand ] - |> testList "general" + Operations.SpGeMM.expand + createGeneralTest false (=) ArithmeticOperations.boolAdd ArithmeticOperations.boolMul Operations.SpGeMM.expand ] + |> testList "General" + +let tests = + testList "SpGeMM.Expand" [ generalTests ] diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Masked.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Masked.fs index 7304b96e..18cc44c4 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Masked.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SpGeMM/Masked.fs @@ -2,14 +2,12 @@ module GraphBLAS.FSharp.Tests.Backend.Matrix.SpGeMM.Masked open Expecto open Expecto.Logging -open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Tests.Context -open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Objects.MatrixExtensions open GraphBLAS.FSharp.Test +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Tests.Context let logger = Log.create "SpGeMM.Masked.Tests" @@ -79,7 +77,7 @@ let tests = let mult = <@ fun x y -> Some(x * y) @> let mxmFun = - Matrix.SpGeMM.masked add mult context workGroupSize + Operations.SpGeMM.masked add mult context workGroupSize makeTest context q 0 (=) (+) (*) mxmFun |> testPropertyWithConfig config (getCorrectnessTestName "int") @@ -105,7 +103,7 @@ let tests = res @> let mxmFun = - Matrix.SpGeMM.masked logicalOr logicalAnd context workGroupSize + Operations.SpGeMM.masked logicalOr logicalAnd context workGroupSize makeTest context q false (=) (||) (&&) mxmFun |> testPropertyWithConfig config (getCorrectnessTestName "bool") ] diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SubRows.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SubRows.fs index e48a20e0..9a9ae54c 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SubRows.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/SubRows.fs @@ -4,10 +4,9 @@ open Expecto open GraphBLAS.FSharp.Test open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Backend -open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects.ClContext -open GraphBLAS.FSharp.Backend.Objects +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions open GraphBLAS.FSharp.Objects.MatrixExtensions open GraphBLAS.FSharp.Objects.Matrix @@ -26,13 +25,6 @@ let makeTest isEqual zero testFun (array: 'a [,], sourceRow, count) = if matrix.NNZ > 0 then - let clMatrix = matrix.ToDevice context - - let clActual: ClMatrix.COO<'a> = - testFun processor HostInterop sourceRow count clMatrix - - let actual = clActual.ToHostAndFree processor - let expected = array |> Array2D.mapi (fun rowIndex columnIndex value -> (value, rowIndex, columnIndex)) @@ -48,7 +40,15 @@ let makeTest isEqual zero testFun (array: 'a [,], sourceRow, count) = Columns = columns Values = values } - Utils.compareCOOMatrix isEqual actual expected + if expected.NNZ > 0 then + let clMatrix = matrix.ToDevice context + + let clActual: ClMatrix.COO<'a> = + testFun processor HostInterop sourceRow count clMatrix + + let actual = clActual.ToHostAndFree processor + + Utils.compareCOOMatrix isEqual actual expected let createTest isEqual (zero: 'a) = CSR.Matrix.subRows context Utils.defaultWorkGroupSize diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Transpose.fs b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Transpose.fs index 01e78bf7..e7308335 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Transpose.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Matrix/Transpose.fs @@ -3,14 +3,12 @@ module GraphBLAS.FSharp.Tests.Backend.Matrix.Transpose open Expecto open Expecto.Logging open Expecto.Logging.Message -open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.TestCases -open GraphBLAS.FSharp.Backend.Matrix -open GraphBLAS.FSharp.Backend.Objects open GraphBLAS.FSharp.Objects.MatrixExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Transpose.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/QuickGraph/Algorithms/SSSP.fs b/tests/GraphBLAS-sharp.Tests/Backend/QuickGraph/Algorithms/SSSP.fs new file mode 100644 index 00000000..ba4f3328 --- /dev/null +++ b/tests/GraphBLAS-sharp.Tests/Backend/QuickGraph/Algorithms/SSSP.fs @@ -0,0 +1,37 @@ +namespace GraphBLAS.FSharp.Tests.Backend.QuickGraph.Algorithms + +open QuikGraph +open QuikGraph.Algorithms.ShortestPath +open QuikGraph.Algorithms.Observers + +module SSSP = + let runUndirected (matrix: int [,]) (graph: AdjacencyGraph>) source = + let weight = + fun (e: Edge) -> float matrix.[e.Source, e.Target] + + let dijkstra = + DijkstraShortestPathAlgorithm>(graph, weight) + + // Attach a distance observer to give us the shortest path distances + let distObserver = + VertexDistanceRecorderObserver>(weight) + + distObserver.Attach(dijkstra) |> ignore + + // Attach a Vertex Predecessor Recorder Observer to give us the paths + let predecessorObserver = + VertexPredecessorRecorderObserver>() + + predecessorObserver.Attach(dijkstra) |> ignore + + // Run the algorithm with A set to be the source + dijkstra.Compute(source) + + let res: array = + Array.zeroCreate (Array2D.length1 matrix) + + for kvp in distObserver.Distances do + res.[kvp.Key] <- Some kvp.Value + + res.[source] <- Some 0.0 + res diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/AssignByMask.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/AssignByMask.fs index 50dab7c2..3c0fb675 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/AssignByMask.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/AssignByMask.fs @@ -2,16 +2,15 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.AssignByMask open Expecto open Expecto.Logging +open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Tests -open Brahma.FSharp open TestCases -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Vector.assignByMask.Tests" @@ -52,7 +51,7 @@ let checkResult isZero isComplemented (actual: Vector<'a>) (vector: 'a []) (mask let makeTest<'a when 'a: struct and 'a: equality> (isZero: 'a -> bool) (toDense: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>) - (fillVector: MailboxProcessor -> AllocationFlag -> ClVector<'a> -> ClVector<'a> -> ClCell<'a> -> ClVector<'a>) + (fillVector: MailboxProcessor -> AllocationFlag -> ClVector<'a> -> ClVector<'a> -> 'a -> ClVector<'a>) isComplemented case (vector: 'a [], mask: 'a [], value: 'a) @@ -73,10 +72,9 @@ let makeTest<'a when 'a: struct and 'a: equality> let clMaskVector = maskVector.ToDevice context try - let clValue = context.CreateClCell<'a> value let clActual = - fillVector q HostInterop clLeftVector clMaskVector clValue + fillVector q HostInterop clLeftVector clMaskVector value let cooClActual = toDense q HostInterop clActual diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Convert.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Convert.fs index 2f586b03..d184bc47 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Convert.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Convert.fs @@ -3,14 +3,13 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.Convert open Expecto open Expecto.Logging open Expecto.Logging.Message +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend open TestCases -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector +open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Backend.Vector.Convert.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Copy.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Copy.fs index f5d28ca3..a83a1f3f 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Copy.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Copy.fs @@ -2,14 +2,13 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.Copy open Expecto open Expecto.Logging +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Tests open TestCases -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Vector.copy.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map.fs new file mode 100644 index 00000000..c3cfeab7 --- /dev/null +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map.fs @@ -0,0 +1,146 @@ +module GraphBLAS.FSharp.Tests.Backend.Vector.Map + +open Expecto +open Expecto.Logging +open Expecto.Logging.Message +open Microsoft.FSharp.Collections +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Tests.Backend +open GraphBLAS.FSharp.Tests.TestCases +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ClVectorExtensions +open Mono.CompilerServices.SymbolWriter + +let logger = Log.create "Vector.Map.Tests" + +let config = Utils.defaultConfig +let wgSize = Utils.defaultWorkGroupSize + +let getCorrectnessTestName case datatype = + $"Correctness on %s{datatype}, %A{case}" + +let checkResult isEqual op zero (baseVector: 'a []) (actual: Vector<'b>) = + + let expectedArrayLength = baseVector.Length + + let expectedArray = Array.create expectedArrayLength zero + + for i in 0 .. expectedArrayLength - 1 do + expectedArray.[i] <- op baseVector.[i] + + let expected = + Utils.createVectorFromArray Dense expectedArray (isEqual zero) + |> Utils.vectorToDenseVector + + match actual with + | Vector.Dense actual -> + "arrays must have the same values" + |> Expect.equal actual expected + | _ -> failwith "Vector format must be Sparse." + +let correctnessGenericTest + zero + op + (addFun: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>) + (toDense: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>) + (isEqual: 'a -> 'a -> bool) + (case: OperationCase) + (array: 'a []) + = + + let isZero = (isEqual zero) + + let vectorHost = + Utils.createVectorFromArray case.Format array isZero + + if vectorHost.NNZ > 0 then + + let context = case.TestContext.ClContext + let q = case.TestContext.Queue + + let vector = vectorHost.ToDevice context + + try + let res = addFun q HostInterop vector + + vector.Dispose q + + let denseActual = toDense q HostInterop res + + let actual = denseActual.ToHost q + + res.Dispose q + denseActual.Dispose q + + checkResult isEqual op zero array actual + with + | ex when ex.Message = "InvalidBufferSize" -> () + | ex -> raise ex + +let createTestMap case (zero: 'a) (constant: 'a) binOp isEqual opQ = + let getCorrectnessTestName = getCorrectnessTestName case + + let context = case.TestContext.ClContext + let q = case.TestContext.Queue + + let unaryOp = binOp constant + let unaryOpQ = opQ zero constant + + let map = + Operations.Vector.map unaryOpQ context wgSize + + let toDense = Vector.toDense context wgSize + + case + |> correctnessGenericTest zero unaryOp map toDense isEqual + |> testPropertyWithConfig config (getCorrectnessTestName $"{typeof<'a>}") + +let testFixturesMapNot case = + [ let q = case.TestContext.Queue + q.Error.Add(fun e -> failwithf "%A" e) + + createTestMap case false true (fun _ -> not) (=) (fun _ _ -> ArithmeticOperations.notOption) ] + +let notTests = + operationGPUTests "not" testFixturesMapNot + +let testFixturesMapAdd case = + [ let context = case.TestContext.ClContext + let q = case.TestContext.Queue + q.Error.Add(fun e -> failwithf "%A" e) + + createTestMap case 0 10 (+) (=) ArithmeticOperations.addLeftConst + + if Utils.isFloat64Available context.ClDevice then + createTestMap case 0.0 10.0 (+) Utils.floatIsEqual ArithmeticOperations.addLeftConst + + createTestMap case 0.0f 10.0f (+) Utils.float32IsEqual ArithmeticOperations.addLeftConst + + createTestMap case 0uy 10uy (+) (=) ArithmeticOperations.addLeftConst ] + +let addTests = + operationGPUTests "add" testFixturesMapAdd + +let testFixturesMapMul case = + [ let context = case.TestContext.ClContext + let q = case.TestContext.Queue + q.Error.Add(fun e -> failwithf "%A" e) + + createTestMap case 0 10 (*) (=) ArithmeticOperations.mulLeftConst + + if Utils.isFloat64Available context.ClDevice then + createTestMap case 0.0 10.0 (*) Utils.floatIsEqual ArithmeticOperations.mulLeftConst + + createTestMap case 0.0f 10.0f (*) Utils.float32IsEqual ArithmeticOperations.mulLeftConst + + createTestMap case 0uy 10uy (*) (=) ArithmeticOperations.mulLeftConst ] + +let mulTests = + operationGPUTests "mul" testFixturesMapMul + +let allTests = + testList "Map" [ addTests; mulTests; notTests ] diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map2.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map2.fs index e5eadaa4..771798c7 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map2.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Map2.fs @@ -2,15 +2,14 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.Map2 open Expecto open Expecto.Logging +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Backend.Quotes open GraphBLAS.FSharp.Tests.TestCases open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Vector.ElementWise.Tests" @@ -45,7 +44,7 @@ let correctnessGenericTest isEqual zero op - (addFun: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a> -> ClVector<'a>) + (addFun: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a> -> ClVector<'a> option) (toDense: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>) case (leftArray: 'a [], rightArray: 'a []) @@ -72,17 +71,20 @@ let correctnessGenericTest let res = addFun q HostInterop firstVector secondVector - firstVector.Dispose q - secondVector.Dispose q + match res with + | Some res -> + let denseActual = toDense q HostInterop res - let denseActual = toDense q HostInterop res + let actual = denseActual.ToHost q - let actual = denseActual.ToHost q + res.Dispose q + denseActual.Dispose q - res.Dispose q - denseActual.Dispose q + checkResult isEqual zero op actual leftArray rightArray + | _ -> () - checkResult isEqual zero op actual leftArray rightArray + firstVector.Dispose q + secondVector.Dispose q with | ex when ex.Message = "InvalidBufferSize" -> () | ex -> raise ex @@ -101,42 +103,54 @@ let createTest case isEqual (zero: 'a) plus plusQ map2 = let addTestFixtures case = let context = case.TestContext.ClContext - [ createTest case (=) 0 (+) ArithmeticOperations.intSumOption Vector.map2 + [ createTest case (=) 0 (+) ArithmeticOperations.intSumOption Operations.Vector.map2 if Utils.isFloat64Available context.ClDevice then - createTest case Utils.floatIsEqual 0.0 (+) ArithmeticOperations.floatSumOption Vector.map2 + createTest case Utils.floatIsEqual 0.0 (+) ArithmeticOperations.floatSumOption Operations.Vector.map2 - createTest case Utils.float32IsEqual 0.0f (+) ArithmeticOperations.float32SumOption Vector.map2 - createTest case (=) false (||) ArithmeticOperations.boolSumOption Vector.map2 - createTest case (=) 0uy (+) ArithmeticOperations.byteSumOption Vector.map2 ] + createTest case Utils.float32IsEqual 0.0f (+) ArithmeticOperations.float32SumOption Operations.Vector.map2 + createTest case (=) false (||) ArithmeticOperations.boolSumOption Operations.Vector.map2 + createTest case (=) 0uy (+) ArithmeticOperations.byteSumOption Operations.Vector.map2 ] let addTests = operationGPUTests "add" addTestFixtures let mulTestFixtures case = let context = case.TestContext.ClContext - [ createTest case (=) 0 (*) ArithmeticOperations.intMulOption Vector.map2 + [ createTest case (=) 0 (*) ArithmeticOperations.intMulOption Operations.Vector.map2 if Utils.isFloat64Available context.ClDevice then - createTest case Utils.floatIsEqual 0.0 (*) ArithmeticOperations.floatMulOption Vector.map2 + createTest case Utils.floatIsEqual 0.0 (*) ArithmeticOperations.floatMulOption Operations.Vector.map2 - createTest case Utils.float32IsEqual 0.0f (*) ArithmeticOperations.float32MulOption Vector.map2 - createTest case (=) false (&&) ArithmeticOperations.boolMulOption Vector.map2 - createTest case (=) 0uy (*) ArithmeticOperations.byteMulOption Vector.map2 ] + createTest case Utils.float32IsEqual 0.0f (*) ArithmeticOperations.float32MulOption Operations.Vector.map2 + createTest case (=) false (&&) ArithmeticOperations.boolMulOption Operations.Vector.map2 + createTest case (=) 0uy (*) ArithmeticOperations.byteMulOption Operations.Vector.map2 ] let mulTests = operationGPUTests "mul" addTestFixtures let addAtLeastOneTestFixtures case = let context = case.TestContext.ClContext - [ createTest case (=) 0 (+) ArithmeticOperations.intSumAtLeastOne Vector.map2AtLeastOne + [ createTest case (=) 0 (+) ArithmeticOperations.intSumAtLeastOne Operations.Vector.map2AtLeastOne if Utils.isFloat64Available context.ClDevice then - createTest case Utils.floatIsEqual 0.0 (+) ArithmeticOperations.floatSumAtLeastOne Vector.map2AtLeastOne + createTest + case + Utils.floatIsEqual + 0.0 + (+) + ArithmeticOperations.floatSumAtLeastOne + Operations.Vector.map2AtLeastOne - createTest case Utils.float32IsEqual 0.0f (+) ArithmeticOperations.float32SumAtLeastOne Vector.map2AtLeastOne - createTest case (=) false (||) ArithmeticOperations.boolSumAtLeastOne Vector.map2AtLeastOne - createTest case (=) 0uy (+) ArithmeticOperations.byteSumAtLeastOne Vector.map2AtLeastOne ] + createTest + case + Utils.float32IsEqual + 0.0f + (+) + ArithmeticOperations.float32SumAtLeastOne + Operations.Vector.map2AtLeastOne + createTest case (=) false (||) ArithmeticOperations.boolSumAtLeastOne Operations.Vector.map2AtLeastOne + createTest case (=) 0uy (+) ArithmeticOperations.byteSumAtLeastOne Operations.Vector.map2AtLeastOne ] let addAtLeastOneTests = operationGPUTests "addAtLeastOne" addTestFixtures @@ -144,14 +158,26 @@ let addAtLeastOneTests = let mulAtLeastOneTestFixtures case = let context = case.TestContext.ClContext - [ createTest case (=) 0 (*) ArithmeticOperations.intMulAtLeastOne Vector.map2AtLeastOne + [ createTest case (=) 0 (*) ArithmeticOperations.intMulAtLeastOne Operations.Vector.map2AtLeastOne if Utils.isFloat64Available context.ClDevice then - createTest case Utils.floatIsEqual 0.0 (*) ArithmeticOperations.floatMulAtLeastOne Vector.map2AtLeastOne + createTest + case + Utils.floatIsEqual + 0.0 + (*) + ArithmeticOperations.floatMulAtLeastOne + Operations.Vector.map2AtLeastOne - createTest case Utils.float32IsEqual 0.0f (*) ArithmeticOperations.float32MulAtLeastOne Vector.map2AtLeastOne - createTest case (=) false (&&) ArithmeticOperations.boolMulAtLeastOne Vector.map2AtLeastOne - createTest case (=) 0uy (*) ArithmeticOperations.byteMulAtLeastOne Vector.map2AtLeastOne ] + createTest + case + Utils.float32IsEqual + 0.0f + (*) + ArithmeticOperations.float32MulAtLeastOne + Operations.Vector.map2AtLeastOne + createTest case (=) false (&&) ArithmeticOperations.boolMulAtLeastOne Operations.Vector.map2AtLeastOne + createTest case (=) 0uy (*) ArithmeticOperations.byteMulAtLeastOne Operations.Vector.map2AtLeastOne ] let mulAtLeastOneTests = operationGPUTests "mulAtLeastOne" mulTestFixtures @@ -172,7 +198,7 @@ let fillSubVectorFun value zero isEqual = let complementedGeneralTestFixtures case = let context = case.TestContext.ClContext - [ createTest case (=) 0 (fillSubVectorFun 1 0 (=)) (fillSubVectorComplementedQ 1) Vector.map2 + [ createTest case (=) 0 (fillSubVectorFun 1 0 (=)) (fillSubVectorComplementedQ 1) Operations.Vector.map2 if Utils.isFloat64Available context.ClDevice then createTest @@ -181,7 +207,7 @@ let complementedGeneralTestFixtures case = 0.0 (fillSubVectorFun 1.0 0.0 Utils.floatIsEqual) (fillSubVectorComplementedQ 1.0) - Vector.map2 + Operations.Vector.map2 createTest case @@ -189,11 +215,17 @@ let complementedGeneralTestFixtures case = 0.0f (fillSubVectorFun 1.0f 0.0f Utils.float32IsEqual) (fillSubVectorComplementedQ 1.0f) - Vector.map2 + Operations.Vector.map2 - createTest case (=) false (fillSubVectorFun true false (=)) (fillSubVectorComplementedQ true) Vector.map2 + createTest + case + (=) + false + (fillSubVectorFun true false (=)) + (fillSubVectorComplementedQ true) + Operations.Vector.map2 - createTest case (=) 0uy (fillSubVectorFun 1uy 0uy (=)) (fillSubVectorComplementedQ 1uy) Vector.map2 ] + createTest case (=) 0uy (fillSubVectorFun 1uy 0uy (=)) (fillSubVectorComplementedQ 1uy) Operations.Vector.map2 ] let complementedGeneralTests = diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Merge.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Merge.fs index af693c80..ae363e78 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Merge.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Merge.fs @@ -1,13 +1,12 @@ -module GraphBLAS.FSharp.Tests.Vector.Merge +module GraphBLAS.FSharp.Tests.Backend.Vector.Merge -open GraphBLAS.FSharp.Backend.Vector -open GraphBLAS.FSharp.Backend.Common -open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions open Brahma.FSharp open Expecto +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Objects +open GraphBLAS.FSharp.Objects.ArraysExtensions let processor = Context.defaultContext.Queue diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/OfList.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/OfList.fs index 6bc5a392..9623073f 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/OfList.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/OfList.fs @@ -2,15 +2,14 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.OfList open Expecto open Expecto.Logging +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests -open GraphBLAS.FSharp.Backend open Context open TestCases -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector +open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Vector.ofList.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Reduce.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Reduce.fs index 42f29688..7775d541 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/Reduce.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/Reduce.fs @@ -2,13 +2,12 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.Reduce open Expecto open Expecto.Logging +open Brahma.FSharp +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Tests -open Brahma.FSharp -open FSharp.Quotations open TestCases -open GraphBLAS.FSharp.Backend.Objects.ClCell -open GraphBLAS.FSharp.Backend.Vector +open GraphBLAS.FSharp.Objects.ClCellExtensions let logger = Log.create "Vector.reduce.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMSpV.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMSpV.fs new file mode 100644 index 00000000..c554b25e --- /dev/null +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMSpV.fs @@ -0,0 +1,165 @@ +module GraphBLAS.FSharp.Tests.Backend.Vector.SpMSpV + +open GraphBLAS.FSharp +open GraphBLAS.FSharp.Objects.ArraysExtensions +open Expecto +open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Tests.Context +open GraphBLAS.FSharp.Tests.TestCases +open Microsoft.FSharp.Collections +open Microsoft.FSharp.Core +open GraphBLAS.FSharp.Objects + +let config = Utils.defaultConfig + +let wgSize = Utils.defaultWorkGroupSize + +let checkResult + sumOp + mulOp + (zero: 'a) + (baseMtx: 'a [,]) + (baseVtr: 'a []) + (actualIndices: int []) + (actualValues: 'a []) + = + let rows = Array2D.length1 baseMtx + let columns = Array2D.length2 baseMtx + + let expectedV = Array.create columns zero + let mutable expectedIndices = List.Empty + let mutable expectedValues = List.Empty + + for c in 0 .. columns - 1 do + let mutable sum = zero + + for r in 0 .. rows - 1 do + sum <- sumOp sum (mulOp baseMtx.[r, c] baseVtr.[r]) + + expectedV.[c] <- sum + + for i in 0 .. columns - 1 do + if expectedV.[i] <> zero then + expectedIndices <- List.append expectedIndices [ i ] + expectedValues <- List.append expectedValues [ expectedV.[i] ] + + Expect.sequenceEqual + actualIndices + expectedIndices + $"Values should be the same. Actual is {actualIndices}, expected {expectedIndices}." + + Expect.sequenceEqual + actualValues + expectedValues + $"Values should be the same. Actual is {actualValues}, expected {expectedValues}." + +let correctnessGenericTest + (zero: 'a) + some + sumOp + mulOp + (spMV: MailboxProcessor<_> -> ClMatrix<'a> -> ClVector<'a> -> ClVector<'a> option) + (isEqual: 'a -> 'a -> bool) + q + (testContext: TestContext) + (vector: 'a [], matrix: 'a [,], _: bool []) + = + + if (Array2D.length1 matrix > 0 && vector.Length > 0) then + //Ensure that result is not empty + vector.[0] <- some + matrix.[0, 0] <- some + + let mtx = + Utils.createMatrixFromArray2D CSR matrix (isEqual zero) + + let vtr = + Utils.createVectorFromArray Sparse vector (isEqual zero) + + if mtx.NNZ > 0 && vtr.Size > 0 then + try + let m = mtx.ToDevice testContext.ClContext + + let v = vtr.ToDevice testContext.ClContext + + match spMV testContext.Queue m v with + | Some (ClVector.Sparse res) -> + m.Dispose q + v.Dispose q + let hostResIndices = res.Indices.ToHost q + let hostResValues = res.Values.ToHost q + res.Dispose q + + checkResult sumOp mulOp zero matrix vector hostResIndices hostResValues + | _ -> failwith "Result should not be empty while standard operations are tested" + with + | ex when ex.Message = "InvalidBufferSize" -> () + | ex -> raise ex + +let createTest spmspv testContext (zero: 'a) some isEqual add mul addQ mulQ = + let context = testContext.ClContext + let q = testContext.Queue + + let getCorrectnessTestName datatype = + $"Correctness on %s{datatype}, %A{testContext.ClContext}" + + let spMSpV = spmspv addQ mulQ context wgSize + + testContext + |> correctnessGenericTest zero some add mul spMSpV isEqual q + |> testPropertyWithConfig config (getCorrectnessTestName $"{typeof<'a>}") + + +let testFixturesSpMSpV (testContext: TestContext) = + [ let context = testContext.ClContext + let q = testContext.Queue + q.Error.Add(fun e -> failwithf "%A" e) + + createTest + Operations.SpMSpVBool + testContext + false + true + (=) + (||) + (&&) + ArithmeticOperations.boolSumOption + ArithmeticOperations.boolMulOption + + createTest + Operations.SpMSpV + testContext + 0 + 1 + (=) + (+) + (*) + ArithmeticOperations.intSumOption + ArithmeticOperations.intMulOption + + createTest + Operations.SpMSpV + testContext + 0.0f + 1f + (=) + (+) + (*) + ArithmeticOperations.float32SumOption + ArithmeticOperations.float32MulOption + + if Utils.isFloat64Available context.ClDevice then + createTest + Operations.SpMSpV + testContext + 0.0 + 1 + (=) + (+) + (*) + ArithmeticOperations.floatSumOption + ArithmeticOperations.floatMulOption ] + +let tests = + gpuTests "Backend.Vector.SpMSpV tests" testFixturesSpMSpV diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMV.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMV.fs index e19ade53..45ab8054 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMV.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/SpMV.fs @@ -1,18 +1,17 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.SpMV -open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions open Expecto +open Microsoft.FSharp.Collections +open Microsoft.FSharp.Core open Brahma.FSharp -open GraphBLAS.FSharp.Backend.Quotes +open GraphBLAS.FSharp open GraphBLAS.FSharp.Tests open GraphBLAS.FSharp.Tests.Context open GraphBLAS.FSharp.Tests.TestCases -open Microsoft.FSharp.Collections -open Microsoft.FSharp.Core -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions +open GraphBLAS.FSharp.Objects.ArraysExtensions +open GraphBLAS.FSharp.Backend.Quotes let config = Utils.defaultConfig @@ -52,7 +51,7 @@ let correctnessGenericTest zero sumOp mulOp - (spMV: MailboxProcessor<_> -> AllocationFlag -> ClMatrix.CSR<'a> -> ClArray<'a option> -> ClArray<'a option>) + (spMV: MailboxProcessor<_> -> AllocationFlag -> ClMatrix<'a> -> ClVector<'a> -> ClVector<'a>) (isEqual: 'a -> 'a -> bool) q (testContext: TestContext) @@ -69,14 +68,15 @@ let correctnessGenericTest try let m = mtx.ToDevice testContext.ClContext - match vtr, m with - | Vector.Dense vtr, ClMatrix.CSR m -> - let v = vtr.ToDevice testContext.ClContext + let v = vtr.ToDevice testContext.ClContext + + let res = spMV testContext.Queue HostInterop m v - let res = spMV testContext.Queue HostInterop m v + m.Dispose q + v.Dispose q - (ClMatrix.CSR m).Dispose q - v.Free q + match res with + | ClVector.Dense res -> let hostRes = res.ToHostAndFree q checkResult isEqual sumOp mulOp zero matrix vector hostRes @@ -92,7 +92,7 @@ let createTest testContext (zero: 'a) isEqual add mul addQ mulQ = let getCorrectnessTestName datatype = $"Correctness on %s{datatype}, %A{testContext.ClContext}" - let spMV = SpMV.run addQ mulQ context wgSize + let spMV = Operations.SpMV addQ mulQ context wgSize testContext |> correctnessGenericTest zero add mul spMV isEqual q diff --git a/tests/GraphBLAS-sharp.Tests/Backend/Vector/ZeroCreate.fs b/tests/GraphBLAS-sharp.Tests/Backend/Vector/ZeroCreate.fs index 313e0066..79c1e4d9 100644 --- a/tests/GraphBLAS-sharp.Tests/Backend/Vector/ZeroCreate.fs +++ b/tests/GraphBLAS-sharp.Tests/Backend/Vector/ZeroCreate.fs @@ -2,15 +2,14 @@ module GraphBLAS.FSharp.Tests.Backend.Vector.ZeroCreate open Expecto open Expecto.Logging +open GraphBLAS.FSharp open GraphBLAS.FSharp.Backend open GraphBLAS.FSharp.Tests open Context open TestCases -open GraphBLAS.FSharp.Backend.Objects -open GraphBLAS.FSharp.Backend.Vector open GraphBLAS.FSharp.Objects open GraphBLAS.FSharp.Objects.ClVectorExtensions -open GraphBLAS.FSharp.Backend.Objects.ClContext +open GraphBLAS.FSharp.Objects.ClContextExtensions let logger = Log.create "Vector.zeroCreate.Tests" diff --git a/tests/GraphBLAS-sharp.Tests/Generators.fs b/tests/GraphBLAS-sharp.Tests/Generators.fs index 38d3e388..fec8f61e 100644 --- a/tests/GraphBLAS-sharp.Tests/Generators.fs +++ b/tests/GraphBLAS-sharp.Tests/Generators.fs @@ -1,10 +1,8 @@ namespace GraphBLAS.FSharp.Test open FsCheck -open GraphBLAS.FSharp open Expecto.Logging open Expecto.Logging.Message -open FSharp.Quotations.Evaluator module Generators = let logger = Log.create "Generators" diff --git a/tests/GraphBLAS-sharp.Tests/GraphBLAS-sharp.Tests.fsproj b/tests/GraphBLAS-sharp.Tests/GraphBLAS-sharp.Tests.fsproj index 75a4f492..cdc0d28f 100644 --- a/tests/GraphBLAS-sharp.Tests/GraphBLAS-sharp.Tests.fsproj +++ b/tests/GraphBLAS-sharp.Tests/GraphBLAS-sharp.Tests.fsproj @@ -1,4 +1,4 @@ - + Exe @@ -15,8 +15,10 @@ + + @@ -41,7 +43,6 @@ - @@ -63,6 +64,8 @@ + + diff --git a/tests/GraphBLAS-sharp.Tests/Helpers.fs b/tests/GraphBLAS-sharp.Tests/Helpers.fs index 1811c40b..5f8d043b 100644 --- a/tests/GraphBLAS-sharp.Tests/Helpers.fs +++ b/tests/GraphBLAS-sharp.Tests/Helpers.fs @@ -1,15 +1,13 @@ namespace GraphBLAS.FSharp.Tests -open Brahma.FSharp.OpenCL.Translator +open Expecto open Microsoft.FSharp.Reflection -open Brahma.FSharp -open OpenCL.Net -open GraphBLAS.FSharp.Test open System.Text.RegularExpressions -open Expecto +open Brahma.FSharp +open Brahma.FSharp.OpenCL.Translator open GraphBLAS.FSharp.Objects -open GraphBLAS.FSharp.Backend.Objects - +open GraphBLAS.FSharp.Test +open OpenCL.Net [] module Utils = diff --git a/tests/GraphBLAS-sharp.Tests/Program.fs b/tests/GraphBLAS-sharp.Tests/Program.fs index 9049b03e..5b7b7908 100644 --- a/tests/GraphBLAS-sharp.Tests/Program.fs +++ b/tests/GraphBLAS-sharp.Tests/Program.fs @@ -1,6 +1,7 @@ open Expecto -open GraphBLAS.FSharp.Tests.Backend open GraphBLAS.FSharp.Tests +open GraphBLAS.FSharp.Tests.Backend +open GraphBLAS.FSharp.Tests.Backend.Matrix let matrixTests = testList @@ -16,7 +17,7 @@ let matrixTests = Matrix.SubRows.tests Matrix.Kronecker.tests - Matrix.SpGeMM.Expand.generalTests + Matrix.SpGeMM.Expand.tests Matrix.SpGeMM.Masked.tests ] |> testSequenced @@ -24,7 +25,7 @@ let commonTests = let scanTests = testList "Scan" - [ Common.Scan.ByKey.sequentialSegmentsTests + [ Common.Scan.ByKey.tests Common.Scan.PrefixSum.tests ] let reduceTests = @@ -64,7 +65,6 @@ let commonTests = "Common" [ Common.Scatter.allTests Common.Gather.allTests - Common.Merge.tests clArrayTests sortTests reduceTests @@ -75,10 +75,12 @@ let vectorTests = testList "Vector" [ Vector.SpMV.tests + Vector.SpMSpV.tests Vector.ZeroCreate.tests Vector.OfList.tests Vector.Copy.tests Vector.Convert.tests + Vector.Map.allTests Vector.Map2.allTests Vector.AssignByMask.tests Vector.AssignByMask.complementedTests @@ -87,7 +89,10 @@ let vectorTests = |> testSequenced let algorithmsTests = - testList "Algorithms tests" [ Algorithms.BFS.tests ] + testList + "Algorithms tests" + [ Algorithms.BFS.tests + Algorithms.SSSP.tests ] |> testSequenced let deviceTests =

1: 
 2: