You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2020/10/07 03:22:16 UTC
[singa] branch dev updated: fixed glog bug, enable stack trace,
used python faulthandler
This is an automated email from the ASF dual-hosted git repository.
wangwei pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/singa.git
The following commit(s) were added to refs/heads/dev by this push:
new 470a545 fixed glog bug, enable stack trace, used python faulthandler
new 2b9e0de Merge pull request #805 from dcslin/stacktrace-glog
470a545 is described below
commit 470a545069a336d3e14a08c827fb50c89246ad6b
Author: Your Name <yo...@example.com>
AuthorDate: Tue Oct 6 09:40:36 2020 +0000
fixed glog bug, enable stack trace, used python faulthandler
---
cmake/Dependencies.cmake | 2 +-
include/singa/utils/logging.h | 1 +
python/singa/__init__.py | 5 +++++
src/api/core_tensor.i | 4 ++++
src/core/tensor/tensor.cc | 1 -
test/gtest/gtest_main.cc | 2 ++
test/singa/test_logging.cc | 1 -
7 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index a4257a6..60c4327 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -67,7 +67,7 @@ ENDIF()
FIND_PACKAGE(Glog)
IF(GLOG_FOUND)
- #MESSAGE(STATUS "GLOG FOUND at ${GLOG_INCLUDE_DIR}")
+ MESSAGE(STATUS "FOUND GLOG at ${GLOG_INCLUDE_DIR}")
#ADD_DEFINITIONS("-DUSE_GLOG")
SET(USE_GLOG TRUE)
LIST(APPEND SINGA_LINKER_LIBS ${GLOG_LIBRARIES})
diff --git a/include/singa/utils/logging.h b/include/singa/utils/logging.h
index 9b9e643..92ab733 100644
--- a/include/singa/utils/logging.h
+++ b/include/singa/utils/logging.h
@@ -24,6 +24,7 @@
#ifndef SINGA_UTILS_LOGGING_H_
#define SINGA_UTILS_LOGGING_H_
+#include "singa/singa_config.h"
#include <stdlib.h>
#include <sstream>
diff --git a/python/singa/__init__.py b/python/singa/__init__.py
index 039d356..11db05a 100644
--- a/python/singa/__init__.py
+++ b/python/singa/__init__.py
@@ -17,4 +17,9 @@
from . import singa_wrap
+import faulthandler
+faulthandler.enable()
+
+singa_wrap.InitLogging("")
+
__version__ = singa_wrap.SINGA_VERSION
diff --git a/src/api/core_tensor.i b/src/api/core_tensor.i
index 04e75e0..154240a 100755
--- a/src/api/core_tensor.i
+++ b/src/api/core_tensor.i
@@ -34,6 +34,8 @@
#include "singa/proto/core.pb.h"
// #include "singa/proto/model.pb.h"
#include "half.hpp"
+#include "singa/utils/logging.h"
+
using singa::DataType;
%}
%shared_ptr(singa::Device)
@@ -384,4 +386,6 @@ namespace singa{
Tensor CrossEntropyFwd(const Tensor& p, const Tensor& t);
Tensor SoftmaxCrossEntropyBwd(const Tensor& p, const Tensor& t);
+
+ void InitLogging(const char* argv);
}
diff --git a/src/core/tensor/tensor.cc b/src/core/tensor/tensor.cc
index 5355a51..7f4bbec 100644
--- a/src/core/tensor/tensor.cc
+++ b/src/core/tensor/tensor.cc
@@ -16,7 +16,6 @@
* limitations under the License.
*/
#include "singa/core/tensor.h"
-// #include "singa/utils/stacktrace.h"
#include <algorithm>
#include <utility>
diff --git a/test/gtest/gtest_main.cc b/test/gtest/gtest_main.cc
index f302822..22477f3 100644
--- a/test/gtest/gtest_main.cc
+++ b/test/gtest/gtest_main.cc
@@ -30,9 +30,11 @@
#include <stdio.h>
#include "gtest/gtest.h"
+#include "singa/utils/logging.h"
GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from gtest_main.cc\n");
+ singa::InitLogging("");
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/test/singa/test_logging.cc b/test/singa/test_logging.cc
index 16efa8f..71b6d96 100644
--- a/test/singa/test_logging.cc
+++ b/test/singa/test_logging.cc
@@ -23,7 +23,6 @@
#include "singa/utils/logging.h"
TEST(Logging, InfoLogging) {
- singa::InitLogging("");
int a = 3;
CHECK_EQ(a, 3);
LOG(INFO) << "test info logging";