From e3a814d4995bbe0e9c58356aa8e800b602577fd6 Mon Sep 17 00:00:00 2001 From: liuqi Date: Fri, 23 Feb 2018 14:03:35 +0800 Subject: [PATCH] Add -O3 optimization for mace_run and benchmark. --- benchmark.sh | 6 ++++-- build_mace_run.sh | 3 +++ build_production_code.sh | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/benchmark.sh b/benchmark.sh index 39de076d..5f5d80e9 100644 --- a/benchmark.sh +++ b/benchmark.sh @@ -18,12 +18,13 @@ if [ -f "$MODEL_OUTPUT_DIR/benchmark_model" ]; then rm -rf $MODEL_OUTPUT_DIR/benchmark_model fi -if [ x"$RUNTIME" = x"local" ]; then +if [ x"$RUNTIME" = x"host" ]; then bazel build --verbose_failures -c opt --strip always benchmark:benchmark_model \ --copt="-std=c++11" \ --copt="-D_GLIBCXX_USE_C99_MATH_TR1" \ --copt="-Werror=return-type" \ --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ + --copt="-O3" \ --define openmp=true \ --define production=true || exit 1 @@ -40,11 +41,12 @@ else bazel build --verbose_failures -c opt --strip always benchmark:benchmark_model \ --crosstool_top=//external:android/crosstool \ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \ - --cpu=${ANDROID_ABI} \ + --cpu=${TARGET_ABI} \ --copt="-std=c++11" \ --copt="-D_GLIBCXX_USE_C99_MATH_TR1" \ --copt="-Werror=return-type" \ --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ + --copt="-O3" \ --define openmp=true \ --define production=true || exit 1 diff --git a/build_mace_run.sh b/build_mace_run.sh index c635d800..0d9408a2 100644 --- a/build_mace_run.sh +++ b/build_mace_run.sh @@ -27,6 +27,7 @@ if [ x"$TARGET_ABI" = x"host" ]; then --copt="-Werror=return-type" \ --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ --define openmp=true \ + --copt="-O3" \ $PRODUCTION_MODE_BUILD_FLAGS || exit 1 bazel build --verbose_failures -c opt --strip always examples:mace_run \ @@ -35,6 +36,7 @@ if [ x"$TARGET_ABI" = x"host" ]; then --copt="-Werror=return-type" \ --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ --define openmp=true \ + --copt="-O3" \ $PRODUCTION_MODE_BUILD_FLAGS || exit 1 else if [ "$HEXAGON_MODE" = 1 ]; then @@ -50,6 +52,7 @@ else --copt="-Werror=return-type" \ --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ --define openmp=true \ + --copt="-O3" \ $PRODUCTION_MODE_BUILD_FLAGS \ $HEXAGON_MODE_BUILD_FLAG || exit 1 fi diff --git a/build_production_code.sh b/build_production_code.sh index ecc04743..dccf9f9d 100644 --- a/build_production_code.sh +++ b/build_production_code.sh @@ -15,6 +15,7 @@ build_host_target() --copt="-D_GLIBCXX_USE_C99_MATH_TR1" \ --copt="-Werror=return-type" \ --copt="-DMACE_OBFUSCATE_LITERALS" \ + --copt="-O3" \ --define openmp=true || exit -1 } @@ -28,6 +29,7 @@ build_target() --copt="-std=c++11" \ --copt="-D_GLIBCXX_USE_C99_MATH_TR1" \ --copt="-Werror=return-type" \ + --copt="-O3" \ --define openmp=true \ --copt="-DMACE_OBFUSCATE_LITERALS" || exit 1 } -- GitLab