Repository: facebookarchive/caffe2

Issue #887: Caffe2 build seems to require CuDNN
Created: 2017-06-28T18:43:25Z
Although the build instructions seem to suggest caffe2 is buildable without cudnn, it in fact seems to rely on cudnn.h existing.
I got the failure on b955376, on a CentOS box:
[ezyang@REDACTED ~/local/caffe2/build] which nvcc
/usr/local/cuda-8.0/bin/nvcc
[ezyang@REDACTED ~/local/caffe2/build] nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44

The failure:
o
In file included from /home/ezyang/local/caffe2/caffe2/core/context_gpu.cu:13:0:
/home/ezyang/local/caffe2/caffe2/core/common_cudnn.h:7:19: fatal error: cudnn.h: No such file or directory
 #include <cudnn.h>
                   ^
compilation terminated.
CMake Error at Caffe2_GPU_generated_context_gpu.cu.o.Release.cmake:203 (message):
  Error generating
  /home/ezyang/local/caffe2/build/caffe2/CMakeFiles/Caffe2_GPU.dir/core/./Caffe2_GPU_generated_context_gpu.cu.o


make[2]: *** [caffe2/CMakeFiles/Caffe2_GPU.dir/core/Caffe2_GPU_generated_context_gpu.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [caffe2/CMakeFiles/Caffe2_GPU.dir/all] Error 2
make: *** [all] Error 2

CMake correctly determined that cudnn was not available.
-- Could NOT find CUDNN (missing:  CUDNN_INCLUDE_DIR CUDNN_LIBRARY) 
-- Could NOT find NCCL (missing:  NCCL_INCLUDE_DIR NCCL_LIBRARY) 
-- NCCL: /home/ezyang/local/caffe2/third_party/nccl/build/lib/libnccl_static.a
-- Could NOT find CUB (missing:  CUB_INCLUDE_DIR) 
-- Could NOT find Gloo (missing:  Gloo_INCLUDE_DIR Gloo_LIBRARY) 
-- CUDA detected: 8.0
-- Found libcuda: /usr/lib64/libcuda.so
-- Found libnvrtc: /usr/local/cuda-8.0/lib64/libnvrtc.so
-- Does not need to define long separately.
-- This compiler has builtin_cpu_supports feature.
-- Turning off deprecation warning due to glog.
-- GCC 4.8.5: Adding gcc and gcc_s libs to link line
-- Include NCCL operators
-- Excluding image processing operators due to no opencv
-- Excluding video processing operators due to no opencv
-- Excluding mkl operators as we are not using mkl
-- MPI operators skipped due to no MPI support
-- Automatically generating missing __init__.py files.
-- 
-- ******** Summary ********
-- General:
--   Git version           : 
--   System                : Linux
--   C++ compiler          : /home/ezyang/local/anaconda2/bin/c++
--   C++ compiler version  : 4.8.5
--   Protobuf compiler     : /bin/protoc
--   CXX flags             :  -fopenmp -Wno-deprecated -std=c++11 -fPIC -Wno-narrowing
--   Build type            : Release
--   Compile definitions   : CAFFE2_USE_EIGEN_FOR_BLAS;EIGEN_MPL2_ONLY
-- 
--   BUILD_SHARED_LIBS     : ON
--   BUILD_PYTHON          : ON
--     Python version      : 2.7.13
--     Python library      : /home/ezyang/local/anaconda2/lib/libpython2.7.so
--   BUILD_TEST            : ON
--   USE_CUDA              : ON
--     CUDA version        : 8.0

I think a workaround is to just install CuDNN, even if your GPU doesn't actually support it. BTW, header is not enough, it will link against cudnn too.

Duplicate issue #959: caffe2 will set link time dependency on libcudnn.so.5 even when this library doesn't exist at configure time
Created: 2017-07-24T20:17:46Z
Steps to reproduce:

Get a machine that doesn't have CuDNN installed
Install CuDNN to a non-standard location
From your standard location, create a libcudnn.so and libcudnn.a symlink to the shared library in the non-standard location. DO NOT create a libcudnn.so.5 (or whatever the version is) symlink.
Configure and build caffe2
Link a program against caffe2

Expected result: Either everything succeeds, or when I configure in step (4), caffe2 tells me my CuDNN install is broken.
Actual result: CuDNN detects libcudnn.so and concludes that CuDNN is installed, but then proceeds to record a dynamic dependency against libcudnn.so.5 (which doesn't exist), causing subsequent linking to fail.
CC @justinchiu

Closing comment (2017-07-25T13:43:03Z): Seems related to #887.