# Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## import re from utils.custom_logger import getLogger from utils.subprocess_with_logger import processRun import os.path as path from utils.arg_parse import getParser, getArgs getParser().add_argument( "--android_dir", default="/data/local/tmp/", help="The directory in the android device all files are pushed to.") class ADB(object): def __init__(self, device=None): self.device = device self.dir = getArgs().android_dir def run(self, cmd, *args, **kwargs): adb = ["adb"] if self.device: adb.append("-s") adb.append(self.device) adb.append(cmd) for item in args:
import shutil import sys import tempfile import threading import time from driver.benchmark_driver import runOneBenchmark from benchmarks.benchmarks import BenchmarkCollector from frameworks.frameworks import getFrameworks from platforms.platforms import getPlatforms from reporters.reporters import getReporters from utils.arg_parse import getParser, getArgs, parseKnown from utils.custom_logger import getLogger # for backward compatible purpose getParser().add_argument("--backend", help="Specify the backend the test runs on.") getParser().add_argument( "-b", "--benchmark_file", required=True, help="Specify the json file for the benchmark or a number of benchmarks") getParser().add_argument( "--command_args", help="Specify optional command arguments that would go with the " "main benchmark command") getParser().add_argument( "--cooldown", default=0, type=float, help="Specify the time interval between two test runs.") getParser().add_argument("--device",
import copy import json import shutil import tempfile import threading from driver.benchmark_driver import runOneBenchmark from benchmarks.benchmarks import BenchmarkCollector from frameworks.frameworks import getFrameworks from platforms.platforms import getPlatforms from reporters.reporters import getReporters from utils.arg_parse import getParser, getArgs, parse from utils.custom_logger import getLogger getParser().add_argument("--backend", help="Specify the backend the test runs on.") getParser().add_argument( "--benchmark_file", required=True, help="Specify the json file for the benchmark or a number of benchmarks") getParser().add_argument( "--devices", help="Specify the devices to run the benchmark, in a comma separated " "list. The value is the device or device_hash field of the meta info.") getParser().add_argument( "--excluded_devices", help="Specify the devices that skip the benchmark, in a comma separated " "list. The value is the device or device_hash field of the meta info.") getParser().add_argument("--framework", required=True, choices=["caffe2"],
############################################################################## from collections import deque import datetime import json import os import threading import time from utils.arg_parse import getParser, getArgs, getUnknowns, parseKnown from repos.repos import getRepo from utils.build_program import buildProgramPlatform from utils.custom_logger import getLogger from utils.utilities import getDirectory getParser().add_argument("--ab_testing", action="store_true", help="Enable A/B testing in benchmark.") getParser().add_argument( "--base_commit", help= "In A/B testing, this is the control commit that is used to compare against. " + "If not specified, the default is the first commit in the week in UTC timezone. " + "Even if specified, the control is the later of the specified commit and the commit at the start of the week." ) getParser().add_argument( "--branch", default="master", help="The remote repository branch. Defaults to master") getParser().add_argument(
# # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## import copy import json import os import six import sys from utils.arg_parse import getParser, getArgs, getUnknowns, parseKnown from utils.custom_logger import getLogger from utils.utilities import getPythonInterpreter, getString getParser().add_argument( "--reset_options", action="store_true", help="Reset all the options that is saved by default.") class RunBench(object): def __init__(self): self.home_dir = os.path.expanduser('~') self.root_dir = os.path.join(self.home_dir, ".aibench", "git") self.ret = 0 parseKnown() def run(self): cmd = self._getCMD() getLogger().info("Running: %s", cmd) self.ret = os.system(cmd)
# This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## import copy import json import os import six import sys from utils.arg_parse import getParser, getArgs, getUnknowns, parseKnown from utils.custom_logger import getLogger from utils.utilities import getPythonInterpreter, getString, \ getRunStatus, setRunStatus getParser().add_argument("--config_dir", default=os.path.join(os.path.expanduser('~'), ".aibench", "git"), help="Specify the config root directory.") getParser().add_argument( "--reset_options", action="store_true", help="Reset all the options that is saved by default.") class RunBench(object): def __init__(self): parseKnown() self.root_dir = getArgs().config_dir def run(self): cmd = self._getCMD() getLogger().info("Running: %s", cmd)
# LICENSE file in the root directory of this source tree. ############################################################################## from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import json from platforms.android.android_driver import AndroidDriver from utils.arg_parse import getParser, parse getParser().add_argument( "-d", "--devices", help="Specify the devices to run the benchmark, in a comma separated " "list. The value is the device or device_hash field of the meta info.") getParser().add_argument("--device", help="The single device to run this benchmark on") getParser().add_argument( "--excluded_devices", help="Specify the devices that skip the benchmark, in a comma separated " "list. The value is the device or device_hash field of the meta info.") getParser().add_argument( "--set_freq", help="On rooted android phones, set the frequency of the cores. " "The supported values are: " "max: set all cores to the maximum frquency. " "min: set all cores to the minimum frequency. " "mid: set all cores to the median frequency. ")
# This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## import json import os import shlex import time from platforms.platform_base import PlatformBase from utils.arg_parse import getParser, getArgs from utils.custom_logger import getLogger from utils.subprocess_with_logger import processRun from utils.utilities import getRunStatus, setRunStatus getParser().add_argument("--ios_dir", default="/tmp", help="The directory in the ios device all files are pushed to.") class IOSPlatform(PlatformBase): def __init__(self, tempdir, idb): super(IOSPlatform, self).__init__(tempdir, getArgs().ios_dir, idb) self.setPlatformHash(idb.device) self.type = "ios" self.app = None def runCommand(self, cmd): return self.util.run(cmd) def preprocess(self, *args, **kwargs): assert "programs" in kwargs, "Must have programs specified"
############################################################################## # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## import os from utils.arg_parse import getParser, getArgs, parseKnown from utils.build_program import buildProgramPlatform getParser().add_argument("--dst", required=True, help="The destination of the program.") getParser().add_argument("--framework", required=True, choices=["caffe2"], help="Specify the framework to benchmark on.") getParser().add_argument( "--frameworks_dir", default=str( os.path.dirname(os.path.realpath(__file__)) + "/../specifications/frameworks"), help="Required. The root directory that all frameworks resides. " "Usually it is the specifications/frameworks directory.") getParser().add_argument( "--platform", required=True,
############################################################################## # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## from platforms.android.adb import ADB from platforms.ios.idb import IDB from utils.arg_parse import getParser, getArgs, parse getParser().add_argument("--device", required=True, help="Specify the device hash to reboot") getParser().add_argument("-p", "--platform", required=True, help="Specify the platform to benchmark on. " "Must starts with ios or android") def reboot(): parse() device = getArgs().device platform = getArgs().platform if platform.startswith("ios"): util = IDB(device)
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import json import logging from platforms.platforms import getPlatforms from utils.arg_parse import getParser, parse from utils.custom_logger import getLogger getParser().add_argument( "-d", "--devices", help="Specify the devices to run the benchmark, in a comma separated " "list. The value is the device or device_hash field of the meta info.") getParser().add_argument("--device", help="The single device to run this benchmark on") getParser().add_argument( "--excluded_devices", help="Specify the devices that skip the benchmark, in a comma separated " "list. The value is the device or device_hash field of the meta info.") getParser().add_argument( "--set_freq", help="On rooted android phones, set the frequency of the cores. " "The supported values are: " "max: set all cores to the maximum frquency. " "min: set all cores to the minimum frequency. " "mid: set all cores to the median frequency. ")