Browse Source

!497 ge executor support windows2

From: @taoxiangdong
Reviewed-by: @youui,@liujunzhu
Signed-off-by: @liujunzhu
tags/v1.1.0
mindspore-ci-bot Gitee 4 years ago
parent
commit
5547fda075
7 changed files with 23 additions and 21 deletions
  1. +5
    -4
      ge/common/CMakeLists.txt
  2. +3
    -3
      ge/common/util.cc
  3. +5
    -3
      ge/executor/CMakeLists.txt
  4. +2
    -3
      ge/graph/load/new_model_manager/data_dumper.cc
  5. +4
    -4
      ge/graph/load/new_model_manager/model_manager.cc
  6. +3
    -3
      ge/graph/load/new_model_manager/model_manager.h
  7. +1
    -1
      metadef

+ 5
- 4
ge/common/CMakeLists.txt View File

@@ -127,13 +127,14 @@ target_compile_definitions(ge_common_static PRIVATE
FMK_SUPPORT_DUMP FMK_SUPPORT_DUMP
OS_CENTOS OS_CENTOS
google=ascend_private google=ascend_private
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
) )


target_compile_options(ge_common_static PRIVATE target_compile_options(ge_common_static PRIVATE
-fvisibility=hidden
-O2
-Werror
-Wno-deprecated-declarations
$<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
) )


target_include_directories(ge_common_static PRIVATE target_include_directories(ge_common_static PRIVATE


+ 3
- 3
ge/common/util.cc View File

@@ -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() { 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 auto total_use_time = tv.tv_sec; // seconds
return static_cast<uint32_t>(total_use_time); return static_cast<uint32_t>(total_use_time);
} }


+ 5
- 3
ge/executor/CMakeLists.txt View File

@@ -79,15 +79,17 @@ set(SRC_LIST
add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_HDRS}) add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_HDRS})


target_compile_options(ge_executor PRIVATE target_compile_options(ge_executor PRIVATE
-Werror
-O2
-Wno-deprecated-declarations
$<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
) )


target_compile_definitions(ge_executor PRIVATE target_compile_definitions(ge_executor PRIVATE
PROTOBUF_INLINE_NOT_IN_HEADERS=0 PROTOBUF_INLINE_NOT_IN_HEADERS=0
DAVINCI_SUPPORT_PROFILING DAVINCI_SUPPORT_PROFILING
google=ascend_private google=ascend_private
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
) )


target_include_directories(ge_executor PRIVATE target_include_directories(ge_executor PRIVATE


+ 2
- 3
ge/graph/load/new_model_manager/data_dumper.cc View File

@@ -16,7 +16,6 @@


#include "graph/load/new_model_manager/data_dumper.h" #include "graph/load/new_model_manager/data_dumper.h"


#include <sys/time.h>
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
#include <map> #include <map>
@@ -76,8 +75,8 @@ static bool IsTensorDescWithSkipDumpAddrType(bool has_mem_type_attr, vector<int6


static uint64_t GetNowTime() { static uint64_t GetNowTime() {
uint64_t ret = 0; uint64_t ret = 0;
struct timeval tv;
if (gettimeofday(&tv, NULL) == 0) {
mmTimeval tv;
if (mmGetTimeOfDay(&tv, nullptr) == 0) {
ret = tv.tv_sec * 1000000ULL + tv.tv_usec; ret = tv.tv_sec * 1000000ULL + tv.tv_usec;
} }




+ 4
- 4
ge/graph/load/new_model_manager/model_manager.cc View File

@@ -1325,9 +1325,9 @@ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) {
so_name.size(), RT_MEMCPY_HOST_TO_DEVICE)); so_name.size(), RT_MEMCPY_HOST_TO_DEVICE));


CustAicpuSoBuf cust_aicpu_so_buf; CustAicpuSoBuf cust_aicpu_so_buf;
cust_aicpu_so_buf.kernelSoBuf = reinterpret_cast<uint64_t>(reinterpret_cast<uintptr_t>(d_aicpu_data));
cust_aicpu_so_buf.kernelSoBuf = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(d_aicpu_data));
cust_aicpu_so_buf.kernelSoBufLen = aicpu_data_length; cust_aicpu_so_buf.kernelSoBufLen = aicpu_data_length;
cust_aicpu_so_buf.kernelSoName = reinterpret_cast<uint64_t>(reinterpret_cast<uintptr_t>(d_so_name));
cust_aicpu_so_buf.kernelSoName = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(d_so_name));
cust_aicpu_so_buf.kernelSoNameLen = so_name.size(); cust_aicpu_so_buf.kernelSoNameLen = so_name.size();
v_cust_so.push_back(cust_aicpu_so_buf); v_cust_so.push_back(cust_aicpu_so_buf);
} }
@@ -1346,7 +1346,7 @@ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) {


BatchLoadOpFromBufArgs batch_cust_so; BatchLoadOpFromBufArgs batch_cust_so;
batch_cust_so.soNum = v_cust_so.size(); batch_cust_so.soNum = v_cust_so.size();
batch_cust_so.args = reinterpret_cast<uint64_t>(reinterpret_cast<uintptr_t>(args));
batch_cust_so.args = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args));


void *batch_args = nullptr; void *batch_args = nullptr;
uint32_t batch_args_size = sizeof(BatchLoadOpFromBufArgs); uint32_t batch_args_size = sizeof(BatchLoadOpFromBufArgs);
@@ -1501,7 +1501,7 @@ Status ModelManager::EnableExceptionDump(const std::map<string, string> &options
if (iter != options.end()) { if (iter != options.end()) {
GELOGI("Find option enable_exeception_dump is %s", iter->second.c_str()); GELOGI("Find option enable_exeception_dump is %s", iter->second.c_str());
if (iter->second == "1") { if (iter->second == "1") {
rtError_t rt_ret = rtSetTaskFailCallback(ExceptionCallback);
rtError_t rt_ret = rtSetTaskFailCallback(reinterpret_cast<rtTaskFailCallback>(ExceptionCallback));
if (rt_ret != RT_ERROR_NONE) { if (rt_ret != RT_ERROR_NONE) {
GELOGE(RT_FAILED, "rtSetTaskFailCallback failed"); GELOGE(RT_FAILED, "rtSetTaskFailCallback failed");
return RT_ERROR_TO_GE_STATUS(rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret);


+ 3
- 3
ge/graph/load/new_model_manager/model_manager.h View File

@@ -308,16 +308,16 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager {


const std::vector<rtExceptionInfo> &GetExceptionInfos() { return exception_infos_; } const std::vector<rtExceptionInfo> &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<std::mutex> lock(exeception_infos_mutex_); std::lock_guard<std::mutex> lock(exeception_infos_mutex_);
auto instance = ModelManager::GetInstance(); auto instance = ModelManager::GetInstance();
if (instance == nullptr) { if (instance == nullptr) {
GELOGE(FAILED, "Instance is nullptr"); GELOGE(FAILED, "Instance is nullptr");
return; return;
} }
instance->AddExceptionInfo(*exception_info);
instance->AddExceptionInfo(*rt_exception_info);
} }


private: private:


+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit cb50fa2c2141bc5bc679bc47949ed8247850406e
Subproject commit 4176fab0cb2fd4f8794061916878983afb75c8da

Loading…
Cancel
Save