Skip to content

Commit 3b52b27

Browse files
committed
Cleanup code, related to oclContext
1 parent 0f18072 commit 3b52b27

4 files changed

Lines changed: 28 additions & 31 deletions

File tree

src/GraphBLAS-sharp/CSRMatrix.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ type CSRMatrix<'a when 'a : struct and 'a : equality>(csrTuples: CSRFormat<'a>)
3434
"vector"
3535
(sprintf "Argument has invalid dimension. Need %i, but given %i" csrMatrixColumnCount vectorLength)
3636

37-
// let (BinaryOp op) = context.Times
38-
let plus = !> context.PlusMonoid.Append
39-
let mult = !> context.Times
37+
let (BinaryOp plus) = context.PlusMonoid.Append
38+
let (BinaryOp mult) = context.Times
4039

4140
let resultVector = Array.zeroCreate<'a> csrMatrixRowCount
4241
let command =

src/GraphBLAS-sharp/ComputationalContext.fs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/GraphBLAS-sharp/GraphBLAS-sharp.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Compile Include="Operators.fs" />
1212
<Compile Include="Monoid.fs" />
1313
<Compile Include="Semiring.fs" />
14-
<Compile Include="ComputationalContext.fs" />
14+
<Compile Include="OpenCLContext.fs" />
1515
<Compile Include="Scalar.fs" />
1616
<Compile Include="MatrixAndVector.fs" />
1717
<Compile Include="DenseVector.fs" />
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace GraphBLAS.FSharp
2+
3+
open Brahma.OpenCL
4+
open OpenCL.Net
5+
open Brahma.OpenCL
6+
7+
type OpenCLContext = {
8+
Provider: ComputeProvider
9+
CommandQueue: CommandQueue
10+
}
11+
12+
module OpenCLContext =
13+
14+
let private defaultProvider =
15+
try ComputeProvider.Create("*", DeviceType.Default)
16+
with
17+
| ex -> failwith ex.Message
18+
19+
let private defaultQueue =
20+
new CommandQueue(defaultProvider, defaultProvider.Devices |> Seq.head)
21+
22+
let currentContext = {
23+
Provider = defaultProvider
24+
CommandQueue = defaultQueue
25+
}

0 commit comments

Comments
 (0)