Where is cudnn.h please?

I can’t find cudnn.h file? upon searching system wide I found the file use_cudnn.h under:

/usr/local/lib/python3.8/dist-packages/tensorflow/include/tensorflow/core/util/

is this the same file or something else?

cudnn.h is a C header file. You should not need this with python.
I will see if Lambda stack can add it in the future.

Currently Lambda Stack builds and compiles pytorch and tensorflow with CUDA and cudnn runtime libraries.

If you use Anaconda/miniconda that does install it with Anaconda.
Otherwise to get the C header files for cudnn you would need to install the CUDNN package from NVIDIA
which does require registering at NVIDIA. (Yes a bit of a pain).

Get cuDNN: cuDNN Archive | NVIDIA Developer

  • Pick the version that you would like depending on what version you have installed
    Local Installer for Ubuntu20.04 x86_64 (Deb)
    or
    Local Installer for Linux x86_64 (Tar)
  • This one you can install anywhere
    tar -xf cudnn-linux-x86_64-8.3.3.40_cuda11.5-archive.tar.xz
    It will extract in a local directory with :
    cudnn-linux-x86_64-8.3.3.40_cuda11.5-archive/

NVIDIA installs in a the package in /usr/includ and libs in /usr/lib/…

It looks like they changed the format from previously so I just ran through it again.

  1. Download the file from the web.

  2. Install this version:
    $ sudo dpkg -i cudnn-local-repo-ubuntu2004-8.3.3.40_1.0-1_amd64.deb
    [sudo] password for mark:
    Selecting previously unselected package cudnn-local-repo-ubuntu2004-8.3.3.40.
    (Reading database … 463170 files and directories currently installed.)
    Preparing to unpack cudnn-local-repo-ubuntu2004-8.3.3.40_1.0-1_amd64.deb …
    Unpacking cudnn-local-repo-ubuntu2004-8.3.3.40 (1.0-1) …
    Setting up cudnn-local-repo-ubuntu2004-8.3.3.40 (1.0-1) …

    The public CUDA GPG key does not appear to be installed.
    To install the key, run this command:
    sudo apt-key add /var/cudnn-local-repo-ubuntu2004-8.3.3.40/7fa2af80.pub

  3. Follow the instruction and install this local repo for this cudnn:
    $ sudo apt-key add /var/cudnn-local-repo-ubuntu2004-8.3.3.40/7fa2af80.pub
    OK
    $ sudo apt-get update
    $ sudo apt install libcudnn8 libcudnn8-dev

The Lambda Stack has the CUDNN library for Tensorflow and Pytorch software in the following directories:

/usr/lib/python3/dist-packages/torch/lib/libcudnn.so.8
/usr/lib/python3/dist-packages/tensorflow/libcudnn.so.8

There is no “cudnn.h” file by default with Lambda Stack if that is what you are looking for.

Just a update. At least on Ubuntu 22.04 it looks like there is a ‘nvidia-cudnn’ which does include the C header files.
$ apt search nvidia-cudnn
nvidia-cudnn/jammy,now 8.2.4.15~cuda11.4 amd64 [installed]
NVIDIA CUDA Deep Neural Network library (install script)

$ sudo apt install nvidia-cudnn
It installs the header file in:
/usr/include/x86_64-linux-gnu/cudnn.h

But note this is also install the cudnn library and may conflict with the PyTorch/TensorFlow builds at times.