File tree Expand file tree Collapse file tree
benchmarks/GraphBLAS-sharp.Benchmarks/Algorithms
src/GraphBLAS-sharp.Backend
tests/GraphBLAS-sharp.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ type Benchmarks(
2323
2424 let mutable funToBenchmark = None
2525 let mutable matrix = Unchecked.defaultof< ClMatrix< float32>>
26- let mutable matrixPrepared = Unchecked.defaultof< ClMatrix < float32>>
26+ let mutable matrixPrepared = Unchecked.defaultof< PageRankMatrix < float32>>
2727 let mutable matrixHost = Unchecked.defaultof<_>
2828
2929 let accuracy = 0.00000001 f
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ module internal PageRank =
131131
132132 transposeInPlace queue DeviceOnly newMatrix
133133 |> ClMatrix.CSR
134+ |> PageRankMatrix
134135 | _ -> failwith " Not implemented"
135136
136137 let run ( clContext : ClContext ) workGroupSize =
@@ -154,8 +155,7 @@ module internal PageRank =
154155 let create =
155156 GraphBLAS.FSharp.Vector.create clContext workGroupSize
156157
157- fun ( queue : MailboxProcessor < Msg >) ( matrix : ClMatrix < float32 >) accuracy ->
158-
158+ fun ( queue : MailboxProcessor < Msg >) ( PageRankMatrix matrix ) accuracy ->
159159 let vertexCount = matrix.RowCount
160160
161161 //None is 0
Original file line number Diff line number Diff line change @@ -173,3 +173,36 @@ type ClMatrix<'a when 'a: struct> =
173173 | ClMatrix.COO matrix -> matrix.NNZ
174174 | ClMatrix.CSC matrix -> matrix.NNZ
175175 | ClMatrix.LIL matrix -> matrix.NNZ
176+
177+ /// <summary >
178+ /// Represents an abstraction over matrix, which is converted to correct format for PageRank algorithm
179+ /// </summary >
180+ type PageRankMatrix < 'a when 'a: struct > =
181+ | PageRankMatrix of ClMatrix < 'a >
182+ /// <summary >
183+ /// Gets the number of rows in matrix.
184+ /// </summary >
185+ member this.RowCount =
186+ match this with
187+ | PageRankMatrix matrix -> matrix.RowCount
188+
189+ /// <summary >
190+ /// Gets the number of columns in matrix.
191+ /// </summary >
192+ member this.ColumnCount =
193+ match this with
194+ | PageRankMatrix matrix -> matrix.ColumnCount
195+
196+ /// <summary >
197+ /// Release device resources allocated for the matrix.
198+ /// </summary >
199+ member this.Dispose q =
200+ match this with
201+ | PageRankMatrix matrix -> matrix.Dispose q
202+
203+ /// <summary >
204+ /// Gets the number of non-zero elements in matrix.
205+ /// </summary >
206+ member this.NNZ =
207+ match this with
208+ | PageRankMatrix matrix -> matrix.NNZ
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ let algorithmsTests =
9292 testList
9393 " Algorithms tests"
9494 [ Algorithms.BFS.tests
95- Algorithms.SSSP.tests ]
95+ Algorithms.SSSP.tests
96+ Algorithms.PageRank.tests ]
9697 |> testSequenced
9798
9899let deviceTests =
You can’t perform that action at this time.
0 commit comments