Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Building DNN module with cuDNN backend

I am building OpenCV 4.3.0-dev with cuDNN support. I pass these options to CMake:

    -DWITH_CUDNN=ON \
    -DCUDNN_LIBRARY="$(pwd)/../../cudnn/lib64/libcudnn.so" \
    -DCUDNN_INCLUDE_DIR="$(pwd)/../../cudnn/include" \
    -DCUDA_ARCH_BIN=7.0 \

However when I try to use the CUDA backend to the DNN module:

        net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
        net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)

I get the message "setUpNet DNN module was not built with CUDA backend; switching to CPU".

This GitHub issue suggests disabling CUDA architectures below 7.0 which is what I am doing. Is there something else I'm missing?

Building DNN module with cuDNN backend

I am building OpenCV 4.3.0-dev with cuDNN support. My cuDNN version is the latest, 7.6.5. I pass these options to CMake:

    -DWITH_CUDNN=ON \
    -DCUDNN_LIBRARY="$(pwd)/../../cudnn/lib64/libcudnn.so" \
    -DCUDNN_INCLUDE_DIR="$(pwd)/../../cudnn/include" \
    -DCUDA_ARCH_BIN=7.0 \

However when I try to use the CUDA backend to the DNN module:

        net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
        net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)

I get the message "setUpNet DNN module was not built with CUDA backend; switching to CPU".

This GitHub issue suggests disabling CUDA architectures below 7.0 which is what I am doing. Is there something else I'm missing?

Building DNN module with cuDNN backend

I am building OpenCV 4.3.0-dev with cuDNN support. My cuDNN version is the latest, 7.6.5. 7.6.x. I pass these options to CMake:

    -DWITH_CUDNN=ON \
    -DCUDNN_LIBRARY="$(pwd)/../../cudnn/lib64/libcudnn.so" \
    -DCUDNN_INCLUDE_DIR="$(pwd)/../../cudnn/include" \
    -DCUDA_ARCH_BIN=7.0 \

And it seems to go OK:

--   NVIDIA CUDA:                   YES (ver 9.1, CUFFT CUBLAS)
--     NVIDIA GPU arch:             70
--     NVIDIA PTX archs:
-- 
--   cuDNN:                         YES (ver 7.6.4)

However when I try to use the CUDA backend to the DNN module:

        net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
        net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)

I get the message "setUpNet DNN module was not built with CUDA backend; switching to CPU".

This GitHub issue suggests disabling CUDA architectures below 7.0 which is what I am doing. Is there something else I'm missing?