diff --git a/cmake/package_lite.cmake b/cmake/package_lite.cmake index 5164d4b23cf..6cfbe7e6bce 100644 --- a/cmake/package_lite.cmake +++ b/cmake/package_lite.cmake @@ -747,6 +747,10 @@ elseif(WIN32) ${RUNTIME_COMPONENT_NAME}) endif() endif() + if(MSLITE_ENABLE_RUNTIME_GLOG) + file(GLOB GLOG_LIB_LIST ${glog_LIBPATH}/../bin/*.dll) + install(FILES ${GLOG_LIB_LIST} DESTINATION ${GLOG_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME}) + endif() install(FILES ${TOP_DIR}/mindspore/lite/include/kernel_interface.h DESTINATION ${RUNTIME_INC_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME}) install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/registry/ DESTINATION ${RUNTIME_INC_DIR}/registry diff --git a/mindspore/core/utils/log_adapter.cc b/mindspore/core/utils/log_adapter.cc index 50f6981608b..6a866a02774 100644 --- a/mindspore/core/utils/log_adapter.cc +++ b/mindspore/core/utils/log_adapter.cc @@ -753,7 +753,7 @@ MS_CORE_API void common_log_init(void) { } else { FLAGS_logtostderr = false; // Set log dir from GLOG_log_dir with RANK_ID or OMPI_COMM_WORLD_RANK. -#ifndef BUILD_LITE_INFERENCE +#ifndef BUILD_LITE const std::string rank_id = mindspore::GetEnv("RANK_ID"); const std::string gpu_rank_id = mindspore::GetEnv("OMPI_COMM_WORLD_RANK"); std::string rank = "0"; @@ -779,8 +779,8 @@ MS_CORE_API void common_log_init(void) { // shared lib init hook #if defined(_WIN32) || defined(_WIN64) || defined(__APPLE__) -#ifdef _MSC_VER -void mindspore_log_init(void) { +#if defined(_MSC_VER) || defined(BUILD_LITE) +MS_CORE_API void mindspore_log_init(void) { #else __attribute__((constructor)) void mindspore_log_init(void) { #endif @@ -791,9 +791,7 @@ MS_CORE_API void mindspore_log_init(void) { #define google mindspore_private static bool is_glog_initialzed = false; if (!is_glog_initialzed) { -#if !defined(_WIN32) && !defined(_WIN64) google::InitGoogleLogging("mindspore"); -#endif is_glog_initialzed = true; } #undef google diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index e971722b709..a8bf393c57e 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -329,6 +329,10 @@ if(NOT APPLE) set(MSLITE_ENABLE_COREML off) endif() +if(WIN32) + set(MSLITE_ENABLE_RUNTIME_GLOG on) +endif() + if(DEFINED ENV{MSLITE_ENABLE_RUNTIME_GLOG}) set(MSLITE_ENABLE_RUNTIME_GLOG $ENV{MSLITE_ENABLE_RUNTIME_GLOG}) endif() diff --git a/mindspore/lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc b/mindspore/lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc index 2ba16d0b405..9a5b01518af 100644 --- a/mindspore/lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc +++ b/mindspore/lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc @@ -63,9 +63,7 @@ Status ModelParallelRunner::Init(const std::vector &model_path, #ifdef USE_GLOG mindspore::mindspore_log_init(); #endif -#ifdef CAPTURE_SIGNALS - CaptureSignal(); -#endif + if (!PlatformInstructionSetSupportCheck()) { return kLiteNotSupport; } @@ -79,6 +77,9 @@ Status ModelParallelRunner::Init(const std::vector &model_path, MS_LOG(ERROR) << "model runner init failed."; return kLiteError; } +#ifdef CAPTURE_SIGNALS + CaptureSignal(); +#endif return status; } @@ -100,6 +101,9 @@ Status ModelParallelRunner::Init(const void *model_data, size_t data_size, MS_LOG(ERROR) << "model runner init failed."; return kLiteError; } +#ifdef CAPTURE_SIGNALS + CaptureSignal(); +#endif return status; } diff --git a/mindspore/lite/src/litert/lite_session.cc b/mindspore/lite/src/litert/lite_session.cc index 932e7d2ac8d..d3382800eff 100644 --- a/mindspore/lite/src/litert/lite_session.cc +++ b/mindspore/lite/src/litert/lite_session.cc @@ -1196,9 +1196,6 @@ int LiteSession::Resize(const std::vector &inputs, } is_running_.store(false); -#if defined(LINUX_RUNTIME) - (void)malloc_trim(0); -#endif ret = UpdateInputShapeMap(); if (ret != RET_OK) { MS_LOG(ERROR) << "update input shape map failed."; diff --git a/mindspore/lite/test/st/win_runtest.bat b/mindspore/lite/test/st/win_runtest.bat index dabf9a49566..52e2d78a1e6 100644 --- a/mindspore/lite/test/st/win_runtest.bat +++ b/mindspore/lite/test/st/win_runtest.bat @@ -78,6 +78,7 @@ for /f "tokens=1-2 delims= " %%i in (%MODEL_CONFIG%) do ( echo "Run converted models" copy %DST_PACKAGE_PATH%\runtime\lib\* %DST_PACKAGE_PATH%\tools\benchmark\ +copy %DST_PACKAGE_PATH%\runtime\third_party\glog\* %DST_PACKAGE_PATH%\tools\benchmark\ cd /d %DST_PACKAGE_PATH%\tools\benchmark\ SET INPUT_BASE=%MODEL_PATH%/input_output/input diff --git a/mindspore/lite/tools/converter/converter.cc b/mindspore/lite/tools/converter/converter.cc index 00c5022790e..0e0d6e83b7e 100644 --- a/mindspore/lite/tools/converter/converter.cc +++ b/mindspore/lite/tools/converter/converter.cc @@ -49,7 +49,7 @@ namespace mindspore { extern "C" { -void common_log_init(); +void mindspore_log_init(); } namespace lite { #define CONVERTER_LOG_ERROR(str) \ @@ -769,7 +769,7 @@ int CheckValueParam(const std::shared_ptr ¶m) { } int RunConverter(const std::shared_ptr ¶m, void **model_data, size_t *data_size, bool not_save) { - mindspore::common_log_init(); + mindspore::mindspore_log_init(); param->aclModelOptionCfgParam.offline = !not_save; int status = CheckValueParam(param);