call __signbit for CUDA >= 6.5 implementation
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Thu, 4 Sep 2014 00:45:14 +0000 (17:45 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Sun, 7 Sep 2014 17:25:23 +0000 (19:25 +0200)
src/caffe/util/math_functions.cu

index 4ae4bba..176da93 100644 (file)
@@ -329,7 +329,12 @@ void caffe_gpu_powx<double>(const int N, const double* a,
 
 DEFINE_AND_INSTANTIATE_GPU_UNARY_FUNC(sign, y[index] = (Dtype(0) < x[index])
                                       - (x[index] < Dtype(0)));
+#if CUDA_VERSION >= 6050
+// __signbit to pick up the CUDA function.
+DEFINE_AND_INSTANTIATE_GPU_UNARY_FUNC(sgnbit, y[index] = __signbit(x[index]));
+#else
 DEFINE_AND_INSTANTIATE_GPU_UNARY_FUNC(sgnbit, y[index] = signbit(x[index]));
+#endif
 
 __global__ void popc_kernel(const int n, const float* a,
     const float* b, uint8_t* y) {