residual-attention-network icon indicating copy to clipboard operation
residual-attention-network copied to clipboard

Some bugs on your caffe

Open klauscc opened this issue 7 years ago • 1 comments

Interested in your paper, I find some bugs when I compile your caffe. My environment is Centos 7.5, Cuda 8.0, Cudnn5.1. The following is the fix:

diff --git a/include/caffe/common.cuh b/include/caffe/common.cuh
index 63e7399..4ce4a40 100644
--- a/include/caffe/common.cuh
+++ b/include/caffe/common.cuh
@@ -6,16 +6,20 @@
 #include <cuda.h>
 
 // CUDA: atomicAdd is not defined for doubles
-static __inline__ __device__ double atomicAdd(double *address, double val) {
-  unsigned long long int* address_as_ull = (unsigned long long int*)address;
-  unsigned long long int old = *address_as_ull, assumed;
-  if (val==0.0)
-    return __longlong_as_double(old);
-  do {
-    assumed = old;
-    old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val +__longlong_as_double(assumed)));
-  } while (assumed != old);
-  return __longlong_as_double(old);
-}
+    #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
+
+    #else
+    static __inline__ __device__ double atomicAdd(double *address, double val) {
+      unsigned long long int* address_as_ull = (unsigned long long int*)address;
+      unsigned long long int old = *address_as_ull, assumed;
+      if (val==0.0)
+        return __longlong_as_double(old);
+      do {
+        assumed = old;
+        old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val +__longlong_as_double(assumed)));
+      } while (assumed != old);
+      return __longlong_as_double(old);
+    }
+    #endif
 
 #endif
diff --git a/src/caffe/layers/bn_layer.cpp b/src/caffe/layers/bn_layer.cpp
index 4b6ba1a..b530ac8 100644
--- a/src/caffe/layers/bn_layer.cpp
+++ b/src/caffe/layers/bn_layer.cpp
@@ -318,4 +318,5 @@ namespace caffe {
 #endif
 
   INSTANTIATE_CLASS(BNLayer);
+  REGISTER_LAYER_CLASS(BN);
 }  // namespace caffe
diff --git a/src/caffe/layers/interp.cpp b/src/caffe/layers/interp.cpp
index 02a87cf..d9200e2 100644
--- a/src/caffe/layers/interp.cpp
+++ b/src/caffe/layers/interp.cpp
@@ -108,6 +108,6 @@ STUB_GPU(InterpLayer);
 
 
 INSTANTIATE_CLASS(InterpLayer);
-//REGISTER_LAYER_CLASS(InterpLayer);
+REGISTER_LAYER_CLASS(Interp);
 
 }  // namespace caffe

klauscc avatar Aug 24 '17 01:08 klauscc

Thanks for your reminding. The interp layer register bug has been fixed.

fwang91 avatar Aug 24 '17 05:08 fwang91