Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
cf6a4fe6
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cf6a4fe6
编写于
5月 15, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1155 fix bug of log interface
Merge pull request !1155 from fary86/fix_bug_of_log_interface
上级
cca06106
057dcdba
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
45 addition
and
35 deletion
+45
-35
mindspore/ccsrc/dataset/CMakeLists.txt
mindspore/ccsrc/dataset/CMakeLists.txt
+1
-2
mindspore/ccsrc/device/CMakeLists.txt
mindspore/ccsrc/device/CMakeLists.txt
+2
-1
mindspore/ccsrc/gvar/logging_level.cc
mindspore/ccsrc/gvar/logging_level.cc
+24
-0
mindspore/ccsrc/kernel/CMakeLists.txt
mindspore/ccsrc/kernel/CMakeLists.txt
+2
-1
mindspore/ccsrc/mindrecord/CMakeLists.txt
mindspore/ccsrc/mindrecord/CMakeLists.txt
+1
-1
mindspore/ccsrc/utils/log_adapter.cc
mindspore/ccsrc/utils/log_adapter.cc
+11
-27
mindspore/ccsrc/utils/log_adapter.h
mindspore/ccsrc/utils/log_adapter.h
+4
-3
未找到文件。
mindspore/ccsrc/dataset/CMakeLists.txt
浏览文件 @
cf6a4fe6
...
...
@@ -82,11 +82,10 @@ set_target_properties(_c_dataengine PROPERTIES
######################################################################
################# Link with external libraries ########################
target_link_libraries
(
_c_dataengine PRIVATE mindspore mindspore_gvar
)
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Windows"
)
target_link_libraries
(
_c_dataengine PRIVATE mindspore
)
target_link_libraries
(
_c_dataengine PRIVATE mindspore::pybind11_module
${
PYTHON_LIBRARIES
}
mindspore::protobuf
${
SECUREC_LIBRARY
}
)
else
()
target_link_libraries
(
_c_dataengine PRIVATE mindspore mindspore_gvar
)
target_link_libraries
(
_c_dataengine PRIVATE mindspore::pybind11_module -ldl mindspore::protobuf
${
SECUREC_LIBRARY
}
)
endif
()
target_link_libraries
(
_c_dataengine PUBLIC mindspore::jpeg_turbo mindspore::opencv_core mindspore::opencv_imgcodecs
...
...
mindspore/ccsrc/device/CMakeLists.txt
浏览文件 @
cf6a4fe6
...
...
@@ -47,5 +47,6 @@ if (ENABLE_GPU)
# add_library(_mindspore_device_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif
()
set_property
(
SOURCE
${
DEVICE_SRC_LIST
}
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE
)
set_property
(
SOURCE
${
DEVICE_SRC_LIST
}
${
D_SRC_LIST
}
${
CPU_SRC_LIST
}
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE
)
add_library
(
_mindspore_device_obj OBJECT
${
DEVICE_SRC_LIST
}
${
D_SRC_LIST
}
${
CPU_SRC_LIST
}
)
mindspore/ccsrc/gvar/logging_level.cc
0 → 100644
浏览文件 @
cf6a4fe6
/**
* 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
{
// set default log level to WARNING for all sub modules
int
g_ms_submodule_log_levels
[
NUM_SUBMODUES
]
=
{
WARNING
};
}
// namespace mindspore
mindspore/ccsrc/kernel/CMakeLists.txt
浏览文件 @
cf6a4fe6
...
...
@@ -43,5 +43,6 @@ if (ENABLE_GPU)
# add_library(_mindspore_kernel_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif
()
set_property
(
SOURCE
${
KERNEL_SRC_LIST
}
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_KERNEL
)
set_property
(
SOURCE
${
KERNEL_SRC_LIST
}
${
CPU_SRC_LIST
}
${
GPU_SRC_LIST
}
${
D_SRC_LIST
}
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_KERNEL
)
add_library
(
_mindspore_kernel_obj OBJECT
${
KERNEL_SRC_LIST
}
${
CPU_SRC_LIST
}
${
GPU_SRC_LIST
}
${
D_SRC_LIST
}
)
mindspore/ccsrc/mindrecord/CMakeLists.txt
浏览文件 @
cf6a4fe6
...
...
@@ -28,7 +28,7 @@ set_target_properties(_c_mindrecord PROPERTIES
# add link library
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Windows"
)
target_link_libraries
(
_c_mindrecord PRIVATE mindspore::sqlite mindspore mindspore::protobuf
)
target_link_libraries
(
_c_mindrecord PRIVATE mindspore::sqlite mindspore mindspore
_gvar mindspore
::protobuf
)
else
()
target_link_libraries
(
_c_mindrecord PRIVATE mindspore::sqlite
${
PYTHON_LIB
}
${
SECUREC_LIBRARY
}
mindspore mindspore_gvar mindspore::protobuf
)
endif
()
...
...
mindspore/ccsrc/utils/log_adapter.cc
浏览文件 @
cf6a4fe6
...
...
@@ -241,28 +241,6 @@ static std::string GetEnv(const std::string &envvar) {
return
std
::
string
(
value
);
}
#ifndef USE_GLOG
// set default log warning to WARNING
int
g_mslog_level
=
WARNING
;
static
void
InitMsLogLevel
()
{
int
log_level
=
WARNING
;
// set default log level to WARNING
auto
str_level
=
GetEnv
(
"GLOG_v"
);
if
(
str_level
.
size
()
==
1
)
{
int
ch
=
str_level
.
c_str
()[
0
];
ch
=
ch
-
'0'
;
// substract ASCII code of '0', which is 48
if
(
ch
>=
DEBUG
&&
ch
<=
ERROR
)
{
log_level
=
ch
;
}
}
g_mslog_level
=
log_level
;
}
#endif
// set default log level to WARNING for all sub modules
int
g_ms_submodule_log_levels
[
NUM_SUBMODUES
]
=
{
WARNING
};
enum
LogConfigToken
{
INVALID
,
// indicate invalid token
LEFT_BRACE
,
// '{'
...
...
@@ -449,7 +427,16 @@ static MsLogLevel GetGlobalLogLevel() {
#ifdef USE_GLOG
return
static_cast
<
MsLogLevel
>
(
FLAGS_v
);
#else
return
static_cast
<
MsLogLevel
>
(
g_mslog_level
);
int
log_level
=
WARNING
;
// set default log level to WARNING
auto
str_level
=
GetEnv
(
"GLOG_v"
);
if
(
str_level
.
size
()
==
1
)
{
int
ch
=
str_level
.
c_str
()[
0
];
ch
=
ch
-
'0'
;
// substract ASCII code of '0', which is 48
if
(
ch
>=
DEBUG
&&
ch
<=
ERROR
)
{
log_level
=
ch
;
}
}
return
static_cast
<
MsLogLevel
>
(
log_level
);
#endif
}
...
...
@@ -521,10 +508,7 @@ void mindspore_log_init(void) {
FLAGS_logtostderr
=
true
;
MS_LOG
(
WARNING
)
<<
"`GLOG_log_dir` is not set, output log to screen."
;
}
mindspore
::
InitSubModulesLogLevel
();
#else
mindspore
::
InitMsLogLevel
();
#endif
mindspore
::
InitSubModulesLogLevel
();
}
}
mindspore/ccsrc/utils/log_adapter.h
浏览文件 @
cf6a4fe6
...
...
@@ -125,10 +125,11 @@ enum SubModuleId : int {
#define SUBMODULE_ID mindspore::SubModuleId::SM_ME
#endif
#if
ndef USE_GLOG
extern
int
g_ms
log_level
;
#e
ndif
#if
defined(_WIN32) || defined(_WIN64)
extern
int
g_ms
_submodule_log_levels
[]
__attribute__
((
dllexport
))
;
#e
lse
extern
int
g_ms_submodule_log_levels
[]
__attribute__
((
visibility
(
"default"
)));
#endif
class
LogWriter
{
public:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录