singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject [28/60] incubator-singa git commit: SINGA-166 light built-in logging replacing glog
Date Fri, 03 Jun 2016 07:48:33 GMT
SINGA-166 light built-in logging replacing glog

Remove explicit using glog in other files.
TODO let cmake to detect glog and set USE_GLOG option.


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/9bccfb6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/9bccfb6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/9bccfb6e

Branch: refs/heads/dev
Commit: 9bccfb6ed59f93e7d8a121479628ef8bfc8c84a9
Parents: 94633f4
Author: Wei Wang <wangwei@comp.nus.edu.sg>
Authored: Tue May 10 12:23:32 2016 +0800
Committer: Wei Wang <wangwei@comp.nus.edu.sg>
Committed: Tue May 10 12:23:32 2016 +0800

----------------------------------------------------------------------
 CMakeLists.txt                     |  2 +-
 include/singa/core/common.h        |  2 +-
 include/singa/core/math.h          |  2 +-
 include/singa/core/tensor.h        |  2 +-
 include/singa/utils/CMakeLists.txt |  1 -
 include/singa/utils/context.h      |  3 ++-
 include/singa/utils/factory.h      |  6 +++---
 include/singa/utils/logging.h      | 28 ++++++++++++++--------------
 include/singa/utils/tokenizer.h    |  2 +-
 test/CMakeLists.txt                |  2 +-
 10 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 745d833..21b3804 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ INCLUDE_DIRECTORIES(${singa_include_dir} ${PROJECT_BINARY_DIR})
 
 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-SET(singa_linker_lib glog)
+SET(singa_linker_lib)
 LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
 
 INCLUDE(cmake/ProtoBuf.cmake)

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/core/common.h
----------------------------------------------------------------------
diff --git a/include/singa/core/common.h b/include/singa/core/common.h
index 4724fef..1d73f67 100644
--- a/include/singa/core/common.h
+++ b/include/singa/core/common.h
@@ -19,7 +19,7 @@
 #ifndef SINGA_CORE_COMMON_H_
 #define SINGA_CORE_COMMON_H_
 
