0

While verifying cuDNN install on Linux as the docs implied:

  1. Compile the mnistCUDNN sample. $make clean && make

I encountered error as below:

XXX@XXX ~/cudnn_samples_v7-master/mnistCUDNN $ make clean && make
rm -rf *o
rm -rf mnistCUDNN
/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
In file included from fp16_emu.cpp:50:
fp16_emu.h:55:10: fatal error: driver_types.h: No such file or directory
 #include <driver_types.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:200: fp16_emu.o] Error 1

I tried:

sudo find / -name driver_types.h

And I found driver_types.h is actually in

/usr/local/cuda/targets/x86_64-linux/include/

rather than

/usr/local/cuda/include .

So I replace the

CUDNN_INCLUDE_PATH ?= $(CUDA_PATH)/include

with

CUDNN_INCLUDE_PATH ?= $(CUDA_PATH)/targets/x86_64-linux/include in cudnn_samples_v7/mnistCUDNN/Makefile

And the problem was solved. I hope this would help someone.

Platform & Versions:

  • Ubuntu18.04
  • CUDA Version: 10.2
  • cuDNN Version: 7.6.5.32
charliie
  • 21
  • 5

2 Answers2

2

driver_types.h is actually in /usr/local/cuda/targets/x86_64-linux/include

Replace the

CUDNN_INCLUDE_PATH ?= $(CUDA_PATH)/include

with

CUDNN_INCLUDE_PATH ?= $(CUDA_PATH)/targets/x86_64-linux/include

in cudnn_samples_v7/mnistCUDNN/Makefile

talonmies
  • 70,661
  • 34
  • 192
  • 269
charliie
  • 21
  • 5
0

Assuming you are using cuda 9. In Ubuntu I put these exports in my .profile. If your .profile is empty then this is not the place to put it. You will have to figure that out yourself. This is in the cuda documentation. You will want to leave out the numbers at the beginning.

sudo nano $HOME/.profile

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

It might also be due to some 3rd party packages. In the cuda documentation it says to get these if you want to use the samples.

sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

I also did a quick google search and saw on the third link something about “How To Install and Use FreeImage” it gave a library. So if the other things didn’t work try using the packages below.

sudo apt-get install libfreeimage3 libfreeimage-dev

If that doesn’t work use the Ubuntu that is supported with your cuda and cudnn version and do the things I put above. You probably don’t need to do the last one, though.

Source: https://forums.developer.nvidia.com/t/freeimage-is-not-set-up-correctly-please-ensure-freeimae-is-set-up-correctly/66950

Khan
  • 1,288
  • 12
  • 11