Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks and IO fix #89

Merged
merged 3 commits into from
Nov 6, 2023
Merged
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
4 changes: 2 additions & 2 deletions benchmarks/GraphBLAS-sharp.Benchmarks/Configs/Context.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NVIDIA*
AMD*
Gpu
32
64
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BFSBenchmark
BFSWithoutTransfer
4 changes: 2 additions & 2 deletions benchmarks/GraphBLAS-sharp.Benchmarks/Scripts/Benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from dataclasses import dataclass

ROOT = pathlib.Path(__file__).parent.parent.parent.parent
BENCHMARKS = pathlib.Path(__file__).parent.parent
ROOT = pathlib.Path(__file__).resolve().parent.parent.parent.parent
BENCHMARKS = pathlib.Path(__file__).resolve().parent.parent
CONFIGS = BENCHMARKS / "Configs"
BINARIES = BENCHMARKS / "bin" / "Release" / "net7.0"
RESULTS = ROOT / "BenchmarkDotNet.Artifacts" / "results"
Expand Down
72 changes: 39 additions & 33 deletions src/GraphBLAS-sharp/IO/MtxReader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -68,40 +68,46 @@ type MtxReader(pathToFile: string) =
let sortedData =
match this.Symmetry with
| General ->
[ 0 .. nnz - 1 ]
|> List.map (fun _ -> streamReader.ReadLine().Split(' '))
|> Array.ofList
|> Array.Parallel.map
(fun line ->
let i = int line.[0]
let j = int line.[1]

let v =
converter
<| if line.Length > 2 then line.[2] else ""

struct (pack i j, v))
|> Array.sortBy (fun struct (packedIndex, _) -> packedIndex)
let result =
[| 0 .. nnz - 1 |]
|> Array.map
(fun _ ->
let line = streamReader.ReadLine().Split(' ')

let i = int line.[0]
let j = int line.[1]

let v =
converter
<| if line.Length > 2 then line.[2] else ""

struct (pack i j, v))

Array.sortInPlaceBy (fun struct (packedIndex, _) -> packedIndex) result
result
| Symmetric ->
[ 0 .. nnz - 1 ]
|> List.map (fun _ -> streamReader.ReadLine().Split(' '))
|> Array.ofList
|> Array.Parallel.map
(fun line ->
let i = int line.[0]
let j = int line.[1]

let v =
converter
<| if line.Length > 2 then line.[2] else ""

if i = j then
[| struct (pack i j, v) |]
else
[| struct (pack i j, v)
struct (pack j i, v) |])
|> Array.concat
|> Array.sortBy (fun struct (packedIndex, _) -> packedIndex)
let result =
[| 0 .. nnz - 1 |]
|> Array.map
(fun _ ->
let line = streamReader.ReadLine().Split(' ')

let i = int line.[0]
let j = int line.[1]

let v =
converter
<| if line.Length > 2 then line.[2] else ""

if i = j then
[| struct (pack i j, v) |]
else
[| struct (pack i j, v)
struct (pack j i, v) |])
|> Array.concat

Array.sortInPlaceBy (fun struct (packedIndex, _) -> packedIndex) result
result
| _ ->
failwith
<| sprintf "This symmetry processing is not implemented: %A" this.Symmetry
Expand Down
Loading