diff --git a/mace/examples/README.md b/mace/examples/README.md deleted file mode 100644 index 328833fd5a0bcca9bc779c0e4eab912c95d318e3..0000000000000000000000000000000000000000 --- a/mace/examples/README.md +++ /dev/null @@ -1,32 +0,0 @@ -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 -``` diff --git a/mace/examples/cli/BUILD b/mace/examples/cli/BUILD index c2db76bb6bcbbf6ff0d7f8ff0140ffa00c9b85ad..c6f0d32be9139a94df797a61c24775ddfbbfe66f 100644 --- a/mace/examples/cli/BUILD +++ b/mace/examples/cli/BUILD @@ -39,12 +39,19 @@ cc_binary( ] + if_android([ "-DMACE_ENABLE_OPENCL", ]), - linkopts = ["-lm", "-pie", "-fPIE"] + if_openmp_enabled(["-fopenmp"]), + linkopts = [ + "-lm", + ] + if_openmp_enabled([ + "-fopenmp" + ]) + if_android([ + "-ldl", + "-pie", + "-llog", + ]), linkstatic = 0, deps = [ "//external:gflags_nothreads", "//mace/codegen:generated_mace_engine_factory", - "//mace/utils:utils", "//mace/codegen:generated_libmace", ], ) diff --git a/mace/examples/cli/README.md b/mace/examples/cli/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ba70a7e61dcaef7a550a68262cc872fc333142f5 --- /dev/null +++ b/mace/examples/cli/README.md @@ -0,0 +1,23 @@ +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 +``` diff --git a/mace/utils/tuner.h b/mace/utils/tuner.h index 2cd0f38206280579fc91cb34d66db7d050da94af..e4007b6694a415e7a058b5f6f33a93a2ba485e8e 100644 --- a/mace/utils/tuner.h +++ b/mace/utils/tuner.h @@ -140,6 +140,8 @@ class Tuner { param_table_.emplace(key, params); } ifs.close(); + } else { + LOG(WARNING) << "Read OpenCL tuned parameters file failed."; } } else { LOG(INFO) << "There is no tuned parameters."; diff --git a/tools/build-standalone-lib.sh b/tools/build-standalone-lib.sh index 1c487213e2c72736f9c999426a34cb9a2f3fb063..68db7c98a4d565f03e541af59302a30e8d394b19 100755 --- a/tools/build-standalone-lib.sh +++ b/tools/build-standalone-lib.sh @@ -12,14 +12,14 @@ mkdir -p $INCLUDE_DIR cp mace/public/*.h $INCLUDE_DIR/ # make directories +rm -rf $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 -rm -f $LIB_DIR/arm64-v8a/* +rm -rf $LIB_DIR/linux-x86-64 mkdir -p $LIB_DIR/linux-x86-64 -rm -f $LIB_DIR/linux-x86-64/* # build shared libraries echo "build shared lib for armeabi-v7a" diff --git a/tools/converter.py b/tools/converter.py index 656fd3640962d1b278a9e9657c5502cf87d05f18..8c0ea3406368a78cc158a1e934147207f1829dc9 100644 --- a/tools/converter.py +++ b/tools/converter.py @@ -168,7 +168,6 @@ class YAMLKeyword(object): target_socs = 'target_socs' model_graph_format = 'model_graph_format' model_data_format = 'model_data_format' - linkshared = 'linkshared' models = 'models' platform = 'platform' model_file_path = 'model_file_path' @@ -526,13 +525,6 @@ def get_opencl_parameter_output_path(library_name, target_abi, 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): # make build dir if not os.path.exists(BUILD_OUTPUT_DIR): @@ -751,7 +743,7 @@ def build_model_lib(configs, 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):