提交 f138e8f7 编写于 作者: L liuqi

Remove unused code in example and fix some typo.

上级 b352192b
Examples
=======
* Build the example (e.g., with armeabi-v7a target)
```
# To enable debug mode build, use '-c dbg' flag.
# To check the underlying commands executed, use '-s' flag.
# TO check the failed command, use '--verbose_failures' flag.
bazel build -c opt mace/examples:helloworld \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--cpu=arm64-v8a
```
* To run adb inside docker, the container network should use 'host'
```
docker run -it --net=host mace-dev /bin/bash
```
* Push and run the example
```
adb shell "mkdir /data/local/tmp"
adb push bazel-bin/mace/examples/helloworld /data/local/tmp/
adb shell /data/local/tmp/helloworld
```
* Check the logs
```
adb logcat | grep native
```
...@@ -39,12 +39,19 @@ cc_binary( ...@@ -39,12 +39,19 @@ cc_binary(
] + if_android([ ] + if_android([
"-DMACE_ENABLE_OPENCL", "-DMACE_ENABLE_OPENCL",
]), ]),
linkopts = ["-lm", "-pie", "-fPIE"] + if_openmp_enabled(["-fopenmp"]), linkopts = [
"-lm",
] + if_openmp_enabled([
"-fopenmp"
]) + if_android([
"-ldl",
"-pie",
"-llog",
]),
linkstatic = 0, linkstatic = 0,
deps = [ deps = [
"//external:gflags_nothreads", "//external:gflags_nothreads",
"//mace/codegen:generated_mace_engine_factory", "//mace/codegen:generated_mace_engine_factory",
"//mace/utils:utils",
"//mace/codegen:generated_libmace", "//mace/codegen:generated_libmace",
], ],
) )
......
Examples
=======
* Convert model
```
python tools/converter.py convert --config=/path/to/your/model_deployment_file
```
* Run example
```
python tools/converter.py run --config=/path/to/your/model_deployment_file --example
```
* Validate result
```
python tools/converter.py run --config=/path/to/your/model_deployment_file --example --example
```
* Check the logs
```
adb logcat
```
...@@ -140,6 +140,8 @@ class Tuner { ...@@ -140,6 +140,8 @@ class Tuner {
param_table_.emplace(key, params); param_table_.emplace(key, params);
} }
ifs.close(); ifs.close();
} else {
LOG(WARNING) << "Read OpenCL tuned parameters file failed.";
} }
} else { } else {
LOG(INFO) << "There is no tuned parameters."; LOG(INFO) << "There is no tuned parameters.";
......
...@@ -12,14 +12,14 @@ mkdir -p $INCLUDE_DIR ...@@ -12,14 +12,14 @@ mkdir -p $INCLUDE_DIR
cp mace/public/*.h $INCLUDE_DIR/ cp mace/public/*.h $INCLUDE_DIR/
# make directories # make directories
rm -rf $LIB_DIR/armeabi-v7a
mkdir -p $LIB_DIR/armeabi-v7a mkdir -p $LIB_DIR/armeabi-v7a
rm -f $LIB_DIR/armeabi-v7a/*
rm -rf $LIB_DIR/arm64-v8a
mkdir -p $LIB_DIR/arm64-v8a mkdir -p $LIB_DIR/arm64-v8a
rm -f $LIB_DIR/arm64-v8a/*
rm -rf $LIB_DIR/linux-x86-64
mkdir -p $LIB_DIR/linux-x86-64 mkdir -p $LIB_DIR/linux-x86-64
rm -f $LIB_DIR/linux-x86-64/*
# build shared libraries # build shared libraries
echo "build shared lib for armeabi-v7a" echo "build shared lib for armeabi-v7a"
......
...@@ -168,7 +168,6 @@ class YAMLKeyword(object): ...@@ -168,7 +168,6 @@ class YAMLKeyword(object):
target_socs = 'target_socs' target_socs = 'target_socs'
model_graph_format = 'model_graph_format' model_graph_format = 'model_graph_format'
model_data_format = 'model_data_format' model_data_format = 'model_data_format'
linkshared = 'linkshared'
models = 'models' models = 'models'
platform = 'platform' platform = 'platform'
model_file_path = 'model_file_path' model_file_path = 'model_file_path'
...@@ -526,13 +525,6 @@ def get_opencl_parameter_output_path(library_name, target_abi, ...@@ -526,13 +525,6 @@ def get_opencl_parameter_output_path(library_name, target_abi,
target_soc) target_soc)
def get_shared_library_dir(library_name, abi):
return '%s/%s/%s/%s' % (BUILD_OUTPUT_DIR,
library_name,
OUTPUT_LIBRARY_DIR_NAME,
abi)
def clear_build_dirs(library_name): def clear_build_dirs(library_name):
# make build dir # make build dir
if not os.path.exists(BUILD_OUTPUT_DIR): if not os.path.exists(BUILD_OUTPUT_DIR):
...@@ -751,7 +743,7 @@ def build_model_lib(configs, address_sanitizer): ...@@ -751,7 +743,7 @@ def build_model_lib(configs, address_sanitizer):
address_sanitizer=address_sanitizer address_sanitizer=address_sanitizer
) )
sh.cp(MODEL_LIB_PATH, model_lib_output_path) sh.cp("-f", MODEL_LIB_PATH, model_lib_output_path)
def print_library_summary(configs): def print_library_summary(configs):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册