@@ -14,8 +14,8 @@ open GraphBLAS.FSharp.Predefined
1414
1515[<EntryPoint>]
1616let main argv =
17- let fstMatrix = COOMatrix( 100 , 100 , [| 0 ; 1 ; 2 |], [| 0 ; 1 ; 2 |], [| 1. ; 2. ; 3. |])
18- let sndMatrix = COOMatrix( 100 , 100 , [| 0 ; 1 ; 2 |], [| 0 ; 1 ; 2 |], [| 1. ; 2. ; 3. |])
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 |])
1919 let workflow =
2020 opencl {
2121 let! result = fstMatrix.EWiseAdd sndMatrix None FloatSemiring.addMult
@@ -29,7 +29,36 @@ let main argv =
2929
3030 for i in 0 .. indices.Length - 1 do
3131 let index = indices.[ i]
32- let i , j = int <| index >>> 32 , int index
33- printfn " (%i , %i , %A )" i j values.[ i]
32+ let a = int ( index >>> 32 )
33+ let b = int index
34+ printfn " (%i , %i , %A )" a b values.[ i]
35+
36+ // let allIndicesLength = 42
37+ // let workGroupSize = 256
38+ // let longSide = 72
39+ // let shortSide = 27
40+
41+ // let command =
42+ // <@
43+ // fun (ndRange: _1D)
44+ // (arr: int[]) ->
45+
46+ // arr.[ndRange.GlobalID0] <-
47+ // if true then 41 else 42
48+ // @>
49+
50+ // let translate2opencl (provider: ComputeProvider) (command: Quotations.Expr<(_1D -> int[] -> unit)>) : string =
51+ // let options = ComputeProvider.DefaultOptions_p
52+ // let tOptions = []
53+ // provider.SetCompileOptions options
54+
55+ // let kernel = System.Activator.CreateInstance<Kernel<_1D>>()
56+ // CLCodeGenerator.GenerateKernel(command, provider, kernel, tOptions) |> ignore
57+ // let code = (kernel :> ICLKernel).Source.ToString()
58+ // code
59+
60+ // let code = translate2opencl oclContext.Provider command
61+
62+ // printf "%s" code
3463
3564 0
0 commit comments