2 errors detected in the compilation of "/tmp/tmpxft_000027fb_00000000-12_math_functions.compute_35.cpp1.ii".
When I execute the command $ make all, I receive a error message Help me, thank you!
/usr/local/cuda/bin/nvcc -ccbin=/usr/bin/g++ -Xcompiler -fPIC -DNDEBUG -O2 -DUSE_MKL -I/usr/local/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -Ibuild/src -I./src -I./include -I/usr/local/cuda/include -I/opt/intel/mkl/include -gencode arch=compute_20,code=sm_20 -gencode arch=compute_20,code=sm_21 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -c src/caffe/util/math_functions.cu -o build/src/caffe/util/math_functions.cuo
src/caffe/util/math_functions.cu(140): error: calling a host function("std::signbit
src/caffe/util/math_functions.cu(140): error: calling a host function("std::signbit
2 errors detected in the compilation of "/tmp/tmpxft_000027fb_00000000-12_math_functions.compute_35.cpp1.ii". make: *** [build/src/caffe/util/math_functions.cuo] Error 2
Seems that math_functions.cu is calling cuda's signbit instead of std::signbit, so maybe you are compiling a version different from the current master or dev head?
thank you! I fixed the problem with your help. But I have been download the current master version, maybe it is a little bug.
Glad it works :) I wasn't reading the code carefully enough apparently. Closing this one and will address the pull request separately.
You can add macro judgment before atomicAdd.Open the file ./include/caffe/common.cuh and change it to
// Copyright 2014 George Papandreou
#ifndef CAFFE_COMMON_CUH_
#define CAFFE_COMMON_CUH_
#include <cuda.h>
// CUDA: atomicAdd is not defined for doubles
#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