From 63e64362fc1b73b89000c4351bdca4f1bc66c777 Mon Sep 17 00:00:00 2001 From: Liangliang He Date: Tue, 3 Jul 2018 14:32:07 +0800 Subject: [PATCH] Improve development docs --- docs/development/adding_a_new_op.md | 4 +++ docs/development/how_to_run_tests.md | 52 ++++++++++++++++++++++++++++ docs/index.rst | 1 + 3 files changed, 57 insertions(+) create mode 100644 docs/development/how_to_run_tests.md diff --git a/docs/development/adding_a_new_op.md b/docs/development/adding_a_new_op.md index 299c65ef..bb74f12c 100644 --- a/docs/development/adding_a_new_op.md +++ b/docs/development/adding_a_new_op.md @@ -96,6 +96,10 @@ Add test and benchmark It's strongly recommended to add unit tests and micro benchmarks for your new Op. If you wish to contribute back, it's required. +Add Op in model converter +------------------------- +You need to add this new Op in the model converter. + Document the new Op --------------------- Finally, add an entry in operator table in the document. diff --git a/docs/development/how_to_run_tests.md b/docs/development/how_to_run_tests.md new file mode 100644 index 00000000..5b140269 --- /dev/null +++ b/docs/development/how_to_run_tests.md @@ -0,0 +1,52 @@ +How to run tests +================ + +To run a test, you need to first cross compile the code, push the binary +into the device and then execute the binary. To automate this process, +MACE provides `tools/bazel_adb_run.py` tool. + +You need to make sure your device is connected to you dev machine before +running tests. + +Run unit tests +-------------- + +MACE use [gtest](https://github.com/google/googletest) for unit tests. + +* Run all unit tests defined in a Bazel target, for example, run `ops_test`: + + ```sh + python tools/bazel_adb_run.py --target="//mace/ops:ops_test" \ + --run_target=True + ``` + +* Run unit tests with [gtest](https://github.com/google/googletest) filter, +for example, run `Conv2dOpTest` unit tests: + + ```sh + python tools/bazel_adb_run.py --target="//mace/ops:ops_test" \ + --run_target=True \ + --args="--gtest_filter=Conv2dOpTest*" + ``` + +Run micro benchmarks +-------------------- + +MACE provides a micro benchmark framework for performance tuning. + +* Run all micro benchmarks defined in a Bazel target, for example, run all +`ops_benchmark` micro benchmarks: + + ```sh + python tools/bazel_adb_run.py --target="//mace/ops:ops_benchmark" \ + --run_target=True + ``` + +* Run micro benchmarks with regex filter, for example, run all `CONV_2D` GPU +micro benchmarks: + + ```sh + python tools/bazel_adb_run.py --target="//mace/ops:ops_benchmark" \ + --run_target=True \ + --args="--filter=MACE_BM_CONV_2D_.*_GPU" + ``` diff --git a/docs/index.rst b/docs/index.rst index e99ea4ab..a2529f05 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,6 +28,7 @@ The main documentation is organized into the following sections: development/contributing development/adding_a_new_op + development/how_to_run_tests development/memory_layout .. toctree:: -- GitLab