From f3e416ce5c42e01ede2c7dc5529227cf0ce24dba Mon Sep 17 00:00:00 2001 From: liuqi Date: Thu, 13 Dec 2018 13:31:16 +0800 Subject: [PATCH] Fix travis CI problems. --- mace/test/BUILD | 80 +++++++++++++++++++++++++---------- mace/test/mace_api_mt_test.cc | 2 - tools/bazel_adb_run.py | 29 +++++++------ 3 files changed, 73 insertions(+), 38 deletions(-) diff --git a/mace/test/BUILD b/mace/test/BUILD index 593076a3..63faecfe 100644 --- a/mace/test/BUILD +++ b/mace/test/BUILD @@ -4,7 +4,16 @@ package( licenses(["notice"]) # Apache 2.0 -load("//mace:mace.bzl", "if_android", "if_neon_enabled", "if_openmp_enabled", "if_android_armv7", "if_hexagon_enabled") +load( + "//mace:mace.bzl", + "if_android", + "if_hexagon_enabled", + "if_not_hexagon_enabled", + "if_openmp_enabled", + "if_neon_enabled", + "if_opencl_enabled", + "if_quantize_enabled", +) cc_library( name = "mace_api_test_header", @@ -18,13 +27,22 @@ cc_test( name = "mace_api_test", testonly = 1, srcs = ["mace_api_test.cc"], - copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] + - if_openmp_enabled(["-fopenmp"]) + - if_neon_enabled(["-DMACE_ENABLE_NEON"]) + - if_android_armv7(["-mfpu=neon"]) + - if_android_armv7(["-mfloat-abi=softfp"]) + - if_android(["-DMACE_ENABLE_OPENCL"]) + - if_hexagon_enabled(["-DMACE_ENABLE_HEXAGON"]), + copts = [ + "-Werror", + "-Wextra", + "-Wno-missing-field-initializers", + ] + if_openmp_enabled([ + "-fopenmp", + "-DMACE_ENABLE_OPENMP", + ]) + if_opencl_enabled([ + "-DMACE_ENABLE_OPENCL", + ]) + if_quantize_enabled([ + "-DMACE_ENABLE_QUANTIZE", + ]) + if_hexagon_enabled([ + "-DMACE_ENABLE_HEXAGON", + ]) + if_neon_enabled([ + "-DMACE_ENABLE_NEON", + ]), linkopts = ["-fopenmp"], linkstatic = 1, deps = [ @@ -39,13 +57,22 @@ cc_test( name = "mace_api_mt_test", testonly = 1, srcs = ["mace_api_mt_test.cc"], - copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] + - if_openmp_enabled(["-fopenmp"]) + - if_neon_enabled(["-DMACE_ENABLE_NEON"]) + - if_android_armv7(["-mfpu=neon"]) + - if_android_armv7(["-mfloat-abi=softfp"]) + - if_android(["-DMACE_ENABLE_OPENCL"]) + - if_hexagon_enabled(["-DMACE_ENABLE_HEXAGON"]), + copts = [ + "-Werror", + "-Wextra", + "-Wno-missing-field-initializers", + ] + if_openmp_enabled([ + "-fopenmp", + "-DMACE_ENABLE_OPENMP", + ]) + if_opencl_enabled([ + "-DMACE_ENABLE_OPENCL", + ]) + if_quantize_enabled([ + "-DMACE_ENABLE_QUANTIZE", + ]) + if_hexagon_enabled([ + "-DMACE_ENABLE_HEXAGON", + ]) + if_neon_enabled([ + "-DMACE_ENABLE_NEON", + ]), linkopts = ["-fopenmp"], linkstatic = 1, deps = [ @@ -60,13 +87,22 @@ cc_test( name = "mace_api_exception_test", testonly = 1, srcs = ["mace_api_exception_test.cc"], - copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] + - if_openmp_enabled(["-fopenmp"]) + - if_neon_enabled(["-DMACE_ENABLE_NEON"]) + - if_android_armv7(["-mfpu=neon"]) + - if_android_armv7(["-mfloat-abi=softfp"]) + - if_android(["-DMACE_ENABLE_OPENCL"]) + - if_hexagon_enabled(["-DMACE_ENABLE_HEXAGON"]), + copts = [ + "-Werror", + "-Wextra", + "-Wno-missing-field-initializers", + ] + if_openmp_enabled([ + "-fopenmp", + "-DMACE_ENABLE_OPENMP", + ]) + if_opencl_enabled([ + "-DMACE_ENABLE_OPENCL", + ]) + if_quantize_enabled([ + "-DMACE_ENABLE_QUANTIZE", + ]) + if_hexagon_enabled([ + "-DMACE_ENABLE_HEXAGON", + ]) + if_neon_enabled([ + "-DMACE_ENABLE_NEON", + ]), linkopts = ["-fopenmp"], linkstatic = 1, deps = [ diff --git a/mace/test/mace_api_mt_test.cc b/mace/test/mace_api_mt_test.cc index cce49273..3a55a4dc 100644 --- a/mace/test/mace_api_mt_test.cc +++ b/mace/test/mace_api_mt_test.cc @@ -33,8 +33,6 @@ void MaceRunFunc(const int in_out_size) { } std::string filter_tensor_name = "filter"; - const DeviceType device = DeviceType::GPU; - const std::vector> input_shapes = {{1, 32, 32, 16}}; const std::vector> output_shapes = {{1, 32, 32, 16}}; const std::vector filter_shape = {16, 16, 3, 3}; diff --git a/tools/bazel_adb_run.py b/tools/bazel_adb_run.py index 5e908604..71f3cc14 100644 --- a/tools/bazel_adb_run.py +++ b/tools/bazel_adb_run.py @@ -125,20 +125,6 @@ def parse_args(): def main(unused_args): - target_socs = None - target_devices = DeviceManager.list_devices(FLAGS.device_yml) - if FLAGS.target_socs != "all" and FLAGS.target_socs != "random": - target_socs = set(FLAGS.target_socs.split(',')) - target_devices = [dev for dev in target_devices - if dev[YAMLKeyword.target_socs] in target_socs] - if FLAGS.target_socs == "random": - unlocked_devices = \ - [d for d in target_devices if not sh_commands.is_device_locked(d)] - if len(unlocked_devices) > 0: - target_devices = [random.choice(unlocked_devices)] - else: - target_devices = [random.choice(target_devices)] - target = FLAGS.target host_bin_path, bin_name = sh_commands.bazel_target_to_bin(target) target_abis = FLAGS.target_abis.split(',') @@ -150,6 +136,21 @@ def main(unused_args): enable_neon=FLAGS.enable_neon, address_sanitizer=FLAGS.address_sanitizer) if FLAGS.run_target: + target_devices = DeviceManager.list_devices(FLAGS.device_yml) + if FLAGS.target_socs != "all" and FLAGS.target_socs != "random": + target_socs = set(FLAGS.target_socs.split(',')) + target_devices = \ + [dev for dev in target_devices + if dev[YAMLKeyword.target_socs] in target_socs] + if FLAGS.target_socs == "random": + unlocked_devices = \ + [d for d in target_devices if + not sh_commands.is_device_locked(d)] + if len(unlocked_devices) > 0: + target_devices = [random.choice(unlocked_devices)] + else: + target_devices = [random.choice(target_devices)] + for dev in target_devices: if target_abi not in dev[YAMLKeyword.target_abis]: print("Skip device %s which does not support ABI %s" % -- GitLab