Error while running EDSR model: CUDNN_STATUS_NOT_INITIALIZED in function 'UniqueHandle'

I don’t think opencv_test_dnn_superres uses the CUDA backend. You can force it to do so by adding

dnn_sr->setPreferableBackend(dnn::DNN_BACKEND_CUDA);
dnn_sr->setPreferableTarget(dnn::DNN_TARGET_CUDA);

here. For me this passed the tests without any problems.

I then tried the model you are using downlaode from

and placed in the PATH_TO_EXTRA/testdata/cv/dnn_suprres directory with the following small changes

and again had not issues. I would therefore suggest you either perform these tests (which you might not want to because you will have to recompile) or run opencv_test_dnn as described below to see if any models which use the cuDNN work on your setup.

To test opencv_test_dnn you first you need to download a model. I suggest GoogLeNet as its relatively small.

When you have the extra repo and you have added the path

export OPENCV_TEST_DATA_PATH=<PATH_TO_EXTRA/testdata>

you will need to go to the PATH_TO_EXTRA/testdata/dnn folder and download the googlenet model using

python download_models.py GoogleNet

Then you can execute the test as

./opencv_test_dnn --gtest_filter=DNNTestNetwork.GoogLeNet/0

and hopefully the output should be something similar to

CTEST_FULL_OUTPUT
OpenCV version: 4.7.0-dev
OpenCV VCS version: 4.7.0-98-g0052d46b8e
Build type: Release
Compiler: /usr/bin/c++  (ver 9.4.0)
Parallel framework: pthreads (nthreads=20)
CPU features: SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?
Intel(R) IPP version: ippIP AVX2 (l9) 2020.0.0 Gold (-) Oct 19 2019
Intel(R) IPP features code: 0x8000
OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong', 'dnn_skip_opencv_backend', 'dnn_skip_cpu', 'dnn_skip_ocl', 'dnn_skip_ocl_fp16', 'dnn_skip_cuda', 'dnn_skip_cuda_fp32', 'dnn_skip_cuda_fp16', 'dnn_skip_onnx_conformance', 'dnn_skip_parser'
Note: Google Test filter = DNNTestNetwork.GoogLeNet/0
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from DNNTestNetwork
[ RUN      ] DNNTestNetwork.GoogLeNet/0, where GetParam() = CUDA/CUDA
[       OK ] DNNTestNetwork.GoogLeNet/0 (8183 ms)
[----------] 1 test from DNNTestNetwork (8183 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (8183 ms total)
[  PASSED  ] 1 test.