ChenYingpeng / caffe-yolov3

A real-time object detection framework of Yolov3/v4 based on caffe
473 stars 231 forks source link

Caffe compilation error after addition of upsample_layer as per instructions #27

Closed aPonza closed 5 years ago

aPonza commented 5 years ago

I have this compilation error while recompiling caffe after installing the upsample layer. It's seemingly due to me not having CUDA installed, so I'll try to do that now, since:

#ifndef CPU_ONLY  // GPU
#ifdef USE_CUDA

and I'm defining USE_CUDA=OFF at the CMake level (instructions taken from here).

Could somebody help me with this? Would it be possible to keep the upsample layer in CPU mode? Is it mandatory to keep it to convert YOLOv3 to caffemodel?

/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: At global scope:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:9:1: error: ‘__device__’ does not name a type; did you mean ‘device’?
 __device__ int translate_idx(int ii, int d1, int d2, int d3, int scale_factor) {
 ^~~~~~~~~~
 device
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:25:1: error: ‘__device__’ does not name a type; did you mean ‘device’?
 __device__ int translate_idx_inv(
 ^~~~~~~~~~
 device
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:43:1: error: ‘__global__’ does not name a type; did you mean ‘__locale_t’?
 __global__ void upscale(const Dtype *input, Dtype *output,
 ^~~~~~~~~~
 __locale_t
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:52:1: error: ‘__global__’ does not name a type; did you mean ‘__locale_t’?
 __global__ void downscale(Dtype *gradInput_data, const Dtype *gradOutput_data,
 ^~~~~~~~~~
 __locale_t
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In member function ‘virtual void caffe::UpsampleLayer<Dtype>::Forward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&)’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:78:3: error: ‘upscale’ was not declared in this scope
   upscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:78:3: note: suggested alternative: ‘scale_’
   upscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~
   scale_
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:78:16: error: expected primary-expression before ‘>’ token
   upscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
                ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:7: error: expected primary-expression before ‘<<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
       ^~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:9: error: expected primary-expression before ‘<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
         ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:10: error: there are no arguments to ‘CAFFE_GET_BLOCKS’ that depend on a template parameter, so a declaration of ‘CAFFE_GET_BLOCKS’ must be available [-fpermissive]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ^~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:10: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:41: error: ‘CAFFE_CUDA_NUM_THREADS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                         ^~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:65: error: expected primary-expression before ‘>’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                 ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In member function ‘virtual void caffe::UpsampleLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&)’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:94:3: error: ‘downscale’ was not declared in this scope
   downscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:94:3: note: suggested alternative: ‘dscal’
   downscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~~~
   dscal
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:94:18: error: expected primary-expression before ‘>’ token
   downscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
                  ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:7: error: expected primary-expression before ‘<<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
       ^~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:9: error: expected primary-expression before ‘<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
         ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:10: error: there are no arguments to ‘CAFFE_GET_BLOCKS’ that depend on a template parameter, so a declaration of ‘CAFFE_GET_BLOCKS’ must be available [-fpermissive]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ^~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:41: error: ‘CAFFE_CUDA_NUM_THREADS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                         ^~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:65: error: expected primary-expression before ‘>’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                 ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Forward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = half_float::half]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION

The full log from compilation is this one, just in case some context is needed:

~/code/clCaffe/build$ make -j8
[  1%] Built target proto
[  1%] Built target pretune_convert
[  2%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/upsample_layer.cu.o
In file included from /opt/intel/opencl/OpenCL-Headers/CL/cl.h:32:0,
                 from /home/ap/code/clCaffe/include/caffe/greentea/greentea.hpp:30,
                 from /home/ap/code/clCaffe/include/caffe/common.hpp:25,
                 from /home/ap/code/clCaffe/include/caffe/blob.hpp:8,
                 from /home/ap/code/clCaffe/include/caffe/filler.hpp:10,
                 from /home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:3:
/opt/intel/opencl/OpenCL-Headers/CL/cl_version.h:34:104: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
 #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
                                                                                                        ^
In file included from /home/ap/local/include/viennacl/ocl/backend.hpp:26:0,
                 from /home/ap/local/include/viennacl/backend/opencl.hpp:28,
                 from /home/ap/code/clCaffe/include/caffe/greentea/greentea.hpp:35,
                 from /home/ap/code/clCaffe/include/caffe/common.hpp:25,
                 from /home/ap/code/clCaffe/include/caffe/blob.hpp:8,
                 from /home/ap/code/clCaffe/include/caffe/filler.hpp:10,
                 from /home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:3:
/home/ap/local/include/viennacl/ocl/context.hpp: In member function ‘void viennacl::ocl::context::add_queue(cl_device_id)’:
/home/ap/local/include/viennacl/ocl/context.hpp:260:117: warning: ‘_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int*)’ is deprecated [-Wdeprecated-declarations]
     viennacl::ocl::handle<cl_command_queue> temp(clCreateCommandQueue(h_.get(), dev, CL_QUEUE_PROFILING_ENABLE, &err), *this);
                                                                                                                     ^
In file included from /home/ap/code/clCaffe/include/caffe/greentea/greentea.hpp:30:0,
                 from /home/ap/code/clCaffe/include/caffe/common.hpp:25,
                 from /home/ap/code/clCaffe/include/caffe/blob.hpp:8,
                 from /home/ap/code/clCaffe/include/caffe/filler.hpp:10,
                 from /home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:3:
/opt/intel/opencl/OpenCL-Headers/CL/cl.h:1777:1: note: declared here
 clCreateCommandQueue(cl_context                     context,
 ^~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: At global scope:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:9:1: error: ‘__device__’ does not name a type; did you mean ‘device’?
 __device__ int translate_idx(int ii, int d1, int d2, int d3, int scale_factor) {
 ^~~~~~~~~~
 device
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:25:1: error: ‘__device__’ does not name a type; did you mean ‘device’?
 __device__ int translate_idx_inv(
 ^~~~~~~~~~
 device
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:43:1: error: ‘__global__’ does not name a type; did you mean ‘__locale_t’?
 __global__ void upscale(const Dtype *input, Dtype *output,
 ^~~~~~~~~~
 __locale_t
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:52:1: error: ‘__global__’ does not name a type; did you mean ‘__locale_t’?
 __global__ void downscale(Dtype *gradInput_data, const Dtype *gradOutput_data,
 ^~~~~~~~~~
 __locale_t
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In member function ‘virtual void caffe::UpsampleLayer<Dtype>::Forward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&)’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:78:3: error: ‘upscale’ was not declared in this scope
   upscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:78:3: note: suggested alternative: ‘scale_’
   upscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~
   scale_
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:78:16: error: expected primary-expression before ‘>’ token
   upscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
                ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:7: error: expected primary-expression before ‘<<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
       ^~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:9: error: expected primary-expression before ‘<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
         ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:10: error: there are no arguments to ‘CAFFE_GET_BLOCKS’ that depend on a template parameter, so a declaration of ‘CAFFE_GET_BLOCKS’ must be available [-fpermissive]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ^~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:10: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:41: error: ‘CAFFE_CUDA_NUM_THREADS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                         ^~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:65: error: expected primary-expression before ‘>’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                 ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In member function ‘virtual void caffe::UpsampleLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&)’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:94:3: error: ‘downscale’ was not declared in this scope
   downscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:94:3: note: suggested alternative: ‘dscal’
   downscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
   ^~~~~~~~~
   dscal
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:94:18: error: expected primary-expression before ‘>’ token
   downscale<Dtype>  // NOLINT_NEXT_LINE(whitespace/operators)
                  ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:7: error: expected primary-expression before ‘<<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
       ^~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:9: error: expected primary-expression before ‘<’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
         ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:10: error: there are no arguments to ‘CAFFE_GET_BLOCKS’ that depend on a template parameter, so a declaration of ‘CAFFE_GET_BLOCKS’ must be available [-fpermissive]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ^~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:41: error: ‘CAFFE_CUDA_NUM_THREADS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                         ^~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:65: error: expected primary-expression before ‘>’ token
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                 ^
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Forward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = half_float::half]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:46: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:48: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
                                                ^~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:58: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:62: warning: right operand of comma operator has no effect [-Wunused-value]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                  ~
       bottom[0]->gpu_data(),
       ~~~~~~~~~~~~~~~~~~~~~~                                  
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Forward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:46: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:48: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
                                                ^~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:58: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:62: warning: right operand of comma operator has no effect [-Wunused-value]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                  ~
       bottom[0]->gpu_data(),
       ~~~~~~~~~~~~~~~~~~~~~~                                  
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Forward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = double]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:79:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:46: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:48: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
                                                ^~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:58: warning: right operand of comma operator has no effect [-Wunused-value]
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:81:62: warning: right operand of comma operator has no effect [-Wunused-value]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                  ~
       bottom[0]->gpu_data(),
       ~~~~~~~~~~~~~~~~~~~~~~                                  
       top[0]->mutable_gpu_data(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = half_float::half]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:93:16: error: ‘caffe_gpu_set’ was not declared in this scope
   caffe_gpu_set(bottom[0]->count(), Dtype(0), bottom_diff);
   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:18: warning: left operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:51: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:53: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
                                                     ^~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:63: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:67: warning: right operand of comma operator has no effect [-Wunused-value]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                  ~ 
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:93:16: error: ‘caffe_gpu_set’ was not declared in this scope
   caffe_gpu_set(bottom[0]->count(), Dtype(0), bottom_diff);
   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:18: warning: left operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:51: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:53: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
                                                     ^~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:63: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:67: warning: right operand of comma operator has no effect [-Wunused-value]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                  ~ 
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu: In instantiation of ‘void caffe::UpsampleLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = double]’:
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:99:1:   required from here
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:93:16: error: ‘caffe_gpu_set’ was not declared in this scope
   caffe_gpu_set(bottom[0]->count(), Dtype(0), bottom_diff);
   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:26: error: ‘CAFFE_GET_BLOCKS’ was not declared in this scope
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:95:26: note: suggested alternative: ‘CAFFE_VERSION’
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
          CAFFE_VERSION
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:18: warning: left operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:51: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:53: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
                                                     ^~~~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:63: warning: right operand of comma operator has no effect [-Wunused-value]
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/ap/code/clCaffe/src/caffe/layers/upsample_layer.cu:96:67: warning: right operand of comma operator has no effect [-Wunused-value]
       <<<CAFFE_GET_BLOCKS(no_elements), CAFFE_CUDA_NUM_THREADS>>>(
                                                                  ~ 
       bottom_diff, top[0]->gpu_diff(), no_elements, scale_, d1, d2, d3);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
src/caffe/CMakeFiles/caffe.dir/build.make:2802: recipe for target 'src/caffe/CMakeFiles/caffe.dir/layers/upsample_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/layers/upsample_layer.cu.o] Error 1
CMakeFiles/Makefile2:281: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
aPonza commented 5 years ago

By adding some #ifdef guards to the .cu file I managed to get the code to compile (the small patch can be found in the issue referenced right up here) but I'm now facing a linker error, which doesn't really seem to stem from the modification made with the addition of the upsample layer, but I'll double check tomorrow.

For completeness, here's the linker error:

~/code/clCaffe/build$ make -j8
[  1%] Built target proto
[  1%] Built target pretune_convert
[ 80%] Built target caffe
[ 80%] Linking CXX executable caffe
[ 80%] Linking CXX executable get_image_size
[ 80%] Linking CXX executable upgrade_solver_proto_text
[ 81%] Linking CXX executable convert_annoset
[ 82%] Built target device_query
[ 82%] Built target train_net
[ 84%] Built target test_net
[ 85%] Built target net_speed_benchmark
[ 86%] Linking CXX executable convert_imageset
[ 86%] Linking CXX executable upgrade_net_proto_binary
[ 86%] Linking CXX executable compute_image_mean
[ 86%] Linking CXX executable caffe-fp16.bin
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/get_image_size.dir/build.make:128: recipe for target 'tools/get_image_size' failed
make[2]: *** [tools/get_image_size] Error 1
CMakeFiles/Makefile2:697: recipe for target 'tools/CMakeFiles/get_image_size.dir/all' failed
make[1]: *** [tools/CMakeFiles/get_image_size.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_annoset.dir/build.make:128: recipe for target 'tools/convert_annoset' failed
make[2]: *** [tools/convert_annoset] Error 1
CMakeFiles/Makefile2:773: recipe for target 'tools/CMakeFiles/convert_annoset.dir/all' failed
make[1]: *** [tools/CMakeFiles/convert_annoset.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_binary.dir/build.make:128: recipe for target 'tools/upgrade_net_proto_binary' failed
make[2]: *** [tools/upgrade_net_proto_binary] Error 1
CMakeFiles/Makefile2:811: recipe for target 'tools/CMakeFiles/upgrade_net_proto_binary.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_binary.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe.bin.dir/build.make:128: recipe for target 'tools/caffe' failed
make[2]: *** [tools/caffe] Error 1
CMakeFiles/Makefile2:621: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[1]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:128: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:507: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/compute_image_mean.dir/build.make:128: recipe for target 'tools/compute_image_mean' failed
make[2]: *** [tools/compute_image_mean] Error 1
CMakeFiles/Makefile2:925: recipe for target 'tools/CMakeFiles/compute_image_mean.dir/all' failed
make[1]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_imageset.dir/build.make:128: recipe for target 'tools/convert_imageset' failed
make[2]: *** [tools/convert_imageset] Error 1
CMakeFiles/Makefile2:849: recipe for target 'tools/CMakeFiles/convert_imageset.dir/all' failed
make[1]: *** [tools/CMakeFiles/convert_imageset.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
../lib/libcaffe.so.1.0.0-rc5: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe-fp16.bin.dir/build.make:128: recipe for target 'tools/caffe-fp16.bin' failed
make[2]: *** [tools/caffe-fp16.bin] Error 1
CMakeFiles/Makefile2:887: recipe for target 'tools/CMakeFiles/caffe-fp16.bin.dir/all' failed
make[1]: *** [tools/CMakeFiles/caffe-fp16.bin.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
aPonza commented 5 years ago

Didn't think about it yesterday but this is due to me having switched back to gcc-7. Compiling with gcc-5 solves the linker problem.

I'll have to look into the greentea counterpart of the cuda code, but apart from that this issue can probably be closed.