Skip to content

Commit 0f7f9e1

Browse files
authored
Merge pull request #6 from dpanfilyonok/simple-bfs-benchmark
Performance benchmark
2 parents bb8fa6d + 205e218 commit 0f7f9e1

54 files changed

Lines changed: 1102 additions & 572 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ indent_size = 2
2323
[*.paket.references]
2424
trim_trailing_whitespace = true
2525
indent_size = 2
26+
27+
[*.yml]
28+
trim_trailing_whitespace = true
29+
indent_size = 2

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ jobs:
4444
- name: Build
4545
run: ./build.cmd
4646
env:
47-
CI: true
47+
CI: true

GraphBLAS-sharp.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ACBEE43C
1111
EndProject
1212
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GraphBLAS-sharp.Tests", "tests\GraphBLAS-sharp.Tests\GraphBLAS-sharp.Tests.fsproj", "{1CA2E092-2320-451D-A4F0-9ED7C7C528CA}"
1313
EndProject
14+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{DEF656DE-BCED-4C49-B5ED-950D4A29B78B}"
15+
EndProject
16+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GraphBLAS-sharp.Benchmarks", "benchmarks\GraphBLAS-sharp.Benchmarks\GraphBLAS-sharp.Benchmarks.fsproj", "{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}"
17+
EndProject
1418
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "docsTool", "docsTool\docsTool.fsproj", "{8855EC73-F6A1-43D3-AFBC-04A3E09F9BD9}"
1519
EndProject
1620
Global
@@ -62,9 +66,22 @@ Global
6266
{8855EC73-F6A1-43D3-AFBC-04A3E09F9BD9}.Release|x64.Build.0 = Release|Any CPU
6367
{8855EC73-F6A1-43D3-AFBC-04A3E09F9BD9}.Release|x86.ActiveCfg = Release|Any CPU
6468
{8855EC73-F6A1-43D3-AFBC-04A3E09F9BD9}.Release|x86.Build.0 = Release|Any CPU
69+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
70+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
71+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Debug|x64.ActiveCfg = Debug|Any CPU
72+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Debug|x64.Build.0 = Debug|Any CPU
73+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Debug|x86.ActiveCfg = Debug|Any CPU
74+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Debug|x86.Build.0 = Debug|Any CPU
75+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Release|Any CPU.Build.0 = Release|Any CPU
77+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Release|x64.ActiveCfg = Release|Any CPU
78+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Release|x64.Build.0 = Release|Any CPU
79+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Release|x86.ActiveCfg = Release|Any CPU
80+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6}.Release|x86.Build.0 = Release|Any CPU
6581
EndGlobalSection
6682
GlobalSection(NestedProjects) = preSolution
6783
{5D30E174-2538-47AC-8443-318C8C5DC2C9} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216}
6884
{1CA2E092-2320-451D-A4F0-9ED7C7C528CA} = {ACBEE43C-7A88-4FB1-9B06-DB064D22B29F}
85+
{4C6EB3D0-B6BF-4FF5-BC77-CC7CB3F307E6} = {DEF656DE-BCED-4C49-B5ED-950D4A29B78B}
6986
EndGlobalSection
7087
EndGlobal

