ge executor support windows

pull/497/head
taoxiangdong 4 years ago
parent dca892db8a
commit e377745a59

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

@ -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 {}; mmTimeval tv {};
int ret = gettimeofday(&tv, nullptr); int ret = mmGetTimeOfDay(&tv, nullptr);
GE_LOGE_IF(ret != 0, "Func gettimeofday may failed: ret=%d", ret); 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);
} }

@ -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 $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations>
-O2 $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
-Wno-deprecated-declarations $<$<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

@ -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; mmTimeval tv;
if (gettimeofday(&tv, NULL) == 0) { if (mmGetTimeOfDay(&tv, nullptr) == 0) {
ret = tv.tv_sec * 1000000ULL + tv.tv_usec; ret = tv.tv_sec * 1000000ULL + tv.tv_usec;
} }

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

@ -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:

Loading…
Cancel
Save