Skip to content

benchmarks: support new executable file names in perf_test_driver #32923

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

Merged
merged 1 commit into from
Jul 16, 2020
Merged
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
20 changes: 19 additions & 1 deletion benchmark/scripts/perf_test_driver/perf_test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
from __future__ import print_function

import functools
import glob
import multiprocessing
import os
import platform
import re
import subprocess

Expand Down Expand Up @@ -80,6 +82,22 @@ def _unwrap_self(args):
return type(args[0]).process_input(*args)


def get_benchmark_executable(binary_dir, opt_level):
suffix = opt_level + "-" + platform.machine() + "*"
pattern = os.path.join(binary_dir, "Benchmark_" + suffix)
executables = glob.glob(pattern)
if len(executables) == 0:
raise ValueError(
"No benchmark executable for file name pattern " +
pattern + " found")
if len(executables) > 1:
raise ValueError(
"Multiple benchmark executables for file name pattern " +
pattern + " found\n" +
str(executables))
return executables[0]


BenchmarkDriver_OptLevels = ["Onone", "O", "Osize"]


Expand All @@ -92,7 +110,7 @@ def __init__(
opt_levels=BenchmarkDriver_OptLevels,
):
self.targets = [
(os.path.join(binary_dir, "Benchmark_%s" % o), o) for o in opt_levels
(get_benchmark_executable(binary_dir, o), o) for o in opt_levels
]
self.xfail_list = xfail_list
self.enable_parallel = enable_parallel
Expand Down