From f9e197f49c90b014132eb17df284c2012aecacb8 Mon Sep 17 00:00:00 2001 From: greatpanc Date: Thu, 28 Apr 2022 10:49:19 +0800 Subject: [PATCH] cmakelist bugfix --- cmake/external_libs/glog.cmake | 6 ++--- mindspore/lite/CMakeLists.txt | 26 ++++++++++------------ mindspore/lite/tools/common/opengl_util.cc | 2 +- mindspore/lite/tools/common/opengl_util.h | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/cmake/external_libs/glog.cmake b/cmake/external_libs/glog.cmake index cc019bf71a1..d2a97fcf37a 100644 --- a/cmake/external_libs/glog.cmake +++ b/cmake/external_libs/glog.cmake @@ -1,8 +1,8 @@ if(BUILD_LITE) if(MSVC) - set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}") - set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}") - set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + set(glog_CXXFLAGS "${CMAKE_CXX_FLAGS}") + set(glog_CFLAGS "${CMAKE_C_FLAGS}") + set(glog_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") else() set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private") set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_C_FLAGS}") diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index b9162c676ea..10b82c975fc 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -86,6 +86,18 @@ if(DEFINED ENV{MSLITE_ENABLE_TRAIN}) set(MSLITE_ENABLE_TRAIN $ENV{MSLITE_ENABLE_TRAIN}) endif() +if(DEFINED ENV{MSLITE_ENABLE_SERVER_INFERENCE}) + set(MSLITE_ENABLE_SERVER_INFERENCE $ENV{MSLITE_ENABLE_SERVER_INFERENCE}) +endif() +if(MSLITE_ENABLE_SERVER_INFERENCE) + set(MSLITE_ENABLE_DYNAMIC_THREAD_DISTRIBUTE on) + set(MSLITE_ENABLE_BFC_MEMORY on) + set(MSLITE_ENABLE_PARALLEL_INFERENCE on) + set(MSLITE_ENABLE_SHARING_MODEL_WEIGHT on) + set(MSLITE_ENABLE_RUNTIME_GLOG on) + set(MSLITE_ENABLE_AVX512 on) + add_compile_definitions(SERVER_INFERENCE) +endif() if(DEFINED ENV{MSLITE_ENABLE_SSE}) set(MSLITE_ENABLE_SSE $ENV{MSLITE_ENABLE_SSE}) endif() @@ -165,10 +177,6 @@ if(DEFINED ENV{MSLITE_ENABLE_COVERAGE}) set(MSLITE_ENABLE_COVERAGE $ENV{MSLITE_ENABLE_COVERAGE}) endif() -if(DEFINED ENV{MSLITE_ENABLE_SERVER_INFERENCE}) - set(MSLITE_ENABLE_SERVER_INFERENCE $ENV{MSLITE_ENABLE_SERVER_INFERENCE}) -endif() - if(DEFINED ENV{MSLITE_ENABLE_SERVING}) set(MSLITE_ENABLE_SERVING $ENV{MSLITE_ENABLE_SERVING}) endif() @@ -263,16 +271,6 @@ else() set(MSLITE_ENABLE_NPU off) endif() -if(MSLITE_ENABLE_SERVER_INFERENCE) - set(MSLITE_ENABLE_DYNAMIC_THREAD_DISTRIBUTE on) - set(MSLITE_ENABLE_BFC_MEMORY on) - set(MSLITE_ENABLE_PARALLEL_INFERENCE on) - set(MSLITE_ENABLE_SHARING_MODEL_WEIGHT on) - set(MSLITE_ENABLE_RUNTIME_GLOG on) - set(MSLITE_ENABLE_AVX512 on) - add_compile_definitions(SERVER_INFERENCE) -endif() - if(DEFINED ENV{MSLITE_ENABLE_RUNTIME_GLOG}) set(MSLITE_ENABLE_RUNTIME_GLOG $ENV{MSLITE_ENABLE_RUNTIME_GLOG}) endif() diff --git a/mindspore/lite/tools/common/opengl_util.cc b/mindspore/lite/tools/common/opengl_util.cc index f00597ab5be..14ddaca4630 100644 --- a/mindspore/lite/tools/common/opengl_util.cc +++ b/mindspore/lite/tools/common/opengl_util.cc @@ -20,7 +20,7 @@ namespace mindspore { namespace OpenGL { -#if defined(GPU_OPENCL) && defined(__ANDROID__) +#if defined(GPU_OPENCL) && defined(__ANDROID__) && defined(ENABLE_ARM64) const char *g_glsl_host_to_device_2d = "#version 320 es\n" "#define PRECISION highp\n" diff --git a/mindspore/lite/tools/common/opengl_util.h b/mindspore/lite/tools/common/opengl_util.h index 6ba1cb030a2..3189c273a8a 100644 --- a/mindspore/lite/tools/common/opengl_util.h +++ b/mindspore/lite/tools/common/opengl_util.h @@ -23,7 +23,7 @@ #include "src/common/log_adapter.h" #include "nnacl/op_base.h" -#if defined(GPU_OPENCL) && defined(__ANDROID__) +#if defined(GPU_OPENCL) && defined(__ANDROID__) && defined(ENABLE_ARM64) #include "EGL/egl.h" #include "GLES3/gl3.h" #include "GLES3/gl32.h"