Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions QuadTree.Benchmark/BFS.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@ type Benchmark() =

let mutable matrix = Unchecked.defaultof<Matrix.SparseMatrix<double>>


[<Params("494_bus.mtx", "arc130.mtx")>]
member val MatrixName = "" with get, set

[<GlobalSetup>]
member this.LoadMatrix() =
matrix <- readMtx (System.IO.Path.Combine(DIR_WITH_MATRICES, this.MatrixName)) false
matrix <-
match readMtx (System.IO.Path.Combine(DIR_WITH_MATRICES, this.MatrixName)) false with
| Ok m -> m
| Error _ -> Matrix.empty 0UL<Matrix.nrows> 0UL<Matrix.ncols>

[<Benchmark>]
member this.BFS() =
let startVertices =
let startVerticesResult =
Vector.CoordinateList((uint64 matrix.ncols) * 1UL<Vector.dataLength>, [ 0UL<Vector.index>, 1UL ])
|> Vector.fromCoordinateList

let startVertices =
match startVerticesResult with
| Ok v -> v
| Error _ -> Vector.empty ((uint64 matrix.ncols) * 1UL<Vector.dataLength>)

Graph.BFS.bfs_level matrix startVertices
6 changes: 4 additions & 2 deletions QuadTree.Benchmark/SSSP.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ open QuadTree.Benchmarks.Utils
type Benchmark() =
let mutable matrix = Unchecked.defaultof<Matrix.SparseMatrix<double>>


[<Params("494_bus.mtx", "arc130.mtx")>]
member val MatrixName = "" with get, set

[<GlobalSetup>]
member this.LoadMatrix() =
matrix <- readMtx (System.IO.Path.Combine(DIR_WITH_MATRICES, this.MatrixName)) false
matrix <-
match readMtx (System.IO.Path.Combine(DIR_WITH_MATRICES, this.MatrixName)) false with
| Ok m -> m
| Error _ -> Matrix.empty 0UL<Matrix.nrows> 0UL<Matrix.ncols>

[<Benchmark>]
member this.SSSP() = Graph.SSSP.sssp matrix 0UL
5 changes: 4 additions & 1 deletion QuadTree.Benchmark/Triangles.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ type Benchmark() =

[<GlobalSetup>]
member this.LoadMatrix() =
matrix <- readMtx (System.IO.Path.Combine(DIR_WITH_MATRICES, this.MatrixName)) false
matrix <-
match readMtx (System.IO.Path.Combine(DIR_WITH_MATRICES, this.MatrixName)) false with
| Ok m -> m
| Error _ -> Matrix.empty 0UL<Matrix.nrows> 0UL<Matrix.ncols>

[<Benchmark>]
member this.TriangleCount() =
Expand Down
Loading
Loading