Problem setting up cuDNN on ubuntu 16.04

I installed

libcudnn7_7.1.1.5-1+cuda9.1_amd64.deb

which I downloaded from the official NVIDIA webpage. I used:

sudo dpkg -i libcudnn7_7.1.1.5-1+cuda9.1_amd64.deb

No problems there. Then I tried to use the examples to check if the installation has been correct but when I do “make” on the mnistCUDNN example i get this:

/usr/bin/ld: cannot find -lcudnn
collect2: error: ld returned 1 exit status
>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
rm -rf *o
rm -rf mnistCUDNN
/usr/bin/ld: cannot find -lcudnn
collect2: error: ld returned 1 exit status
>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
[@] /usr/local/cuda/bin/nvcc -ccbin g++ -I/usr/local/cuda/include -IFreeImage/include -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o fp16_dev.o -c fp16_dev.cu
[@] g++ -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp
[@] g++ -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp
[@] /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm

I have a GTX 1060 NVIDIA card and I have installed cuda correctly:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

I also have installed the driver: “NVIDIA-SMI 390.25”

This might help, I was facing the same problem:

We created a new “Deep Learning Training and Inference” section in Devtalk to improve the experience for deep learning and accelerated computing, and HPC users:
https://devtalk.nvidia.com/default/board/301/deep-learning-training-and-inference-/

We are moving active deep learning threads to the new section.

URLs for topics will not change with the re-categorization. So your bookmarks and links will continue to work as earlier.

-Siddharth

The Makefile starts by establishing the location of the CUDA Toolkit

CUDA_PATH ?= /usr/local/cuda

If the CUDA_PATH variable is not already set, it sets it to /usr/local/cuda

This is where my error occurred because 1: I did not have a CUDA_PATH variable set and 2: when I installed CUDA, I told it not to create a symbolic link.

Later in the script, it sets the variable for NVCC:

NVCC :={CUDA_PATH)/bin/nvcc -ccbin (HOST_COMPILER)

So, the script was trying to call NVCC from /usr/local/cuda/bin/nvcc, which caused the error.

To fix this, you can either create the correct symbolic link:

sudo ln -s /usr/local/cuda-9.0 /usr/local/cuda

or you can set the CUDA_PATH:

export CUDA_PATH=/usr/local/cuda-9.0

Either of these should allow the Makefile to execute error free.