-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathProgram.fs
More file actions
45 lines (39 loc) · 1.7 KB
/
Copy pathProgram.fs
File metadata and controls
45 lines (39 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
open System.IO
open BenchmarkDotNet.Running
open DiffSharp.Benchmarks.Python
[<EntryPoint>]
let main args =
let summaries = BenchmarkSwitcher.FromAssembly(System.Reflection.Assembly.GetExecutingAssembly()).Run(args)
let lines =
[ for summary in summaries do
for case in summary.BenchmarksCases do
let v =
try
if case.Descriptor <> null &&
case.Descriptor.Categories <> null &&
case.Descriptor.Categories.Length > 0 then
if summary <> null && (try (summary[case] |> ignore); true with _ -> false) then
let report = summary[case]
let tensorSize = case.Parameters["tensorSize"] :?> int
let dtypeName = case.Parameters["dtypeName"] :?> string
let deviceName = case.Parameters["deviceName"] :?> string
// get the time in milliseconds
let runtime = report.ResultStatistics.Mean / 1000000.0 |> int64
let nm = case.Descriptor.Categories[0]
let key = nm + string tensorSize + dtypeName + deviceName
Some (sprintf "%s,%d" key runtime)
else
None
else
None
with _ -> None
match v with
| None -> ()
| Some r -> yield r
]
File.WriteAllLines(Path.Combine(__SOURCE_DIRECTORY__, "results.csv"), lines)
0