converted to glog
authorYangqing Jia <jiayq84@gmail.com>
Fri, 13 Sep 2013 04:46:19 +0000 (21:46 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Fri, 13 Sep 2013 04:46:19 +0000 (21:46 -0700)
src/Makefile
src/caffeine/common.hpp

index ab1a456..a8fa54d 100644 (file)
@@ -25,7 +25,7 @@ CUDA_LIB_DIR = $(CUDA_DIR)/lib64
 
 INCLUDE_DIRS := . $(CUDA_INCLUDE_DIR)
 LIBRARY_DIRS := . $(CUDA_LIB_DIR)
-LIBRARIES := cuda cudart cublas protobuf
+LIBRARIES := cuda cudart cublas protobuf glog
 WARNINGS := -Wall
 
 CXXFLAGS += -fPIC $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
index 2991011..f309d89 100644 (file)
@@ -4,6 +4,7 @@
 #include <iostream>
 
 #include <boost/shared_ptr.hpp>
+#include <glog/logging.h>
 
 #include "driver_types.h"
 
@@ -13,43 +14,7 @@ namespace caffeine {
 
 static std::ostream nullout(0);
 
-// TODO(Yangqing): make a better logging scheme
-#define LOG_IF(condition) \
-    !(condition) ? nullout : std::cout
-
-#define CHECK(condition) \
-    LOG_IF(condition) << "Check failed: " #condition " "
-
-#ifndef NDEBUG
-
-#define DCHECK(condition) CHECK(condition)
-
-#else
-
-#define DCHECK(condition)
-
-#endif  // NDEBUG
-
-
 #define CUDA_CHECK(condition) \
-    CUDA_LOG_IF(condition) << "Check failed: " #condition " "
-
-
-// TODO(Yangqing): make a better logging scheme
-#define CUDA_LOG_IF(condition) \
-    ((condition) == cudaSuccess) ? nullout : std::cout
-
-#define CUDA_CHECK(condition) \
-    CUDA_LOG_IF(condition) << "Check failed: " #condition " "
-
-#ifndef NDEBUG
-
-#define CUDA_DCHECK(condition) CUDA_CHECK(condition)
-
-#else
-
-#define CUDA_DCHECK(condition)
-
-#endif  // NDEBUG
+    CHECK((condition) == cudaSuccess)
 
 #endif  // CAFFEINE_COMMON_HPP_