Skip to content

Commit a65c15d

Browse files
committed
Corrected third prefix sum algorithm, tested addition for matrices
1 parent d9df80d commit a65c15d

3 files changed

Lines changed: 81 additions & 341 deletions

File tree

src/App/Program.fs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11

2-
open System
3-
open GraphBLAS.FSharp
4-
52
open Brahma.OpenCL
63
open Brahma.FSharp.OpenCL.Core
74
open Brahma.FSharp.OpenCL.Extensions
8-
open GlobalContext
9-
open Helpers
105
open FSharp.Quotations.Evaluator
116
open Brahma.FSharp.OpenCL.WorkflowBuilder.Basic
127
open Brahma.FSharp.OpenCL.WorkflowBuilder.Evaluation
8+
open GraphBLAS.FSharp
139
open GraphBLAS.FSharp.Predefined
1410

1511
[<EntryPoint>]
1612
let main argv =
17-
let fstMatrix = COOMatrix(100, 100, [|0;1;2;5|], [|4;1;2;5|], [|1.0;2.0;3.0;6.0|])
18-
let sndMatrix = COOMatrix(100, 100, [|0;1;2;5|], [|4;2;3;5|], [|-0.8;2.0;3.0;6.0|])
13+
let fstMatrix = COOMatrix(100, 100, [|0;1;1;2;5|], [|4;1;50;2;5|], [|1.0;2.0;76.0;3.0;6.0|])
14+
let sndMatrix = COOMatrix(100, 100, [|0;1;1;2;5|], [|4;2;50;3;5|], [|-0.8;2.0;-76.0;3.0;6.0|])
1915
let workflow =
2016
opencl {
2117
let! result = fstMatrix.EWiseAdd sndMatrix None FloatSemiring.addMult
@@ -25,8 +21,13 @@ let main argv =
2521
let res: COOMatrix<float> = downcast oclContext.RunSync workflow
2622

2723
let indices = res.Indices
24+
// let rows = res.Rows
25+
// let columns = res.Columns
2826
let values = res.Values
2927

28+
// for i in 0 .. rows.Length - 1 do
29+
// printfn "(%i, %i, %A)" rows.[i] columns.[i] values.[i]
30+
3031
for i in 0 .. indices.Length - 1 do
3132
let index = indices.[i]
3233
let a = int (index >>> 32)

0 commit comments

Comments
 (0)