提交 07787144 编写于 作者: Y yejianwu

update dynamic link

上级 cf6c7d7b
...@@ -40,8 +40,8 @@ Configurations ...@@ -40,8 +40,8 @@ Configurations
- Whether embedding model weights as the code, default to 0. - Whether embedding model weights as the code, default to 0.
* - build_type * - build_type
- model build type, can be ['proto', 'code']. 'proto' for converting model to ProtoBuf file and 'code' for converting model to c++ code. - model build type, can be ['proto', 'code']. 'proto' for converting model to ProtoBuf file and 'code' for converting model to c++ code.
* - dynamic_link * - linkshared
- [optional] link mace library in dynamic method if set to 1, default to 0. - [optional] Use dynamic linking for libmace library when setting to 1, or static linking when setting to 0, default to 0.
* - model_name * - model_name
- model name. should be unique if there are multiple models. - model name. should be unique if there are multiple models.
**LIMIT: if build_type is code, model_name will used in c++ code so that model_name must fulfill c++ name specification.** **LIMIT: if build_type is code, model_name will used in c++ code so that model_name must fulfill c++ name specification.**
......
...@@ -172,7 +172,7 @@ built-in tool when necessary. ...@@ -172,7 +172,7 @@ built-in tool when necessary.
3.1 Overview 3.1 Overview
----------------- -----------------
MiAI Compute Engine can build either static or shared library (which is MiAI Compute Engine can build either static or shared library (which is
specified by ``dynamic_link`` in YAML model deployment file). specified by ``linkshared`` in YAML model deployment file).
The followings are two use cases. The followings are two use cases.
* **Build well tuned library for specific SoCs** * **Build well tuned library for specific SoCs**
...@@ -201,7 +201,7 @@ model conversion, compiling, test run, benchmark and correctness validation. ...@@ -201,7 +201,7 @@ model conversion, compiling, test run, benchmark and correctness validation.
.. note:: .. note::
1. ``tools/converter.py`` should be run at the root directory of this project. 1. ``tools/converter.py`` should be run at the root directory of this project.
2. When ``dynamic_link`` is set to ``1``, ``build_type`` should be ``proto``. 2. When ``linkshared`` is set to ``1``, ``build_type`` should be ``proto``.
And currently only android devices supported. And currently only android devices supported.
......
...@@ -170,7 +170,7 @@ Caffe目前只支持最新版本,旧版本请使用Caffe的工具进行升级 ...@@ -170,7 +170,7 @@ Caffe目前只支持最新版本,旧版本请使用Caffe的工具进行升级
3.1 简介 3.1 简介
--------------------------------------- ---------------------------------------
Mace目前提供静态库和动态库(可以在\ ``yaml``\ 文件中通过\ ``dynamic_link``\ 指定),有以下两种使用场景。 Mace目前提供静态库和动态库(可以在\ ``yaml``\ 文件中通过\ ``linkshared``\ 指定),有以下两种使用场景。
**特定SOC库** **特定SOC库**
...@@ -195,7 +195,7 @@ Mace目前提供静态库和动态库(可以在\ ``yaml``\ 文件中通过\ `` ...@@ -195,7 +195,7 @@ Mace目前提供静态库和动态库(可以在\ ``yaml``\ 文件中通过\ ``
.. warning:: .. warning::
1. 必须在项目的根目录下运行\ ``tools/converter.py``\ 脚本。 1. 必须在项目的根目录下运行\ ``tools/converter.py``\ 脚本。
2. 当\ ``dynamic_link``\ 被设置为1时,\ ``build_type``\ 必需设置为\ ``proto``\ 。当前动态链接的方式只支持安卓设备。 2. 当\ ``linkshared``\ 被设置为1时,\ ``build_type``\ 必需设置为\ ``proto``\ 。当前动态链接的方式只支持安卓设备。
--------------------------------------- ---------------------------------------
...@@ -331,7 +331,7 @@ Mace目前提供静态库和动态库(可以在\ ``yaml``\ 文件中通过\ `` ...@@ -331,7 +331,7 @@ Mace目前提供静态库和动态库(可以在\ ``yaml``\ 文件中通过\ ``
.. note:: .. note::
当\ ``dynamic_link``\ 设置为1时生成动态链接库。 当\ ``linkshared``\ 设置为1时生成动态链接库。
* ``./build/${library_name}/library/${target_abi}/libhexagon_controller.so`` * ``./build/${library_name}/library/${target_abi}/libhexagon_controller.so``
......
...@@ -8,7 +8,7 @@ embed_model_data: 1 ...@@ -8,7 +8,7 @@ embed_model_data: 1
# The build mode for model(s). # The build mode for model(s).
# 'code' stand for transfer model(s) into cpp code, 'proto' for model(s) in protobuf file(s). # 'code' stand for transfer model(s) into cpp code, 'proto' for model(s) in protobuf file(s).
build_type: code build_type: code
dynamic_link: 1 linkshared: 1
# One yaml config file can contain multi models' config message. # One yaml config file can contain multi models' config message.
models: models:
model_name: # model tag, which will be used in model loading and must be specific. model_name: # model tag, which will be used in model loading and must be specific.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
load("//mace:mace.bzl", "if_openmp_enabled", "if_android") load("//mace:mace.bzl", "if_openmp_enabled", "if_android")
cc_binary( cc_binary(
name = "mace_run", name = "mace_run_static",
srcs = ["mace_run.cc"], srcs = ["mace_run.cc"],
copts = if_android([ copts = if_android([
"-DMACE_ENABLE_OPENCL", "-DMACE_ENABLE_OPENCL",
...@@ -17,7 +17,7 @@ cc_binary( ...@@ -17,7 +17,7 @@ cc_binary(
) )
cc_binary( cc_binary(
name = "mace_run_deps_so", name = "mace_run_shared",
srcs = ["mace_run.cc"], srcs = ["mace_run.cc"],
copts = if_android([ copts = if_android([
"-DMACE_ENABLE_OPENCL", "-DMACE_ENABLE_OPENCL",
......
...@@ -51,8 +51,8 @@ CL_COMPILED_BINARY_FILE_NAME = "mace_cl_compiled_program.bin" ...@@ -51,8 +51,8 @@ CL_COMPILED_BINARY_FILE_NAME = "mace_cl_compiled_program.bin"
CODEGEN_BASE_DIR = 'mace/codegen' CODEGEN_BASE_DIR = 'mace/codegen'
MODEL_CODEGEN_DIR = CODEGEN_BASE_DIR + '/models' MODEL_CODEGEN_DIR = CODEGEN_BASE_DIR + '/models'
LIBMACE_SO_TARGET = "//mace:libmace.so" LIBMACE_SO_TARGET = "//mace:libmace.so"
MACE_RUN_TARGET = "//mace/tools/validation:mace_run" MACE_RUN_STATIC_TARGET = "//mace/tools/validation:mace_run_static"
MACE_RUN_TARGET_DEPS_SO = "//mace/tools/validation:mace_run_deps_so" MACE_RUN_SHARED_TARGET = "//mace/tools/validation:mace_run_shared"
ALL_SOC_TAG = 'all' ALL_SOC_TAG = 'all'
ABITypeStrs = [ ABITypeStrs = [
...@@ -126,7 +126,7 @@ class YAMLKeyword(object): ...@@ -126,7 +126,7 @@ class YAMLKeyword(object):
target_socs = 'target_socs' target_socs = 'target_socs'
build_type = 'build_type' build_type = 'build_type'
embed_model_data = 'embed_model_data' embed_model_data = 'embed_model_data'
dynamic_link = 'dynamic_link' linkshared = 'linkshared'
models = 'models' models = 'models'
platform = 'platform' platform = 'platform'
model_file_path = 'model_file_path' model_file_path = 'model_file_path'
...@@ -282,19 +282,19 @@ def format_model_config(config_file_path): ...@@ -282,19 +282,19 @@ def format_model_config(config_file_path):
if build_type == BuildType.proto: if build_type == BuildType.proto:
configs[YAMLKeyword.embed_model_data] = 0 configs[YAMLKeyword.embed_model_data] = 0
dynamic_link = configs.get(YAMLKeyword.dynamic_link, "") linkshared = configs.get(YAMLKeyword.linkshared, "")
if dynamic_link == "": if linkshared == "":
configs[YAMLKeyword.dynamic_link] = 0 configs[YAMLKeyword.linkshared] = 0
dynamic_link = 0 linkshared = 0
if not isinstance(dynamic_link, int) or dynamic_link < 0 or \ if not isinstance(linkshared, int) or linkshared < 0 or \
dynamic_link > 1: linkshared > 1:
MaceLogger.error(ModuleName.YAML_CONFIG, MaceLogger.error(ModuleName.YAML_CONFIG,
"dynamic_link must be 0 or 1. " "linkshared must be 0 or 1. "
"default is 0, for link mace lib statically, " "default is 0, for link mace lib statically, "
"1 for dynamic link.") "1 for dynamic linking.")
if build_type == BuildType.code and dynamic_link == 1: if build_type == BuildType.code and linkshared == 1:
MaceLogger.error(ModuleName.YAML_CONFIG, MaceLogger.error(ModuleName.YAML_CONFIG,
"'dynamic_link == 1' only support when " "'linkshared == 1' only support when "
"'build_type == proto'") "'build_type == proto'")
model_names = configs.get(YAMLKeyword.models, []) model_names = configs.get(YAMLKeyword.models, [])
...@@ -500,8 +500,8 @@ def print_configuration(flags, configs): ...@@ -500,8 +500,8 @@ def print_configuration(flags, configs):
configs[YAMLKeyword.build_type]]) configs[YAMLKeyword.build_type]])
data.append([YAMLKeyword.embed_model_data, data.append([YAMLKeyword.embed_model_data,
configs[YAMLKeyword.embed_model_data]]) configs[YAMLKeyword.embed_model_data]])
data.append([YAMLKeyword.dynamic_link, data.append([YAMLKeyword.linkshared,
configs[YAMLKeyword.dynamic_link]]) configs[YAMLKeyword.linkshared]])
data.append(["Tuning", flags.tuning]) data.append(["Tuning", flags.tuning])
MaceLogger.summary(StringFormatter.table(header, data, title)) MaceLogger.summary(StringFormatter.table(header, data, title))
...@@ -651,7 +651,7 @@ def build_specific_lib(target_abi, target_soc, serial_num, ...@@ -651,7 +651,7 @@ def build_specific_lib(target_abi, target_soc, serial_num,
library_name = configs[YAMLKeyword.library_name] library_name = configs[YAMLKeyword.library_name]
build_type = configs[YAMLKeyword.build_type] build_type = configs[YAMLKeyword.build_type]
embed_model_data = configs[YAMLKeyword.embed_model_data] embed_model_data = configs[YAMLKeyword.embed_model_data]
dynamic_link = configs[YAMLKeyword.dynamic_link] linkshared = configs[YAMLKeyword.linkshared]
hexagon_mode = get_hexagon_mode(configs) hexagon_mode = get_hexagon_mode(configs)
model_output_dirs = [] model_output_dirs = []
...@@ -662,10 +662,10 @@ def build_specific_lib(target_abi, target_soc, serial_num, ...@@ -662,10 +662,10 @@ def build_specific_lib(target_abi, target_soc, serial_num,
os.makedirs(build_tmp_binary_dir) os.makedirs(build_tmp_binary_dir)
sh_commands.gen_tuning_param_code(model_output_dirs) sh_commands.gen_tuning_param_code(model_output_dirs)
if dynamic_link == 0: if linkshared == 0:
mace_run_target = MACE_RUN_TARGET mace_run_target = MACE_RUN_STATIC_TARGET
else: else:
mace_run_target = MACE_RUN_TARGET_DEPS_SO mace_run_target = MACE_RUN_SHARED_TARGET
sh_commands.bazel_build( sh_commands.bazel_build(
LIBMACE_SO_TARGET, LIBMACE_SO_TARGET,
abi=target_abi, abi=target_abi,
...@@ -686,7 +686,7 @@ def build_specific_lib(target_abi, target_soc, serial_num, ...@@ -686,7 +686,7 @@ def build_specific_lib(target_abi, target_soc, serial_num,
enable_openmp=enable_openmp, enable_openmp=enable_openmp,
address_sanitizer=address_sanitizer address_sanitizer=address_sanitizer
) )
sh_commands.update_mace_run_lib(build_tmp_binary_dir, dynamic_link) sh_commands.update_mace_run_lib(build_tmp_binary_dir, linkshared)
binary_changed = False binary_changed = False
for model_name in configs[YAMLKeyword.models]: for model_name in configs[YAMLKeyword.models]:
...@@ -742,7 +742,7 @@ def build_specific_lib(target_abi, target_soc, serial_num, ...@@ -742,7 +742,7 @@ def build_specific_lib(target_abi, target_soc, serial_num,
build_type=build_type, build_type=build_type,
opencl_binary_file="", opencl_binary_file="",
shared_library_dir=get_shared_library_dir(library_name, target_abi), # noqa shared_library_dir=get_shared_library_dir(library_name, target_abi), # noqa
dynamic_link=dynamic_link, linkshared=linkshared,
) )
pull_opencl_binary_and_tuning_param(target_abi, serial_num, pull_opencl_binary_and_tuning_param(target_abi, serial_num,
...@@ -765,7 +765,7 @@ def build_specific_lib(target_abi, target_soc, serial_num, ...@@ -765,7 +765,7 @@ def build_specific_lib(target_abi, target_soc, serial_num,
enable_openmp=enable_openmp, enable_openmp=enable_openmp,
address_sanitizer=address_sanitizer address_sanitizer=address_sanitizer
) )
sh_commands.update_mace_run_lib(build_tmp_binary_dir, dynamic_link) sh_commands.update_mace_run_lib(build_tmp_binary_dir, linkshared)
if target_abi == ABIType.host: if target_abi == ABIType.host:
sh_commands.build_host_libraries(build_type, target_abi) sh_commands.build_host_libraries(build_type, target_abi)
...@@ -774,10 +774,10 @@ def build_specific_lib(target_abi, target_soc, serial_num, ...@@ -774,10 +774,10 @@ def build_specific_lib(target_abi, target_soc, serial_num,
sh_commands.build_benchmark_model(target_abi, sh_commands.build_benchmark_model(target_abi,
build_tmp_binary_dir, build_tmp_binary_dir,
hexagon_mode, hexagon_mode,
dynamic_link) linkshared)
# generate library # generate library
if dynamic_link == 0: if linkshared == 0:
sh_commands.merge_libs(target_soc, sh_commands.merge_libs(target_soc,
serial_num, serial_num,
target_abi, target_abi,
...@@ -913,7 +913,7 @@ def run_specific_target(flags, configs, target_abi, ...@@ -913,7 +913,7 @@ def run_specific_target(flags, configs, target_abi,
build_type = configs[YAMLKeyword.build_type] build_type = configs[YAMLKeyword.build_type]
embed_model_data = configs[YAMLKeyword.embed_model_data] embed_model_data = configs[YAMLKeyword.embed_model_data]
opencl_output_bin_path = "" opencl_output_bin_path = ""
dynamic_link = configs[YAMLKeyword.dynamic_link] linkshared = configs[YAMLKeyword.linkshared]
if not configs[YAMLKeyword.target_socs]: if not configs[YAMLKeyword.target_socs]:
build_tmp_binary_dir = get_build_binary_dir(library_name, target_abi, build_tmp_binary_dir = get_build_binary_dir(library_name, target_abi,
None, None) None, None)
...@@ -1002,7 +1002,7 @@ def run_specific_target(flags, configs, target_abi, ...@@ -1002,7 +1002,7 @@ def run_specific_target(flags, configs, target_abi,
address_sanitizer=flags.address_sanitizer, address_sanitizer=flags.address_sanitizer,
opencl_binary_file=opencl_output_bin_path, opencl_binary_file=opencl_output_bin_path,
shared_library_dir=get_shared_library_dir(library_name, target_abi), # noqa shared_library_dir=get_shared_library_dir(library_name, target_abi), # noqa
dynamic_link=dynamic_link, linkshared=linkshared,
) )
if flags.validate: if flags.validate:
model_file_path, weight_file_path = get_model_files_path( model_file_path, weight_file_path = get_model_files_path(
...@@ -1062,7 +1062,7 @@ def bm_specific_target(flags, configs, target_abi, target_soc, serial_num): ...@@ -1062,7 +1062,7 @@ def bm_specific_target(flags, configs, target_abi, target_soc, serial_num):
build_type = configs[YAMLKeyword.build_type] build_type = configs[YAMLKeyword.build_type]
embed_model_data = configs[YAMLKeyword.embed_model_data] embed_model_data = configs[YAMLKeyword.embed_model_data]
opencl_output_bin_path = "" opencl_output_bin_path = ""
dynamic_link = configs[YAMLKeyword.dynamic_link] linkshared = configs[YAMLKeyword.linkshared]
if not configs[YAMLKeyword.target_socs]: if not configs[YAMLKeyword.target_socs]:
build_tmp_binary_dir = get_build_binary_dir(library_name, target_abi, build_tmp_binary_dir = get_build_binary_dir(library_name, target_abi,
None, None) None, None)
...@@ -1142,7 +1142,7 @@ def bm_specific_target(flags, configs, target_abi, target_soc, serial_num): ...@@ -1142,7 +1142,7 @@ def bm_specific_target(flags, configs, target_abi, target_soc, serial_num):
gpu_priority_hint=flags.gpu_priority_hint, gpu_priority_hint=flags.gpu_priority_hint,
opencl_binary_file=opencl_output_bin_path, opencl_binary_file=opencl_output_bin_path,
shared_library_dir=get_shared_library_dir(library_name, target_abi), # noqa shared_library_dir=get_shared_library_dir(library_name, target_abi), # noqa
dynamic_link=dynamic_link) linkshared=linkshared)
def benchmark_model(flags): def benchmark_model(flags):
......
...@@ -561,16 +561,20 @@ def gen_random_input(model_output_dir, ...@@ -561,16 +561,20 @@ def gen_random_input(model_output_dir,
sh.cp("-f", input_file_list[i], dst_input_file) sh.cp("-f", input_file_list[i], dst_input_file)
def update_mace_run_lib(build_tmp_binary_dir, dynamic_link=0): def update_mace_run_lib(build_tmp_binary_dir, linkshared=0):
mace_run_filepath = build_tmp_binary_dir + "/mace_run" if linkshared == 0:
mace_run_filepath = build_tmp_binary_dir + "/mace_run_static"
else:
mace_run_filepath = build_tmp_binary_dir + "/mace_run_shared"
if os.path.exists(mace_run_filepath): if os.path.exists(mace_run_filepath):
sh.rm("-rf", mace_run_filepath) sh.rm("-rf", mace_run_filepath)
if dynamic_link == 0: if linkshared == 0:
sh.cp("-f", "bazel-bin/mace/tools/validation/mace_run", sh.cp("-f", "bazel-bin/mace/tools/validation/mace_run_static",
build_tmp_binary_dir) build_tmp_binary_dir)
else: else:
sh.cp("-f", "bazel-bin/mace/tools/validation/mace_run_deps_so", sh.cp("-f", "bazel-bin/mace/tools/validation/mace_run_shared",
"%s/mace_run" % build_tmp_binary_dir) build_tmp_binary_dir)
def touch_tuned_file_flag(build_tmp_binary_dir): def touch_tuned_file_flag(build_tmp_binary_dir):
...@@ -641,7 +645,7 @@ def tuning_run(abi, ...@@ -641,7 +645,7 @@ def tuning_run(abi,
output_file_name="model_out", output_file_name="model_out",
runtime_failure_ratio=0.0, runtime_failure_ratio=0.0,
address_sanitizer=False, address_sanitizer=False,
dynamic_link=0): linkshared=0):
print("* Run '%s' with round=%s, restart_round=%s, tuning=%s, " print("* Run '%s' with round=%s, restart_round=%s, tuning=%s, "
"out_of_range_check=%s, omp_num_threads=%s, cpu_affinity_policy=%s, " "out_of_range_check=%s, omp_num_threads=%s, cpu_affinity_policy=%s, "
"gpu_perf_hint=%s, gpu_priority_hint=%s" % "gpu_perf_hint=%s, gpu_priority_hint=%s" %
...@@ -651,13 +655,17 @@ def tuning_run(abi, ...@@ -651,13 +655,17 @@ def tuning_run(abi,
mace_model_path = "" mace_model_path = ""
if build_type == BuildType.proto: if build_type == BuildType.proto:
mace_model_path = "%s/%s.pb" % (mace_model_dir, model_tag) mace_model_path = "%s/%s.pb" % (mace_model_dir, model_tag)
if linkshared == 0:
mace_run_target = "mace_run_static"
else:
mace_run_target = "mace_run_shared"
if abi == "host": if abi == "host":
p = subprocess.Popen( p = subprocess.Popen(
[ [
"env", "env",
"MACE_CPP_MIN_VLOG_LEVEL=%s" % vlog_level, "MACE_CPP_MIN_VLOG_LEVEL=%s" % vlog_level,
"MACE_RUNTIME_FAILURE_RATIO=%f" % runtime_failure_ratio, "MACE_RUNTIME_FAILURE_RATIO=%f" % runtime_failure_ratio,
"%s/mace_run" % mace_run_dir, "%s/%s" % (mace_run_dir, mace_run_target),
"--model_name=%s" % model_tag, "--model_name=%s" % model_tag,
"--input_node=%s" % ",".join(input_nodes), "--input_node=%s" % ",".join(input_nodes),
"--output_node=%s" % ",".join(output_nodes), "--output_node=%s" % ",".join(output_nodes),
...@@ -713,14 +721,14 @@ def tuning_run(abi, ...@@ -713,14 +721,14 @@ def tuning_run(abi,
mace_model_phone_path, mace_model_phone_path,
serialno) serialno)
if dynamic_link == 1: if linkshared == 1:
adb_push("%s/libmace.so" % shared_library_dir, phone_data_dir, adb_push("%s/libmace.so" % shared_library_dir, phone_data_dir,
serialno) serialno)
adb_push("%s/libgnustl_shared.so" % shared_library_dir, adb_push("%s/libgnustl_shared.so" % shared_library_dir,
phone_data_dir, phone_data_dir,
serialno) serialno)
adb_push("%s/mace_run" % mace_run_dir, phone_data_dir, adb_push("%s/%s" % (mace_run_dir, mace_run_target), phone_data_dir,
serialno) serialno)
stdout_buff = [] stdout_buff = []
...@@ -741,7 +749,7 @@ def tuning_run(abi, ...@@ -741,7 +749,7 @@ def tuning_run(abi,
asan_rt_library_names(abi)) asan_rt_library_names(abi))
]) ])
adb_cmd.extend([ adb_cmd.extend([
"%s/mace_run" % phone_data_dir, "%s/%s" % (phone_data_dir, mace_run_target),
"--model_name=%s" % model_tag, "--model_name=%s" % model_tag,
"--input_node=%s" % ",".join(input_nodes), "--input_node=%s" % ",".join(input_nodes),
"--output_node=%s" % ",".join(output_nodes), "--output_node=%s" % ",".join(output_nodes),
...@@ -1040,12 +1048,12 @@ def packaging_lib(libmace_output_dir, project_name): ...@@ -1040,12 +1048,12 @@ def packaging_lib(libmace_output_dir, project_name):
def build_benchmark_model(abi, def build_benchmark_model(abi,
model_output_dir, model_output_dir,
hexagon_mode, hexagon_mode,
dynamic_link=False): linkshared=False):
benchmark_binary_file = "%s/benchmark_model" % model_output_dir benchmark_binary_file = "%s/benchmark_model" % model_output_dir
if os.path.exists(benchmark_binary_file): if os.path.exists(benchmark_binary_file):
sh.rm("-rf", benchmark_binary_file) sh.rm("-rf", benchmark_binary_file)
if dynamic_link == 0: if linkshared == 0:
benchmark_target = "//mace/benchmark:benchmark_model" benchmark_target = "//mace/benchmark:benchmark_model"
else: else:
benchmark_target = "//mace/benchmark:benchmark_model_deps_so" benchmark_target = "//mace/benchmark:benchmark_model_deps_so"
...@@ -1054,7 +1062,7 @@ def build_benchmark_model(abi, ...@@ -1054,7 +1062,7 @@ def build_benchmark_model(abi,
hexagon_mode=hexagon_mode) hexagon_mode=hexagon_mode)
target_bin = "/".join(bazel_target_to_bin(benchmark_target)) target_bin = "/".join(bazel_target_to_bin(benchmark_target))
if dynamic_link == 0: if linkshared == 0:
sh.cp("-f", target_bin, model_output_dir) sh.cp("-f", target_bin, model_output_dir)
else: else:
sh.cp("-f", target_bin, "%s/benchmark_model" % model_output_dir) sh.cp("-f", target_bin, "%s/benchmark_model" % model_output_dir)
...@@ -1082,7 +1090,7 @@ def benchmark_model(abi, ...@@ -1082,7 +1090,7 @@ def benchmark_model(abi,
gpu_perf_hint=3, gpu_perf_hint=3,
gpu_priority_hint=3, gpu_priority_hint=3,
input_file_name="model_input", input_file_name="model_input",
dynamic_link=0): linkshared=0):
print("* Benchmark for %s" % model_tag) print("* Benchmark for %s" % model_tag)
mace_model_path = "" mace_model_path = ""
...@@ -1132,7 +1140,7 @@ def benchmark_model(abi, ...@@ -1132,7 +1140,7 @@ def benchmark_model(abi,
mace_model_phone_path, mace_model_phone_path,
serialno) serialno)
if dynamic_link == 1: if linkshared == 1:
adb_push("%s/libmace.so" % shared_library_dir, phone_data_dir, adb_push("%s/libmace.so" % shared_library_dir, phone_data_dir,
serialno) serialno)
adb_push("%s/libgnustl_shared.so" % shared_library_dir, adb_push("%s/libgnustl_shared.so" % shared_library_dir,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册