Skip to content

Commit

Permalink
fixed glog bug, enable stack trace, used python faulthandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 6, 2020
1 parent 554507a commit 470a545
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions include/singa/utils/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifndef SINGA_UTILS_LOGGING_H_
#define SINGA_UTILS_LOGGING_H_

#include "singa/singa_config.h"
#include <stdlib.h>

#include <sstream>
Expand Down
5 changes: 5 additions & 0 deletions python/singa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@

from . import singa_wrap

import faulthandler
faulthandler.enable()

singa_wrap.InitLogging("")

__version__ = singa_wrap.SINGA_VERSION
4 changes: 4 additions & 0 deletions src/api/core_tensor.i
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
1 change: 0 additions & 1 deletion src/core/tensor/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* limitations under the License.
*/
#include "singa/core/tensor.h"
// #include "singa/utils/stacktrace.h"
#include <algorithm>
#include <utility>

Expand Down
2 changes: 2 additions & 0 deletions test/gtest/gtest_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
1 change: 0 additions & 1 deletion test/singa/test_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 470a545

Please sign in to comment.