forked from huawei/mindspore2022
delete core gvar
Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
parent
e1c2c4c268
commit
b9b2f5bbfd
|
|
@ -3,7 +3,6 @@ include_directories(${CMAKE_BINARY_DIR})
|
|||
include_directories(${CMAKE_SOURCE_DIR}/mindspore/core)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset)
|
||||
add_subdirectory(gvar)
|
||||
|
||||
if("${ENABLE_HIDDEN}" STREQUAL "OFF" AND NOT MSVC)
|
||||
string(REPLACE " -Werror " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
|
@ -48,8 +47,7 @@ endif()
|
|||
set_property(SOURCE ${CORE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_CORE)
|
||||
add_library(core_obj OBJECT ${CORE_SRC_LIST})
|
||||
add_library(core_proto_obj OBJECT ${PROTO_SRCS})
|
||||
add_library(mindspore_core SHARED $<TARGET_OBJECTS:core_obj> $<TARGET_OBJECTS:core_proto_obj>
|
||||
$<TARGET_OBJECTS:mindspore_gvar>)
|
||||
add_library(mindspore_core SHARED $<TARGET_OBJECTS:core_obj> $<TARGET_OBJECTS:core_proto_obj>)
|
||||
target_link_libraries(mindspore_core PRIVATE mindspore::protobuf securec)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
file(GLOB_RECURSE MS_GVAR_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cc)
|
||||
set_property(SOURCE ${MS_GVAR_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_COMMON)
|
||||
add_library(mindspore_gvar OBJECT ${MS_GVAR_SRC_LIST})
|
||||
target_compile_definitions(mindspore_gvar PRIVATE BUILDING_DLL)
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* Copyright 2021 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <string>
|
||||
#include "utils/log_adapter.h"
|
||||
|
||||
namespace mindspore {
|
||||
const std::string GetSubModuleName(SubModuleId module_id) {
|
||||
static const std::vector<std::string> sub_module_names = {
|
||||
"UNKNOWN", // SM_UNKNOWN
|
||||
"CORE", // SM_CORE
|
||||
"ANALYZER", // SM_ANALYZER
|
||||
"COMMON", // SM_COMMON
|
||||
"DEBUG", // SM_DEBUG
|
||||
"OFFLINE_DEBUG", // SM_OFFLINE_DEBUG
|
||||
"DEVICE", // SM_DEVICE
|
||||
"GE_ADPT", // SM_GE_ADPT
|
||||
"IR", // SM_IR
|
||||
"KERNEL", // SM_KERNEL
|
||||
"MD", // SM_MD
|
||||
"ME", // SM_ME
|
||||
"EXPRESS", // SM_EXPRESS
|
||||
"OPTIMIZER", // SM_OPTIMIZER
|
||||
"PARALLEL", // SM_PARALLEL
|
||||
"PARSER", // SM_PARSER
|
||||
"PIPELINE", // SM_PIPELINE
|
||||
"PRE_ACT", // SM_PRE_ACT
|
||||
"PYNATIVE", // SM_PYNATIVE
|
||||
"SESSION", // SM_SESSION
|
||||
"UTILS", // SM_UTILS
|
||||
"VM", // SM_VM
|
||||
"PROFILER", // SM_PROFILER
|
||||
"PS", // SM_PS
|
||||
"FL", // SM_FL
|
||||
"DISTRIBUTED", // SM_DISTRIBUTED
|
||||
"LITE", // SM_LITE
|
||||
"ARMOUR", // SM_ARMOUR
|
||||
"HCCL_ADPT", // SM_HCCL_ADPT
|
||||
"RUNTIME_FRAMEWORK", // SM_RUNTIME_FRAMEWORK
|
||||
"GE", // SM_GE
|
||||
"API", // SM_API
|
||||
};
|
||||
return sub_module_names[(module_id % NUM_SUBMODUES)];
|
||||
}
|
||||
|
||||
// export GetTimeString for all sub modules
|
||||
std::string GetTimeString() {
|
||||
constexpr auto BUFLEN = 80;
|
||||
char buf[BUFLEN];
|
||||
(void)memset(buf, '\0', BUFLEN);
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
time_t time_seconds = time(0);
|
||||
struct tm now_time;
|
||||
localtime_s(&now_time, &time_seconds);
|
||||
(void)snprintf(buf, BUFLEN, "%d-%d-%d %d:%d:%d", now_time.tm_year + 1900, now_time.tm_mon + 1, now_time.tm_mday,
|
||||
now_time.tm_hour, now_time.tm_min, now_time.tm_sec);
|
||||
#else
|
||||
struct timeval cur_time;
|
||||
(void)gettimeofday(&cur_time, nullptr);
|
||||
|
||||
struct tm now;
|
||||
constexpr size_t time_str_len = 19;
|
||||
constexpr int64_t time_convert_unit = 1000;
|
||||
(void)localtime_r(&cur_time.tv_sec, &now);
|
||||
(void)strftime(buf, BUFLEN, "%Y-%m-%d-%H:%M:%S", &now); // format date and time
|
||||
#ifdef __APPLE__
|
||||
const std::string fmt_str = ".%03lld.%03lld";
|
||||
#else
|
||||
const std::string fmt_str = ".%03ld.%03ld";
|
||||
#endif
|
||||
(void)snprintf(buf + time_str_len, BUFLEN - time_str_len, fmt_str.c_str(), cur_time.tv_usec / time_convert_unit,
|
||||
cur_time.tv_usec % time_convert_unit);
|
||||
#endif
|
||||
return std::string(buf);
|
||||
}
|
||||
} // namespace mindspore
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* Copyright 2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "utils/log_adapter.h"
|
||||
|
||||
namespace mindspore {
|
||||
std::map<void **, std::thread *> acl_handle_map;
|
||||
// set default log level to WARNING for all sub modules
|
||||
int g_ms_submodule_log_levels[NUM_SUBMODUES] = {WARNING};
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
enum MsLogLevel this_thread_max_log_level = EXCEPTION;
|
||||
#else
|
||||
thread_local enum MsLogLevel this_thread_max_log_level = EXCEPTION;
|
||||
#endif
|
||||
} // namespace mindspore
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* Copyright 2019-2021 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "base/base.h"
|
||||
// This file is kept to make cmake happy.
|
||||
|
|
@ -26,6 +26,15 @@
|
|||
|
||||
// namespace to support utils module definition
|
||||
namespace mindspore {
|
||||
std::map<void **, std::thread *> acl_handle_map;
|
||||
// set default log level to WARNING for all sub modules
|
||||
int g_ms_submodule_log_levels[NUM_SUBMODUES] = {WARNING};
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
enum MsLogLevel this_thread_max_log_level = EXCEPTION;
|
||||
#else
|
||||
thread_local enum MsLogLevel this_thread_max_log_level = EXCEPTION;
|
||||
#endif
|
||||
|
||||
#ifdef USE_GLOG
|
||||
#define google mindspore_private
|
||||
static std::string GetProcName() {
|
||||
|
|
@ -427,6 +436,75 @@ void InitSubModulesLogLevel() {
|
|||
g_ms_submodule_log_levels[mod_idx] = static_cast<int>(submodule_log_level);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string GetSubModuleName(SubModuleId module_id) {
|
||||
static const std::vector<std::string> sub_module_names = {
|
||||
"UNKNOWN", // SM_UNKNOWN
|
||||
"CORE", // SM_CORE
|
||||
"ANALYZER", // SM_ANALYZER
|
||||
"COMMON", // SM_COMMON
|
||||
"DEBUG", // SM_DEBUG
|
||||
"OFFLINE_DEBUG", // SM_OFFLINE_DEBUG
|
||||
"DEVICE", // SM_DEVICE
|
||||
"GE_ADPT", // SM_GE_ADPT
|
||||
"IR", // SM_IR
|
||||
"KERNEL", // SM_KERNEL
|
||||
"MD", // SM_MD
|
||||
"ME", // SM_ME
|
||||
"EXPRESS", // SM_EXPRESS
|
||||
"OPTIMIZER", // SM_OPTIMIZER
|
||||
"PARALLEL", // SM_PARALLEL
|
||||
"PARSER", // SM_PARSER
|
||||
"PIPELINE", // SM_PIPELINE
|
||||
"PRE_ACT", // SM_PRE_ACT
|
||||
"PYNATIVE", // SM_PYNATIVE
|
||||
"SESSION", // SM_SESSION
|
||||
"UTILS", // SM_UTILS
|
||||
"VM", // SM_VM
|
||||
"PROFILER", // SM_PROFILER
|
||||
"PS", // SM_PS
|
||||
"FL", // SM_FL
|
||||
"DISTRIBUTED", // SM_DISTRIBUTED
|
||||
"LITE", // SM_LITE
|
||||
"ARMOUR", // SM_ARMOUR
|
||||
"HCCL_ADPT", // SM_HCCL_ADPT
|
||||
"RUNTIME_FRAMEWORK", // SM_RUNTIME_FRAMEWORK
|
||||
"GE", // SM_GE
|
||||
"API", // SM_API
|
||||
};
|
||||
return sub_module_names[(module_id % NUM_SUBMODUES)];
|
||||
}
|
||||
|
||||
std::string GetTimeString() {
|
||||
constexpr auto BUFLEN = 80;
|
||||
char buf[BUFLEN];
|
||||
(void)memset(buf, '\0', BUFLEN);
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
time_t time_seconds = time(0);
|
||||
struct tm now_time;
|
||||
localtime_s(&now_time, &time_seconds);
|
||||
constexpr int base_year = 1900;
|
||||
(void)snprintf(buf, BUFLEN, "%d-%d-%d %d:%d:%d", now_time.tm_year + base_year, now_time.tm_mon + 1, now_time.tm_mday,
|
||||
now_time.tm_hour, now_time.tm_min, now_time.tm_sec);
|
||||
#else
|
||||
struct timeval cur_time;
|
||||
(void)gettimeofday(&cur_time, nullptr);
|
||||
|
||||
struct tm now;
|
||||
constexpr size_t time_str_len = 19;
|
||||
constexpr int64_t time_convert_unit = 1000;
|
||||
(void)localtime_r(&cur_time.tv_sec, &now);
|
||||
(void)strftime(buf, BUFLEN, "%Y-%m-%d-%H:%M:%S", &now); // format date and time
|
||||
#ifdef __APPLE__
|
||||
constexpr auto fmt_str = ".%03lld.%03lld";
|
||||
#else
|
||||
constexpr auto fmt_str = ".%03ld.%03ld";
|
||||
#endif
|
||||
(void)snprintf(buf + time_str_len, BUFLEN - time_str_len, fmt_str, cur_time.tv_usec / time_convert_unit,
|
||||
cur_time.tv_usec % time_convert_unit);
|
||||
#endif
|
||||
return std::string(buf);
|
||||
}
|
||||
} // namespace mindspore
|
||||
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -161,9 +161,7 @@ if(MSLITE_ENABLE_RUNTIME_GLOG)
|
|||
string(REPLACE "-fno-rtti" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
if(NOT MSLITE_ENABLE_RUNTIME_CONVERT)
|
||||
set(LITE_SRC ${LITE_SRC}
|
||||
${CORE_DIR}/utils/log_adapter.cc
|
||||
${CORE_DIR}/gvar/logging_level.cc
|
||||
${CORE_DIR}/gvar/log_adapter_common.cc)
|
||||
${CORE_DIR}/utils/log_adapter.cc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ set(REG_SRC ${CONVERT_REG_SRC}
|
|||
${KERNEL_REG_DIR}/../common/utils.cc
|
||||
${KERNEL_REG_DIR}/../delegate/tensorrt/distribution/distribution_base.cc
|
||||
${CORE_DIR}/utils/log_adapter.cc
|
||||
${CORE_DIR}/utils/status.cc
|
||||
${CORE_DIR}/gvar/log_adapter_common.cc
|
||||
${CORE_DIR}/gvar/logging_level.cc)
|
||||
${CORE_DIR}/utils/status.cc)
|
||||
set_property(SOURCE ${REG_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)
|
||||
add_library(mslite_converter_plugin SHARED ${REG_SRC})
|
||||
target_link_libraries(mslite_converter_plugin mindspore::glog)
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ add_dependencies(_ut_mindspore_obj graph)
|
|||
add_dependencies(_ut_ut_obj engine-cache-server graph)
|
||||
set(ut_objects $<TARGET_OBJECTS:_ut_ut_obj> $<TARGET_OBJECTS:_ut_mindspore_obj>
|
||||
$<TARGET_OBJECTS:core_obj> $<TARGET_OBJECTS:core_proto_obj> $<TARGET_OBJECTS:mindrt_mid>
|
||||
$<TARGET_OBJECTS:mindspore_gvar> $<TARGET_OBJECTS:mindspore_shared_lib_obj>)
|
||||
$<TARGET_OBJECTS:mindspore_shared_lib_obj>)
|
||||
if(ENABLE_MINDDATA)
|
||||
set(ut_objects ${ut_objects} ${dataengine_submodules} $<TARGET_OBJECTS:mindrecord_obj>)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in New Issue