-#include "glog/logging.h"
+#include "singa/utils/logging.h"
 
 namespace singa {
 namespace lib {

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/core/math.h
----------------------------------------------------------------------
diff --git a/include/singa/core/math.h b/include/singa/core/math.h
index 948dc8f..883abc8 100644
--- a/include/singa/core/math.h
+++ b/include/singa/core/math.h
@@ -17,9 +17,9 @@
  */
 #ifndef SINGA_CORE_MATH_H_
 #define SINGA_CORE_MATH_H_
-#include <glog/logging.h>
 #include <type_traits>
 #include "singa/core/common.h"
+#include "singa/utils/logging.h"
 
 namespace singa {
 

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/core/tensor.h
----------------------------------------------------------------------
diff --git a/include/singa/core/tensor.h b/include/singa/core/tensor.h
index 6401738..c8982ce 100644
--- a/include/singa/core/tensor.h
+++ b/include/singa/core/tensor.h
@@ -19,13 +19,13 @@
 #ifndef SINGA_CORE_TENSOR_H_
 #define SINGA_CORE_TENSOR_H_
 
-#include <glog/logging.h>
 #include <vector>
 
 #include "singa/core/common.h"
 #include "singa/core/device.h"
 #include "singa/core/math.h"
 #include "singa/proto/core.pb.h"
+#include "singa/utils/logging.h"
 
 using std::vector;
 namespace singa {

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/include/singa/utils/CMakeLists.txt b/include/singa/utils/CMakeLists.txt
deleted file mode 100644
index 13b791e..0000000
--- a/include/singa/utils/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-PROJECT(timer)

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/utils/context.h
----------------------------------------------------------------------
diff --git a/include/singa/utils/context.h b/include/singa/utils/context.h
index 55e783d..1d47215 100644
--- a/include/singa/utils/context.h
+++ b/include/singa/utils/context.h
@@ -22,13 +22,14 @@
 #ifndef SINGA_UTILS_CONTEXT_H_
 #define SINGA_UTILS_CONTEXT_H_
 
-#include <glog/logging.h>
 #include <chrono>
 #include <random>
 #include <thread>
 #include <unordered_map>
 #include <vector>
 
+#include "singa/utils/logging.h"
+
 #ifdef USE_GPU
 #include <cublas_v2.h>
 #include <cuda.h>

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/utils/factory.h
----------------------------------------------------------------------
diff --git a/include/singa/utils/factory.h b/include/singa/utils/factory.h
index 3af25f0..de018a6 100644
--- a/include/singa/utils/factory.h
+++ b/include/singa/utils/factory.h
@@ -7,9 +7,9 @@
 * to you 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
@@ -22,11 +22,11 @@
 #ifndef SINGA_UTILS_FACTORY_H_
 #define SINGA_UTILS_FACTORY_H_
 
-#include <glog/logging.h>
 #include <functional>
 #include <map>
 #include <string>
 
+#include "singa/utils/logging.h"
 /**
  * Macro that creats a function which instantiate a subclass instance and
  * returns pointer to the base class.

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/utils/logging.h
----------------------------------------------------------------------
diff --git a/include/singa/utils/logging.h b/include/singa/utils/logging.h
index 5088036..00ac02b 100644
--- a/include/singa/utils/logging.h
+++ b/include/singa/utils/logging.h
@@ -7,9 +7,9 @@
 * to you 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
@@ -19,7 +19,7 @@
 *
 *************************************************************/
 
-// adopted from google::tensorflow::logging
+// adapted from google::tensorflow::logging
 
 #ifndef SINGA_UTILS_LOGGING_H_
 #define SINGA_UTILS_LOGGING_H_
@@ -33,14 +33,14 @@
 
 namespace singa {
 
-// Global functions for both glog and buld-in log
+/// Global functions for both glog and built-in log
 void InitLogging(const char *argv);
-// Make it so that all log messages go only to stderr
+/// Make it so that all log messages go only to stderr
 void LogToStderr();
-// Make it so that all log messages of at least a particular severity are
-// logged to stderr (in addtion to logging to the usual log files)
+/// Make it so that all log messages of at least a particular severity are
+/// logged to stderr (in addtion to logging to the usual log files)
 void SetStderrLogging(int severity);
-// Set the file name for logging (and disable logging to stderr)
+/// Set the file name for logging (and disable logging to stderr)
 void SetLogDestination(int severity, const char* path);
 
 using std::string;
@@ -88,10 +88,10 @@ class LogMessageFatal : public LogMessage {
 
 #define LOG(severity) _SINGA_LOG_##severity
 
-// CHECK dies with a fatal error if condition is not true.  It is *not*
-// controlled by NDEBUG, so the check will be executed regardless of
-// compilation mode.  Therefore, it is safe to do things like:
-//    CHECK(fp->Write(x) == 4)
+/// CHECK dies with a fatal error if condition is not true.  It is *not*
+/// controlled by NDEBUG, so the check will be executed regardless of
+/// compilation mode.  Therefore, it is safe to do things like:
+///    CHECK(fp->Write(x) == 4)
 #define CHECK(condition)              \
   if (!(condition)) \
   LOG(FATAL) << "Check failed: " #condition " "
@@ -215,12 +215,12 @@ SINGA_DEFINE_CHECK_OP_IMPL(Check_GT, > )
 
 // In optimized mode, use CheckOpString to hint to compiler that
 // the while condition is unlikely.
-#define CHECK_OP_LOG(name, op, val1, val2)                       \
+#define CHECK_OP_LOG(name, op, val1, val2)                      \
   while (::singa::logging::CheckOpString _result =              \
              ::singa::logging::name##Impl(                      \
                  ::singa::logging::GetReferenceableValue(val1), \
                  ::singa::logging::GetReferenceableValue(val2), \
-                 #val1 " " #op " " #val2))                       \
+                 #val1 " " #op " " #val2))                      \
   ::singa::logging::LogMessageFatal(__FILE__, __LINE__) << *(_result.str_)
 
 #define CHECK_OP(name, op, val1, val2) CHECK_OP_LOG(name, op, val1, val2)

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/include/singa/utils/tokenizer.h
----------------------------------------------------------------------
diff --git a/include/singa/utils/tokenizer.h b/include/singa/utils/tokenizer.h
index 9637c75..92c24b6 100644
--- a/include/singa/utils/tokenizer.h
+++ b/include/singa/utils/tokenizer.h
@@ -22,8 +22,8 @@
 #ifndef SINGA_UTILS_TOKENIZER_H_
 #define SINGA_UTILS_TOKENIZER_H_
 
-#include <glog/logging.h>
 #include <string>
+#include "singa/utils/logging.h"
 
 namespace singa {
 /**

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/9bccfb6e/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7fcada8..f362968 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -6,5 +6,5 @@ AUX_SOURCE_DIRECTORY(singa singa_test_source)
 ADD_EXECUTABLE(test_singa "gtest/gtest_main.cc" ${singa_test_source})
 ADD_DEPENDENCIES(test_singa singa_core singa_utils)
 MESSAGE(STATUS "link libs" ${singa_linker_libs})
-TARGET_LINK_LIBRARIES(test_singa gtest singa_core singa_utils proto protobuf glog)
+TARGET_LINK_LIBRARIES(test_singa gtest singa_core singa_utils proto protobuf)
 SET_TARGET_PROPERTIES(test_singa PROPERTIES LINK_FLAGS "${LINK_FLAGS} -pthread")


Mime
View raw message