Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bugs on your caffe #2

Open
klauscc opened this issue Aug 24, 2017 · 1 comment
Open

Some bugs on your caffe #2

klauscc opened this issue Aug 24, 2017 · 1 comment

Comments

@klauscc
Copy link

klauscc commented Aug 24, 2017

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

@fwang91
Copy link
Owner

fwang91 commented Aug 24, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants