forked from mindspore-Ecosystem/mindspore
windows support glog
This commit is contained in:
parent
23f857c49f
commit
a9691f42b1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -63,9 +63,7 @@ Status ModelParallelRunner::Init(const std::vector<char> &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<char> &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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1196,9 +1196,6 @@ int LiteSession::Resize(const std::vector<mindspore::lite::Tensor *> &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.";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<ConverterPara> ¶m) {
|
|||
}
|
||||
|
||||
int RunConverter(const std::shared_ptr<ConverterPara> ¶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);
|
||||
|
|
Loading…
Reference in New Issue