MPI-IS / bilateralNN

Learning Sparse High Dimensional Filters with Neural Networks
http://bilateralnn.is.tue.mpg.de
BSD 3-Clause "New" or "Revised" License
69 stars 25 forks source link

Getting error while installing caffe provided here #2

Closed musafirsafwan closed 7 years ago

musafirsafwan commented 7 years ago

nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). /bilateralNN/build/tmp_caffe_clone/src/CaffeUpstream/include/caffe/common.cuh(13): error: function "atomicAdd(double *, double)" has already been defined

nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

1 error detected in the compilation of "/tmp/tmpxft_00004400_00000000-5_permutohedral.cpp4.ii". CMake Error at cuda_compile_generated_permutohedral.cu.o.cmake:264 (message): Error generating file /bilateralNN/build/bin/src/caffe/CMakeFiles/cuda_compile.dir/util/./cuda_compile_generated_permutohedral.cu.o

make[5]: *** [src/caffe/CMakeFiles/cuda_compile.dir/util/cuda_compile_generated_permutohedral.cu.o] Error 1 make[5]: *** Waiting for unfinished jobs.... make[4]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2 make[3]: *** [all] Error 2 make[2]: *** [tmp_caffe_clone/src/CaffeUpstream-stamp/CaffeUpstream-build] Error 2 make[1]: *** [CMakeFiles/CaffeUpstream.dir/all] Error 2 make: *** [all] Error 2

Any idea how to fix this? Thank you.

raffienficiaud commented 7 years ago

Thanks for the feedback. What is your operating system and the version of CUDA you are running?

musafirsafwan commented 7 years ago

Ubuntu 14.04 and CUDA 8.

musafirsafwan commented 7 years ago

I suspect it is because the cuDNN is not getting detected. In the Caffe Configuration Summary shown just before compilation, 'Not found' is shown for cuDNN. I faced the issue when I was installing the original (unpatched) caffe. That time, I used ccmake to add the cuDNN path before compilation and it solved the issue. Here when I use ccmake, there is no key given as cuDNN. So I don't know how and where to add the cuDNN path.

musafirsafwan commented 7 years ago

I tried cmake -DCUDNN_INCLUDE=/usr/local/cuda/include/ -DCUDNN_LIBRARY=/usr/local/cuda/lib64/ .., but still getting the same error.

varunjampani commented 7 years ago

Are you getting the same error when installing some other caffe version? And, did you try 'manual way' of porting the new 'permutohedral' and 'pixel feature' layers into your caffe version?

Like below:

The patching that is performed by cmake is rather a copying of the files from the folder of the bilateralNN to the corresponding folders of Caffe. Caffe will then add the new files into the project.

Alternatively, you can manually copy all but caffe.proto source files in bilateralNN folder to the corresponding locations in your Caffe repository. Then, for merging the caffe.proto file of bilateralNN to your version of the caffe.proto:

  1. Copy the lines 382-383 and 854-922 in caffe.proto to the corresponding caffe.proto file in the destination Caffe repository.
  2. Change the parameter IDs for PermutohedralParameter and PixelFeatureParameter based on the next available LayerParameter ID in your Caffe.
musafirsafwan commented 7 years ago

Hi @varunjampani and @raffienficiaud, thanks for the response.

  1. I tried patching the latest caffe version (0.15.13) and while running make command after cmake (I believe I have to run make after running cmake, correct me if I am wrong), I am getting the same error which I am getting while installing the already patched caffe provided here.

  2. I tried the manual way of porting the layers into my caffe version. After copying the files and changing the parameter IDs, I recompile my caffe version (I believe that I have to recompile caffe after manually porting the layers. Correct me if I am wrong). While recompiling, I am getting some warnings in the start and an error in the end.

These are the warnings I am getting:

src/caffe/layers/permutohedral_layer.cpp:153:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
 #pragma omp parallel
 ^
src/caffe/layers/permutohedral_layer.cpp:157:0: warning: ignoring #pragma omp for [-Wunknown-pragmas]
       #pragma omp for
 ^
src/caffe/layers/permutohedral_layer.cpp:342:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
 #pragma omp parallel
 ^
src/caffe/layers/permutohedral_layer.cpp:348:0: warning: ignoring #pragma omp for [-Wunknown-pragmas]
 #pragma omp for
 ^
src/caffe/layers/permutohedral_layer.cpp:426:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
   #pragma omp parallel
 ^
src/caffe/layers/permutohedral_layer.cpp:439:0: warning: ignoring #pragma omp for [-Wunknown-pragmas]
     #pragma omp for
 ^
src/caffe/layers/permutohedral_layer.cpp:463:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]
     #pragma omp critical
 ^

And this is the error I am getting:

1 error detected in the compilation of "/tmp/tmpxft_00002f72_00000000-5_permutohedral.cpp4.ii".
make: *** [.build_release/cuda/src/caffe/util/permutohedral.o] Error 1

I don't know what changes should I make and any help is greatly appreciated.

raffienficiaud commented 7 years ago

The warnings that you are getting indicate a lack of openmp support for your compiler. Would you please:

Thanks

musafirsafwan commented 7 years ago

@raffienficiaud and @varunjampani, I resolved the issue.

I was getting the error /bilateralNN/build/tmp_caffe_clone/src/CaffeUpstream/include/caffe/common.cuh(13): error: function "atomicAdd(double *, double)" has already been defined because the atomicAdd function is already defined in Cuda 8 unlike Cuda 7.5.

Changing bilateralnn_code/include/caffe/common.cuh to given below code resolves the issue.

// Copyright 2016 Max Planck Society
// Distributed under the BSD-3 Software license,
// (See accompanying file ../../../../LICENSE.txt or copy at
// https://opensource.org/licenses/BSD-3-Clause)

// atomicAdd is not defined for doubles in Cuda 7.5
// from http://docs.nvidia.com/cuda/cuda-c-programming-guide/#atomic-functions

#ifndef CAFFE_COMMON_CUH_
#define CAFFE_COMMON_CUH_

#include <cuda.h>

  #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

Thanks a lot for your efforts. Shall I close this issue?

raffienficiaud commented 7 years ago

I will add your changes! I am closing the issue then. Thanks for helping out!