!34233 [MS][LITE][STABLE]print log to console by default

Merge pull request !34233 from chenjianping/master_dev2
This commit is contained in:
i-robot 2022-05-12 11:58:08 +00:00 committed by Gitee
commit 3eee00eb0d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 6 deletions

View File

@ -594,9 +594,8 @@ MS_CORE_API void common_log_init(void) {
}
std::string logtostderr = mindspore::GetEnv("GLOG_logtostderr");
// Default print log to screen
if (logtostderr.empty()) {
FLAGS_logtostderr = true;
} else if (logtostderr == "0") {
FLAGS_logtostderr = true;
if (logtostderr == "0") {
if (mindspore::GetEnv("GLOG_log_dir").empty()) {
#ifndef BUILD_LITE_INFERENCE
MS_LOG(ERROR) << "`GLOG_log_dir` is empty, it must be set while 'logtostderr' equals to 0.";
@ -604,9 +603,9 @@ MS_CORE_API void common_log_init(void) {
exit(EXIT_FAILURE);
#else
MS_LOG(WARNING) << "`GLOG_log_dir` is empty, log will be printed to stderr.";
FLAGS_logtostderr = true;
#endif
} else {
FLAGS_logtostderr = false;
// Set log dir from GLOG_log_dir with RANK_ID or OMPI_COMM_WORLD_RANK.
#ifndef BUILD_LITE_INFERENCE
const std::string rank_id = mindspore::GetEnv("RANK_ID");

View File

@ -31,8 +31,12 @@ NUMAAdapter::NUMAAdapter() {
available_ = false;
handle_ = dlopen("libnuma.so", RTLD_LAZY | RTLD_LOCAL);
if (handle_ == nullptr) {
MS_LOG(WARNING) << "Does not support NUMA.";
return;
MS_LOG(WARNING) << "Open libnuma.so failed!try libnuma.so.1 again.";
handle_ = dlopen("libnuma.so.1", RTLD_LAZY | RTLD_LOCAL);
if (handle_ == nullptr) {
MS_LOG(WARNING) << "Open numa so failed!";
return;
}
}
numa_interfaces_.numa_available = reinterpret_cast<int (*)(void)>(dlsym(handle_, "numa_available"));