davisking/dlib

Trying to compile DLIB with CUDNN. CUDA v12 with CUDNN v8 On tensorflow/tensorflow:latest-gpu (Ubuntu 22.04.3 LTS)

parinyawon opened this issue · 4 comments

What Operating System(s) are you seeing this problem on?

Other (plase, specify in the Steps to Reproduce)

dlib version

19.24

Python version

3.10.12

Compiler

gcc11.4

Expected Behavior

cmake build dlib which can use gpu not gpu

Current Behavior

Found CUDA: /usr/local/cuda (found suitable version "12.3", minimum required is "7.5")
#14 17.79 -- Looking for cuDNN install...
#14 17.79 -- *** cuDNN V5.0 OR GREATER NOT FOUND. ***
#14 17.79 -- *** Dlib requires cuDNN V5.0 OR GREATER. Since cuDNN is not found DLIB WILL NOT USE CUDA. ***
#14 17.79 -- *** If you have cuDNN then set CMAKE_PREFIX_PATH to include cuDNN's folder. ***
#14 17.79 -- Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA

Steps to Reproduce

I have Dockerfile with following content, while docker build i face the issue.

`
FROM tensorflow/tensorflow:latest-gpu

WORKDIR /app

COPY . /app

RUN ls -la /app

WORKDIR /app

RUN apt-get update && apt-get install -y
build-essential
curl
wget
cmake
libssl-dev \
libgtk-3-dev
libgl1-mesa-glx
libgl1-mesa-dri
ffmpeg
libjpeg-dev
libpng-dev
libtiff-dev
libatlas-base-dev
gfortran
libopenblas-dev
liblapack-dev
libx11-dev
libboost-python-dev
libv4l-dev
libpq-dev
openssl \
git
&& rm -rf /var/lib/apt/lists/*

RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py &&
python3 get-pip.py &&
rm get-pip.py

ENV CUDA_HOME=/usr/local/cuda
ENV PATH=$CUDA_HOME/bin:$PATH
ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH

RUN ln -s /usr/local/cuda/lib64/libcublas.so.12 /usr/local/cuda/lib64/libcublas.so &&
ln -s /usr/local/cuda/lib64/libcublasLt.so.12 /usr/local/cuda/lib64/libcublasLt.so

RUN ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.8 /usr/local/cuda/lib64/libcudnn.so &&
ln -s /usr/local/lib/python3.10/dist-packages/tensorflow/include/third_party/gpus/cudnn/include/cudnn.h /usr/local/cuda/include/cudnn.h &&
ln -s /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8 /usr/local/cuda/lib64/libcudnn_adv_infer.so &&
ln -s /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8 /usr/local/cuda/lib64/libcudnn_adv_train.so &&
ln -s /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8 /usr/local/cuda/lib64/libcudnn_cnn_infer.so &&
ln -s /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8 /usr/local/cuda/lib64/libcudnn_cnn_train.so &&
ln -s /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8 /usr/local/cuda/lib64/libcudnn_ops_infer.so &&
ln -s /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8 /usr/local/cuda/lib64/libcudnn_ops_train.so

RUN git clone https://github.com/davisking/dlib.git &&
cd dlib &&
mkdir build &&
cd build &&
cmake .. -DDLIB_USE_CUDA=1 -DDLIB_USE_CUDNN=1 -DUSE_AVX_INSTRUCTIONS=1
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
-DCUDA_cublas_LIBRARY=/usr/local/cuda/lib64/libcublas.so
-DCUDA_cublasLt_LIBRARY=/usr/local/cuda/lib64/libcublasLt.so
-DCUDNN_INCLUDE_DIR=/usr/local/cuda/include/
-DCUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so &&
cmake --build . --config Release &&
cd .. &&
python3 setup.py install &&
cd .. &&
apt-get remove -y git &&
apt-get autoremove -y &&
apt-get clean
`

Anything else?

The cuda and cuDNN path as its configuration

RUN ln -s /usr/local/cuda/lib64/libcublas.so.12 /usr/local/cuda/lib64/libcublas.so && \
    ln -s /usr/local/cuda/lib64/libcublasLt.so.12 /usr/local/cuda/lib64/libcublasLt.so

RUN ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.8 /usr/local/cuda/lib64/libcudnn.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8 /usr/local/cuda/lib64/libcudnn_adv_infer.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8 /usr/local/cuda/lib64/libcudnn_adv_train.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8 /usr/local/cuda/lib64/libcudnn_cnn_infer.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8 /usr/local/cuda/lib64/libcudnn_cnn_train.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8 /usr/local/cuda/lib64/libcudnn_ops_infer.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8 /usr/local/cuda/lib64/libcudnn_ops_train.so

try this as base image:

Use NVIDIA CUDA image with cuDNN and Ubuntu 22.04
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV TF_FORCE_GPU_ALLOW_GROWTH="true"

Warning: this issue has been inactive for 36 days and will be automatically closed on 2024-11-17 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.