From 8819f5953b903ec8b48e541271737e89a2cd24e6 Mon Sep 17 00:00:00 2001 From: Evan Shelhamer Date: Wed, 3 Sep 2014 17:45:14 -0700 Subject: [PATCH] call __signbit for CUDA >= 6.5 implementation --- src/caffe/util/math_functions.cu | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/caffe/util/math_functions.cu b/src/caffe/util/math_functions.cu index 4ae4bba..176da93 100644 --- a/src/caffe/util/math_functions.cu +++ b/src/caffe/util/math_functions.cu @@ -329,7 +329,12 @@ void caffe_gpu_powx(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) { -- 2.7.4