From e377745a593a5367dd981df6ff1926eb97416815 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Wed, 2 Dec 2020 20:40:54 +0800 Subject: [PATCH] ge executor support windows --- ge/common/CMakeLists.txt | 9 +++++---- ge/common/util.cc | 6 +++--- ge/executor/CMakeLists.txt | 8 +++++--- ge/graph/load/new_model_manager/data_dumper.cc | 5 ++--- ge/graph/load/new_model_manager/model_manager.cc | 8 ++++---- ge/graph/load/new_model_manager/model_manager.h | 6 +++--- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 9c588396..aa546c0d 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -127,13 +127,14 @@ target_compile_definitions(ge_common_static PRIVATE FMK_SUPPORT_DUMP OS_CENTOS google=ascend_private + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> ) target_compile_options(ge_common_static PRIVATE - -fvisibility=hidden - -O2 - -Werror - -Wno-deprecated-declarations + $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations> + $<$,$>:/MTd> + $<$,$>:/MT> ) target_include_directories(ge_common_static PRIVATE diff --git a/ge/common/util.cc b/ge/common/util.cc index 3c5954db..480be3c1 100644 --- a/ge/common/util.cc +++ b/ge/common/util.cc @@ -315,9 +315,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() } FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimestap() { - struct timeval tv {}; - int ret = gettimeofday(&tv, nullptr); - GE_LOGE_IF(ret != 0, "Func gettimeofday may failed: ret=%d", ret); + mmTimeval tv {}; + int ret = mmGetTimeOfDay(&tv, nullptr); + GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d", ret); auto total_use_time = tv.tv_sec; // seconds return static_cast(total_use_time); } diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index c33d0f79..de8025f3 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -79,15 +79,17 @@ set(SRC_LIST add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(ge_executor PRIVATE - -Werror - -O2 - -Wno-deprecated-declarations + $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations> + $<$,$>:/MTd> + $<$,$>:/MT> ) target_compile_definitions(ge_executor PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 DAVINCI_SUPPORT_PROFILING google=ascend_private + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> ) target_include_directories(ge_executor PRIVATE diff --git a/ge/graph/load/new_model_manager/data_dumper.cc b/ge/graph/load/new_model_manager/data_dumper.cc index b4b31941..4534fe73 100644 --- a/ge/graph/load/new_model_manager/data_dumper.cc +++ b/ge/graph/load/new_model_manager/data_dumper.cc @@ -16,7 +16,6 @@ #include "graph/load/new_model_manager/data_dumper.h" -#include #include #include #include @@ -76,8 +75,8 @@ static bool IsTensorDescWithSkipDumpAddrType(bool has_mem_type_attr, vector(reinterpret_cast(d_aicpu_data)); + cust_aicpu_so_buf.kernelSoBuf = static_cast(reinterpret_cast(d_aicpu_data)); cust_aicpu_so_buf.kernelSoBufLen = aicpu_data_length; - cust_aicpu_so_buf.kernelSoName = reinterpret_cast(reinterpret_cast(d_so_name)); + cust_aicpu_so_buf.kernelSoName = static_cast(reinterpret_cast(d_so_name)); cust_aicpu_so_buf.kernelSoNameLen = so_name.size(); v_cust_so.push_back(cust_aicpu_so_buf); } @@ -1346,7 +1346,7 @@ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) { BatchLoadOpFromBufArgs batch_cust_so; batch_cust_so.soNum = v_cust_so.size(); - batch_cust_so.args = reinterpret_cast(reinterpret_cast(args)); + batch_cust_so.args = static_cast(reinterpret_cast(args)); void *batch_args = nullptr; uint32_t batch_args_size = sizeof(BatchLoadOpFromBufArgs); @@ -1501,7 +1501,7 @@ Status ModelManager::EnableExceptionDump(const std::map &options if (iter != options.end()) { GELOGI("Find option enable_exeception_dump is %s", iter->second.c_str()); if (iter->second == "1") { - rtError_t rt_ret = rtSetTaskFailCallback(ExceptionCallback); + rtError_t rt_ret = rtSetTaskFailCallback(reinterpret_cast(ExceptionCallback)); if (rt_ret != RT_ERROR_NONE) { GELOGE(RT_FAILED, "rtSetTaskFailCallback failed"); return RT_ERROR_TO_GE_STATUS(rt_ret); diff --git a/ge/graph/load/new_model_manager/model_manager.h b/ge/graph/load/new_model_manager/model_manager.h index b2bb4564..9821a4ab 100755 --- a/ge/graph/load/new_model_manager/model_manager.h +++ b/ge/graph/load/new_model_manager/model_manager.h @@ -308,16 +308,16 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager { const std::vector &GetExceptionInfos() { return exception_infos_; } - void AddExceptionInfo(const rtExceptionInfo &exception_info) { exception_infos_.emplace_back(exception_info); } + void AddExceptionInfo(const rtExceptionInfo &rt_exception_info) { exception_infos_.emplace_back(rt_exception_info); } - static void ExceptionCallback(rtExceptionInfo *exception_info) { + static void ExceptionCallback(rtExceptionInfo *rt_exception_info) { std::lock_guard lock(exeception_infos_mutex_); auto instance = ModelManager::GetInstance(); if (instance == nullptr) { GELOGE(FAILED, "Instance is nullptr"); return; } - instance->AddExceptionInfo(*exception_info); + instance->AddExceptionInfo(*rt_exception_info); } private: