File: mlir-mbr.in

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (86 lines) | stat: -rw-r--r-- 2,628 bytes parent folder | download | duplicates (18)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!@Python3_EXECUTABLE@
# -*- coding: utf-8 -*-

import argparse
import datetime
import json
import os
import sys

from urllib import error as urlerror
from urllib import parse as urlparse
from urllib import request


mlir_source_root = "@MLIR_SOURCE_DIR@"
sys.path.insert(0, os.path.join(mlir_source_root, "utils", "mbr", "mbr"))

from main import main


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--machine",
        required=True,
        help="A platform identifier on which the "
             "benchmarks are run. For example"
             " <hardware>-<arch>-<optimization level>-<branch-name>"
    )
    parser.add_argument(
        "--revision",
        required=True,
        help="The key used to identify different runs. "
             "Could be anything as long as it"
             " can be sorted by python's sort function"
    )
    parser.add_argument(
        "--url",
        help="The lnt server url to send the results to",
        default="http://localhost:8000/db_default/v4/nts/submitRun"
    )
    parser.add_argument(
        "--result-stdout",
        help="Print benchmarking results to stdout instead"
             " of sending it to lnt",
        default=False,
        action=argparse.BooleanOptionalAction
    )
    parser.add_argument(
        "top_level_path",
        help="The top level path from which to search for benchmarks",
        default=os.getcwd(),
    )
    parser.add_argument(
        "--stop_on_error",
        help="Should we stop the benchmark run on errors? Defaults to false",
        default=False,
    )
    args = parser.parse_args()

    complete_benchmark_start_time = datetime.datetime.utcnow().isoformat()
    benchmark_function_dicts = main(args.top_level_path, args.stop_on_error)
    complete_benchmark_end_time = datetime.datetime.utcnow().isoformat()
    lnt_dict = {
        "format_version": "2",
        "machine": {"name": args.machine},
        "run": {
            "end_time": complete_benchmark_start_time,
            "start_time": complete_benchmark_end_time,
            "llvm_project_revision": args.revision
        },
        "tests": benchmark_function_dicts,
        "name": "MLIR benchmark suite"
    }
    lnt_json = json.dumps(lnt_dict, indent=4)
    if args.result_stdout is True:
        print(lnt_json)
    else:
        request_data = urlparse.urlencode(
            {"input_data": lnt_json}
        ).encode("ascii")
        req = request.Request(args.url, request_data)
        try:
            resp = request.urlopen(req)
        except urlerror.HTTPError as e:
            print(e)