def main(unused_args): target_socs = None if FLAGS.target_socs != "all" and FLAGS.target_socs != "random": target_socs = set(FLAGS.target_socs.split(',')) target_devices = sh_commands.get_target_socs_serialnos(target_socs) if FLAGS.target_socs == "random": unlocked_devices = \ [d for d in target_devices if not sh_commands.is_device_locked(d)] if len(unlocked_devices) > 0: target_devices = [random.choice(unlocked_devices)] else: target_devices = [random.choice(target_devices)] target = FLAGS.target host_bin_path, bin_name = sh_commands.bazel_target_to_bin(target) target_abis = FLAGS.target_abis.split(',') # generate sources sh_commands.gen_encrypted_opencl_source() sh_commands.gen_mace_version() sh_commands.gen_tuning_param_code([]) for target_abi in target_abis: sh_commands.bazel_build(target, abi=target_abi, enable_neon=FLAGS.enable_neon, address_sanitizer=FLAGS.address_sanitizer) if FLAGS.run_target: for serialno in target_devices: if target_abi not in set( sh_commands.adb_supported_abis(serialno)): print("Skip device %s which does not support ABI %s" % (serialno, target_abi)) continue stdouts = sh_commands.adb_run( target_abi, serialno, host_bin_path, bin_name, args=FLAGS.args, opencl_profiling=True, vlog_level=0, device_bin_path="/data/local/tmp/mace", out_of_range_check=True, address_sanitizer=FLAGS.address_sanitizer) device_properties = sh_commands.adb_getprop_by_serialno( serialno) globals()[FLAGS.stdout_processor](stdouts, device_properties, target_abi)
def main(unused_args): target_socs = None if FLAGS.target_socs != "all" and FLAGS.target_socs != "random": target_socs = set(FLAGS.target_socs.split(',')) target_devices = sh_commands.get_target_socs_serialnos(target_socs) if FLAGS.target_socs == "random": unlocked_devices = \ [d for d in target_devices if not sh_commands.is_device_locked(d)] if len(unlocked_devices) > 0: target_devices = [random.choice(unlocked_devices)] else: target_devices = [random.choice(target_devices)] target = FLAGS.target host_bin_path, bin_name = sh_commands.bazel_target_to_bin(target) target_abis = FLAGS.target_abis.split(',') # generate sources sh_commands.gen_encrypted_opencl_source() sh_commands.gen_mace_version() sh_commands.gen_tuning_param_code([]) for target_abi in target_abis: sh_commands.bazel_build(target, abi=target_abi, enable_neon=FLAGS.enable_neon, address_sanitizer=FLAGS.address_sanitizer) if FLAGS.run_target: for serialno in target_devices: if target_abi not in set( sh_commands.adb_supported_abis(serialno)): print("Skip device %s which does not support ABI %s" % (serialno, target_abi)) continue stdouts = sh_commands.adb_run( target_abi, serialno, host_bin_path, bin_name, args=FLAGS.args, opencl_profiling=True, vlog_level=0, device_bin_path="/data/local/tmp/mace", out_of_range_check=True, address_sanitizer=FLAGS.address_sanitizer) device_properties = sh_commands.adb_getprop_by_serialno( serialno) globals()[FLAGS.stdout_processor](stdouts, device_properties, target_abi)
def main(unused_args): target = FLAGS.target host_bin_path, bin_name = sh_commands.bazel_target_to_bin(target) target_abis = FLAGS.target_abis.split(',') for target_abi in target_abis: toolchain = infer_toolchain(target_abi) sh_commands.bazel_build(target, abi=target_abi, toolchain=toolchain, enable_neon=FLAGS.enable_neon, address_sanitizer=FLAGS.address_sanitizer) if FLAGS.run_target: target_devices = DeviceManager.list_devices(FLAGS.device_yml) if FLAGS.target_socs != "all" and FLAGS.target_socs != "random": target_socs = set(FLAGS.target_socs.split(',')) target_devices = \ [dev for dev in target_devices if dev[YAMLKeyword.target_socs] in target_socs] if FLAGS.target_socs == "random": unlocked_devices = \ [d for d in target_devices if not sh_commands.is_device_locked(d)] if len(unlocked_devices) > 0: target_devices = [random.choice(unlocked_devices)] else: target_devices = [random.choice(target_devices)] for dev in target_devices: if target_abi not in dev[YAMLKeyword.target_abis]: print("Skip device %s which does not support ABI %s" % (dev, target_abi)) continue device_wrapper = DeviceWrapper(dev) stdouts = device_wrapper.run( target_abi, host_bin_path, bin_name, args=FLAGS.args, opencl_profiling=True, vlog_level=0, out_of_range_check=True, address_sanitizer=FLAGS.address_sanitizer, simpleperf=FLAGS.simpleperf) globals()[FLAGS.stdout_processor](stdouts, dev, target_abi)
def is_lock(self): return sh_commands.is_device_locked(self.address)