def run_models(flags, args): if flags.device_conf: device_conf = config_parser.parse_device_info(flags.device_conf) device.ArmLinuxDevice.set_devices(device_conf) run_devices = device.choose_devices(flags.target_abi, flags.target_socs) MaceLogger.info("Run on devices: %s" % run_devices) for device_id in run_devices: dev = device.create_device(flags.target_abi, device_id) run_models_for_device(flags, args, dev)
def get_cur_device_id(flags): run_devices = device.choose_devices(flags.target_abi, "all") run_device = None device_num = len(run_devices) if device_num == 0: # for CI MaceLogger.warning("No Android devices are plugged in, " "you need to copy `apu` so files by yourself.") elif device_num > 1: # for CI MaceLogger.warning("More than one Android devices are plugged in, " "you need to copy `apu` so files by yourself.") else: run_device = run_devices[0] return run_device
def run_models(flags, args): if flags.device_conf: device_conf = config_parser.parse_device_info(flags.device_conf) device.ArmLinuxDevice.set_devices(device_conf) run_devices = device.choose_devices(flags.target_abi, flags.target_socs) MaceLogger.info("Run on devices: %s" % run_devices) for device_id in run_devices: dev = device.create_device(flags.target_abi, device_id) if len(flags.devices_to_run) > 0 and \ device_id not in flags.devices_to_run.split(','): continue run_models_for_device(flags, args, dev)
def run_target(target_abi, install_dir, target_obj, device_ids="all"): if not install_dir: install_dir = default_install_dir(target_abi) run_devices = device.choose_devices(target_abi, device_ids) print("Run on devices: %s" % run_devices) for device_id in run_devices: # initiate device dev = device.crete_device(target_abi, device_id) # reinstall target print("Install target from %s to %s" % (target_obj.path, install_dir)) device_target = dev.install(target_obj, install_dir) print(device_target) # run on device print("Runing ...") with util.device_lock(device_id): dev.run(device_target)
default="arm64-v8a", help="Target ABI: only support arm64-v8a") parser.add_argument("--target_soc", type=str, default="all", help="serialno for adb connection") parser.add_argument("--apu_path", type=str, default="", help="path for storing apu so files on device") return parser.parse_known_args() if __name__ == "__main__": flags, args = parse_args() run_devices = device.choose_devices(flags.target_abi, flags.target_soc) device_num = len(run_devices) if device_num == 0: # for CI MaceLogger.warning("No Android devices are plugged in, " "you need to copy `apu` so files by yourself.") elif device_num > 1: # for CI MaceLogger.warning("More than one Android devices are plugged in, " "you need to copy `apu` so files by yourself.") else: device_id = run_devices[0] android_device = device.create_device(flags.target_abi, device_id) apu_so_paths = get_apu_so_paths(android_device) for apu_so_path in apu_so_paths: device.execute("cp -f %s %s" % (apu_so_path, flags.apu_path), True)