[WARN:0@3.383] global net_impl.cpp:174 setUpNet DNN module was not built with CUDA backend; switching to CPU

I am having the above issue, I have upgraded to the newest version of CUDA. But I am not understanding if I am missing something to get rid of this error. When I read few blogs and forums, I see few people mentioning about CMAKE file changes, I am not aware of this.

Any hints on this would really helpful.
@linuxdev @Honey_Patouceul @kayccc @AastaLLL


You may tell in what condition you’re facing that.

From python ? Try

# Or 
# pyhton3
# pyhton3.8
# pyhton3.9

import cv2

Look in output for CUDA and CUDNN support.

I don’t do enough with CUDA to really answer this. I’ll make a guess though: Every CUDA program must be compiled naming the architecture of the GPU (more than one architecture can be used simultaneously if desired). Just to emphasize, that is GPU architecture, not CPU architecture. It sounds like a lack of proper architecture for the available GPU is falling back to CPU.

For reference, a TX2 GPU (“Pascal” architecture) description: 6.2 (sm_62).

Inside of your CMakefile (or a Makefile or similar) there would be these compile options (as a minimum):
-gencode arch=compute_62,code=sm_62

If that’s already there, then I have no clue as to the cause. The part that is fascinating about it is that unlike a regular program, it can have as many architectures as you want simultaneously. The CPU architecture has to be the same as the CPU, so you couldn’t transport this between a desktop PC and a Jetson, but if you have the same CPU architecture on many machines, but different GPUs, then in theory you could compile once and be done. The downside is that the code would grow larger with each additional GPU architecture.