From f60de41d62f143c8ed4c1f9bee7be97e878cb82e Mon Sep 17 00:00:00 2001 From: liuqi Date: Fri, 13 Jul 2018 13:38:23 +0800 Subject: [PATCH] Fix bug: build x86_64 which need opencl. --- .gitlab-ci.yml | 6 ++++++ mace/libmace/mace_runtime.cc | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a126054f..e49a7dc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ stages: - pycodestyle - docs - platform_compatible_tests + - build_libraries - ndk_versions_compatible_tests - ops_test - api_test @@ -72,6 +73,11 @@ platform_compatible_tests: script: - bazel build mace/core:core +build_libraries: + stage: build_libraries + script: + - bash tools/build-standalone-lib.sh + ndk_versions_compatible_tests: stage: ndk_versions_compatible_tests script: diff --git a/mace/libmace/mace_runtime.cc b/mace/libmace/mace_runtime.cc index 720b8299..41eabd45 100644 --- a/mace/libmace/mace_runtime.cc +++ b/mace/libmace/mace_runtime.cc @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "mace/core/macros.h" #include "mace/core/runtime/cpu/cpu_runtime.h" +#ifdef MACE_ENABLE_OPENCL #include "mace/core/runtime/opencl/opencl_runtime.h" +#endif // MACE_ENABLE_OPENCL #include "mace/public/mace_runtime.h" #include "mace/utils/logging.h" @@ -28,7 +31,11 @@ void SetKVStorageFactory(std::shared_ptr storage_factory) { // Set OpenCL Compiled Binary paths, just call once. (Not thread-safe) void SetOpenCLBinaryPaths(const std::vector &paths) { +#ifdef MACE_ENABLE_OPENCL OpenCLRuntime::ConfigureOpenCLBinaryPath(paths); +#else + MACE_UNUSED(paths); +#endif // MACE_ENABLE_OPENCL } extern std::string kOpenCLParameterPath; @@ -38,9 +45,14 @@ void SetOpenCLParameterPath(const std::string &path) { } void SetGPUHints(GPUPerfHint gpu_perf_hint, GPUPriorityHint gpu_priority_hint) { +#ifdef MACE_ENABLE_OPENCL VLOG(1) << "Set GPU configurations, gpu_perf_hint: " << gpu_perf_hint << ", gpu_priority_hint: " << gpu_priority_hint; OpenCLRuntime::Configure(gpu_perf_hint, gpu_priority_hint); +#else + MACE_UNUSED(gpu_perf_hint); + MACE_UNUSED(gpu_priority_hint); +#endif // MACE_ENABLE_OPENCL } MaceStatus SetOpenMPThreadPolicy(int num_threads_hint, -- GitLab