Browse Source

ge executor support windows

tags/v1.1.0
taoxiangdong 3 years ago
parent
commit
e377745a59
6 changed files with 22 additions and 20 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

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

@@ -127,13 +127,14 @@ target_compile_definitions(ge_common_static PRIVATE
FMK_SUPPORT_DUMP
OS_CENTOS
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
-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


+ 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() {
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<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})

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
PROTOBUF_INLINE_NOT_IN_HEADERS=0
DAVINCI_SUPPORT_PROFILING
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


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

static uint64_t GetNowTime() {
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;
}



+ 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));

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.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();
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<uint64_t>(reinterpret_cast<uintptr_t>(args));
batch_cust_so.args = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args));

void *batch_args = nullptr;
uint32_t batch_args_size = sizeof(BatchLoadOpFromBufArgs);
@@ -1501,7 +1501,7 @@ Status ModelManager::EnableExceptionDump(const std::map<string, string> &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<rtTaskFailCallback>(ExceptionCallback));
if (rt_ret != RT_ERROR_NONE) {
GELOGE(RT_FAILED, "rtSetTaskFailCallback failed");
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_; }

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_);
auto instance = ModelManager::GetInstance();
if (instance == nullptr) {
GELOGE(FAILED, "Instance is nullptr");
return;
}
instance->AddExceptionInfo(*exception_info);
instance->AddExceptionInfo(*rt_exception_info);
}

private:


Loading…
Cancel
Save