benchmarks/Directory.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
3+
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
5+
<IsTestProject>false</IsTestProject>
6+
</PropertyGroup>
7+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Auto-Generated by FAKE; do not edit
2+
namespace System
3+
open System.Reflection
4+
5+
[<assembly: AssemblyTitleAttribute("GraphBLAS-sharp.Benchmarks")>]
6+
[<assembly: AssemblyProductAttribute("GraphBLAS-sharp")>]
7+
[<assembly: AssemblyVersionAttribute("0.1.0")>]
8+
[<assembly: AssemblyMetadataAttribute("ReleaseDate","2017-03-17T00:00:00.0000000")>]
9+
[<assembly: AssemblyFileVersionAttribute("0.1.0")>]
10+
[<assembly: AssemblyInformationalVersionAttribute("0.1.0")>]
11+
[<assembly: AssemblyMetadataAttribute("ReleaseChannel","release")>]
12+
[<assembly: AssemblyMetadataAttribute("GitHash","bb8964b54bee133e9af64d316dc2cfee16df7f72")>]
13+
do ()
14+
15+
module internal AssemblyVersionInformation =
16+
let [<Literal>] AssemblyTitle = "GraphBLAS-sharp.Benchmarks"
17+
let [<Literal>] AssemblyProduct = "GraphBLAS-sharp"
18+
let [<Literal>] AssemblyVersion = "0.1.0"
19+
let [<Literal>] AssemblyMetadata_ReleaseDate = "2017-03-17T00:00:00.0000000"
20+
let [<Literal>] AssemblyFileVersion = "0.1.0"
21+
let [<Literal>] AssemblyInformationalVersion = "0.1.0"
22+
let [<Literal>] AssemblyMetadata_ReleaseChannel = "release"
23+
let [<Literal>] AssemblyMetadata_GitHash = "bb8964b54bee133e9af64d316dc2cfee16df7f72"
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 | (&quot;227320&quot;, &quot;227320&quot;, &quot;814134&quot;) |
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>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
namespace GraphBLAS.FSharp.Benchmarks
2+
3+
open GraphBLAS.FSharp
4+
open GraphBLAS.FSharp.Algorithms
5+
open BenchmarkDotNet.Attributes
6+
open BenchmarkDotNet.Configs
7+
open BenchmarkDotNet.Columns
8+
open System.IO
9+
open System
10+
open MatrixBackend
11+
12+
[<Config(typeof<Config>)>]
13+
[<SimpleJob(targetCount=10)>]
14+
type BFSBenchmark4CSRMatrix() =
15+
let random = Random()
16+
17+
let mutable matrix = Unchecked.defaultof<Matrix<bool>>
18+
let mutable source = 0
19+
20+
[<ParamsSource("GraphPaths")>]
21+
member val PathToGraph = "" with get, set
22+
23+
[<GlobalSetup>]
24+
member this.BuildMatrix() =
25+
matrix <- Matrix.Build<bool>(this.PathToGraph, CSR)
26+
source <- random.Next matrix.RowCount
27+
28+
[<Benchmark>]
29+
member this.LevelBFS() =
30+
levelBFS matrix source
31+
32+
/// Sequence of paths to files where data for benchmarking will be taken from
33+
static member GraphPaths = seq {
34+
// Gets all mtx files from following directory
35+
yield! Directory.EnumerateFiles(Path.Join [|"Datasets"; "1"|], "*.mtx")
36+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
namespace GraphBLAS.FSharp.Benchmarks
2+
3+
open GraphBLAS.FSharp.Algorithms
4+
open BenchmarkDotNet.Attributes
5+
open BenchmarkDotNet.Configs
6+
open BenchmarkDotNet.Columns
7+
open BenchmarkDotNet.Reports
8+
open BenchmarkDotNet.Running
9+
open System.IO
10+
11+
type TEPSColumn() =
12+
interface IColumn with
13+
member this.AlwaysShow: bool = true
14+
member this.Category: ColumnCategory = ColumnCategory.Statistics
15+
member this.ColumnName: string = "TEPS"
16+
member this.GetValue(summary: Summary, benchmarkCase: BenchmarkCase): string =
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+
| another -> sprintf "%s files not supported" another
29+
member this.GetValue(summary: Summary, benchmarkCase: BenchmarkCase, style: SummaryStyle): string =
30+
(this :> IColumn).GetValue(summary, benchmarkCase)
31+
member this.Id: string = "TEPSColumn"
32+
member this.IsAvailable(summary: Summary): bool = true
33+
member this.IsDefault(summary: Summary, benchmarkCase: BenchmarkCase): bool = false
34+
member this.IsNumeric: bool = true
35+
member this.Legend: string = "Traversed edges per second"
36+
member this.PriorityInCategory: int = 0
37+
member this.UnitType: UnitType = UnitType.Dimensionless
38+
39+
type Config() =
40+
inherit ManualConfig()
41+
42+
do
43+
base.AddColumn [| TEPSColumn() :> IColumn |] |> ignore

0 commit comments

Comments
 (0)