def run_mace(flags): configs = format_model_config(flags) clear_build_dirs(configs[YAMLKeyword.library_name]) target_socs = configs[YAMLKeyword.target_socs] device_list = DeviceManager.list_devices(flags.device_yml) if target_socs and TargetSOCTag.all not in target_socs: device_list = [dev for dev in device_list if dev[YAMLKeyword.target_socs].lower() in target_socs] for target_abi in configs[YAMLKeyword.target_abis]: if flags.target_socs == TargetSOCTag.random: target_devices = sh_commands.choose_a_random_device( device_list, target_abi) else: target_devices = device_list # build target for dev in target_devices: if target_abi in dev[YAMLKeyword.target_abis]: # get toolchain toolchain = infer_toolchain(target_abi) device = DeviceWrapper(dev) if flags.example: build_example(configs, target_abi, toolchain, not flags.disable_openmp, flags.mace_lib_type, flags.cl_binary_to_code, device) else: build_mace_run(configs, target_abi, toolchain, not flags.disable_openmp, flags.address_sanitizer, flags.mace_lib_type) # run start_time = time.time() with device.lock(): device.run_specify_abi(flags, configs, target_abi) elapse_minutes = (time.time() - start_time) / 60 print("Elapse time: %f minutes." % elapse_minutes) elif dev[YAMLKeyword.device_name] != SystemType.host: six.print_('The device with soc %s do not support abi %s' % (dev[YAMLKeyword.target_socs], target_abi), file=sys.stderr) # package the output files package_path = sh_commands.packaging_lib(BUILD_OUTPUT_DIR, configs[YAMLKeyword.library_name]) print_package_summary(package_path)
def run_mace(flags): configs = format_model_config(flags) clear_build_dirs(configs[YAMLKeyword.library_name]) target_socs = configs[YAMLKeyword.target_socs] device_list = DeviceManager.list_devices(flags.device_yml) if target_socs and ALL_SOC_TAG not in target_socs: device_list = [ dev for dev in device_list if dev[YAMLKeyword.target_socs].lower() in target_socs ] for target_abi in configs[YAMLKeyword.target_abis]: # build target for dev in device_list: if target_abi in dev[YAMLKeyword.target_abis]: # get toolchain toolchain = infer_toolchain(target_abi) if flags.example: build_example(configs, target_abi, toolchain, not flags.disable_openmp, flags.mace_lib_type) else: build_mace_run(configs, target_abi, toolchain, not flags.disable_openmp, flags.address_sanitizer, flags.mace_lib_type) # run device = DeviceWrapper(dev) with device.lock(): device.run_specify_abi(flags, configs, target_abi) elif dev[YAMLKeyword.device_name] != SystemType.host: six.print_('The device with soc %s do not support abi %s' % (dev[YAMLKeyword.target_socs], target_abi), file=sys.stderr) # package the output files package_path = sh_commands.packaging_lib(BUILD_OUTPUT_DIR, configs[YAMLKeyword.library_name]) print_package_summary(package_path)