Skip to content

Commit 6b14acb

Browse files
committed
Fix benchmark config, download method and tests
1 parent a130e56 commit 6b14acb

17 files changed

Lines changed: 217 additions & 94 deletions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
``` ini
2+
3+
BenchmarkDotNet=v0.12.1, OS=Windows 7 SP1 (6.1.7601.0)
4+
Intel Celeron CPU N2830 2.16GHz, 1 CPU, 2 logical and 2 physical cores
5+
Frequency=2115908 Hz, Resolution=472.6103 ns, Timer=TSC
6+
.NET Core SDK=3.1.302
7+
[Host] : .NET Core 3.1.8 (CoreCLR 4.700.20.41105, CoreFX 4.700.20.41903), X64 RyuJIT DEBUG
8+
9+
IterationCount=10
10+
11+
```
12+
| Method | PathToGraph | Mean | Error | TEPS |
13+
|--------- |--------------------- |-----:|------:|-------------------------------:|
14+
| LevelBFS | Datas(...)r.mtx [32] | NA | NA | ("227320", "227320", "814134") |
15+
16+
Benchmarks with issues:
17+
BfsBenchmark.LevelBFS: Job-WTZPYK(IterationCount=10) [PathToGraph=Datas(...)r.mtx [32]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Method;Job;AnalyzeLaunchVariance;EvaluateOverhead;MaxAbsoluteError;MaxRelativeError;MinInvokeCount;MinIterationTime;OutlierMode;Affinity;EnvironmentVariables;Jit;Platform;PowerPlanMode;Runtime;AllowVeryLargeObjects;Concurrent;CpuGroups;Force;HeapAffinitizeMask;HeapCount;NoAffinitize;RetainVm;Server;Arguments;BuildConfiguration;Clock;EngineFactory;NuGetReferences;Toolchain;IsMutator;InvocationCount;IterationCount;IterationTime;LaunchCount;MaxIterationCount;MaxWarmupIterationCount;MinIterationCount;MinWarmupIterationCount;RunStrategy;UnrollFactor;WarmupCount;PathToGraph;Mean;Error;TEPS
2+
LevelBFS;Job-WTZPYK;False;Default;Default;Default;Default;Default;Default;11;Empty;RyuJit;X64;8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c;.NET Core 3.1;False;True;False;True;Default;Default;False;False;False;Default;Default;Default;Default;Default;Default;Default;1;10;Default;Default;Default;Default;Default;Default;Default;16;Default;Datas(...)r.mtx [32];NA;NA;"(""227320"", ""227320"", ""814134"")"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang='en'>
3+
<head>
4+
<meta charset='utf-8' />
5+
<title>GraphBLAS.FSharp.Benchmarks.BfsBenchmark-20201206-170542</title>
6+
7+
<style type="text/css">
8+
table { border-collapse: collapse; display: block; width: 100%; overflow: auto; }
9+
td, th { padding: 6px 13px; border: 1px solid #ddd; text-align: right; }
10+
tr { background-color: #fff; border-top: 1px solid #ccc; }
11+
tr:nth-child(even) { background: #f8f8f8; }
12+
</style>
13+
</head>
14+
<body>
15+
<pre><code>
16+
BenchmarkDotNet=v0.12.1, OS=Windows 7 SP1 (6.1.7601.0)
17+
Intel Celeron CPU N2830 2.16GHz, 1 CPU, 2 logical and 2 physical cores
18+
Frequency=2115908 Hz, Resolution=472.6103 ns, Timer=TSC
19+
.NET Core SDK=3.1.302
20+
[Host] : .NET Core 3.1.8 (CoreCLR 4.700.20.41105, CoreFX 4.700.20.41903), X64 RyuJIT DEBUG
21+
</code></pre>
22+
<pre><code>IterationCount=10
23+
</code></pre>
24+
25+
<table>
26+
<thead><tr><th>Method</th><th> PathToGraph</th><th>Mean</th><th>Error</th><th> TEPS</th>
27+
</tr>
28+
</thead><tbody><tr><td>LevelBFS</td><td>Datas(...)r.mtx [32]</td><td>NA</td><td>NA</td><td>(&quot;227320&quot;, &quot;227320&quot;, &quot;814134&quot;)</td>
29+
</tr></tbody></table>
30+
</body>
31+
</html>

benchmarks/GraphBLAS-sharp.Benchmarks/Config.fs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,26 @@ open BenchmarkDotNet.Configs
66
open BenchmarkDotNet.Columns
77
open BenchmarkDotNet.Reports
88
open BenchmarkDotNet.Running
9+
open System.IO
910

1011
type TEPSColumn() =
1112
interface IColumn with
1213
member this.AlwaysShow: bool = true
1314
member this.Category: ColumnCategory = ColumnCategory.Statistics
1415
member this.ColumnName: string = "TEPS"
1516
member this.GetValue(summary: Summary, benchmarkCase: BenchmarkCase): string =
16-
// let a = summary.[benchmarkCase] .ResultStatistics.Mean
17-
"?????????????"
17+
let meanTime = summary.[benchmarkCase].ResultStatistics.Mean
18+
let pathToGraph = benchmarkCase.Parameters.["PathToGraph"].ToString()
19+
match Path.GetExtension pathToGraph with
20+
| ".mtx" ->
21+
use streamReader = new StreamReader(pathToGraph)
22+
while streamReader.Peek() = int '%' do
23+
streamReader.ReadLine() |> ignore
24+
let matrixInfo = streamReader.ReadLine().Split(' ')
25+
let (nrows, ncols, nnz) = float matrixInfo.[0], float matrixInfo.[1], float matrixInfo.[2]
26+
let (vertices, edges) = if nrows = ncols then (nrows, nnz) else (ncols, nrows)
27+
sprintf "%f" (edges / meanTime)
28+
| _ -> "file`s format not supported"
1829
member this.GetValue(summary: Summary, benchmarkCase: BenchmarkCase, style: SummaryStyle): string =
1930
(this :> IColumn).GetValue(summary, benchmarkCase)
2031
member this.Id: string = "TEPSColumn"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
GraphName,OutputFile,GraphProvider,Url
2-
coAuthorsCiteseer,coAuthorsCiteseer.mtx,networkrepo,http://nrvis.com/download/data/dimacs10/coAuthorsCiteseer.zip
1+
GraphName,ArchiveType,Url
2+
coAuthorsCiteseer,zip,http://nrvis.com/download/data/dimacs10/coAuthorsCiteseer.zip
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GraphName,OutputFile,GraphProvider,Url
2-
twitter,,,http://an.kaist.ac.kr/~haewoon/release/twitter_social_graph/twitter_rv.tar.gz
3-
web,,,https://sparse.tamu.edu/MM/LAW/sk-2005.tar.gz
4-
road,,,http://www.dis.uniroma1.it/challenge9/data/USA-road-d/USA-road-d.USA.gr.gz
1+
GraphName,ArchiveType,Url
2+
twitter,tar.gz,http://an.kaist.ac.kr/~haewoon/release/twitter_social_graph/twitter_rv.tar.gz
3+
web,tar.gz,https://sparse.tamu.edu/MM/LAW/sk-2005.tar.gz
4+
road,gz,http://www.dis.uniroma1.it/challenge9/data/USA-road-d/USA-road-d.USA.gr.gz
Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,25 @@
11
#r "nuget: FSharp.Data"
2-
#r "nuget: ShellProgressBar"
2+
#r "nuget: Luna.ConsoleProgressBar"
33

44
open System
55
open System.IO
66
open System.Net
77
open System.IO.Compression
88
open FSharp.Data
99
open FSharp.Data.CsvExtensions
10-
open ShellProgressBar
10+
open Luna.ConsoleProgressBar
1111

12-
let downloadGraphs graphProvider url (outputFile: string) =
13-
printfn "%s %s %s" graphProvider url (Path.GetFileName outputFile)
14-
let options = ProgressBarOptions()
15-
// options.ProgressCharacter <- '─'
16-
// options.ProgressBarOnBottom <- true
17-
18-
use bar = new ProgressBar(100000, "qwe")
19-
let progress = bar.AsProgress<float>()
12+
let downloadGraphs graphName archiveType url (outputDir: string) =
2013
use client = new WebClient()
21-
client.DownloadProgressChanged.Add (fun e ->
22-
progress.Report (float e.ProgressPercentage / 100.)
23-
)
24-
match graphProvider with
25-
| "networkrepo" ->
26-
let archive = Path.ChangeExtension(outputFile, ".zip")
27-
client.AsyncDownloadFile(Uri url, archive)
28-
|> Async.RunSynchronously
29-
ZipFile
30-
.OpenRead(archive)
31-
.GetEntry(Path.GetFileName outputFile)
32-
.ExtractToFile(outputFile)
14+
// use bar = new ConsoleProgressBar()
15+
// client.DownloadProgressChanged.Add (fun e ->
16+
// bar.Report (float e.ProgressPercentage / 100.)
17+
// )
18+
match archiveType with
19+
| "zip" ->
20+
let archive = Path.Combine [| outputDir; Path.ChangeExtension(graphName, ".zip") |]
21+
client.AsyncDownloadFile(Uri url, archive) |> Async.RunSynchronously
22+
ZipFile.ExtractToDirectory(archive, outputDir)
3323
| _ -> ()
3424

3525
seq {
@@ -41,6 +31,5 @@ seq {
4131
CsvFile.Load(pathToCsv, separators=",", hasHeaders=true).Rows |> Seq.allPairs <| Seq.singleton pathToCsv)
4232
|> Seq.iter (fun (row, pathToCsv) ->
4333
let datasetRootPath = Path.GetDirectoryName pathToCsv
44-
let datasetOutputPath = Path.Join [| datasetRootPath; row?OutputFile |]
45-
downloadGraphs row?GraphProvider row?Url datasetOutputPath)
34+
downloadGraphs row?GraphName row?ArchiveType row?Url datasetRootPath)
4635

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace GraphBLAS.FSharp
2+
3+
open Brahma.FSharp.OpenCL.WorkflowBuilder.Evaluation
4+
5+
[<AutoOpen>]
6+
module GlobalContext =
7+
type MatrixBackendFormat =
8+
| CSR
9+
| COO
10+
| Dense
11+
12+
type VectorBackendFormat =
13+
| Sparse
14+
| Dense
15+
16+
let mutable oclContext = OpenCLEvaluationContext()
17+
let mutable matrixBackendFormat = CSR

src/GraphBLAS-sharp/GraphBLAS-sharp.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ItemGroup>
1010
<Compile Include="AssemblyInfo.fs" />
1111
<Compile Include="Helpers.fs" />
12-
<Compile Include="OpenCLContext.fs" />
12+
<Compile Include="GlobalContext.fs" />
1313
<Compile Include="Operators.fs" />
1414
<Compile Include="Monoid.fs" />
1515
<Compile Include="Semiring.fs" />

src/GraphBLAS-sharp/Implementations.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace GraphBLAS.FSharp
33
open Brahma.OpenCL
44
open Brahma.FSharp.OpenCL.Core
55
open Brahma.FSharp.OpenCL.Extensions
6-
open OpenCLContext
6+
open GlobalContext
77
open Helpers
88
open FSharp.Quotations.Evaluator
99
open Brahma.FSharp.OpenCL.WorkflowBuilder.Basic
@@ -74,7 +74,7 @@ type CSRMatrix<'a when 'a : struct and 'a : equality>(csrTuples: CSRFormat<'a>)
7474
return! ToHost resultVector
7575
}
7676

77-
upcast DenseVector(currentContext.RunSync eval, semiring.PlusMonoid)
77+
upcast DenseVector(oclContext.RunSync eval, semiring.PlusMonoid)
7878

7979
member this.Values = csrTuples.Values
8080
member this.Columns = csrTuples.Columns

0 commit comments

Comments
 (0)