# Error: CUDNN\_STATUS\_EXECUTION\_FAILED

**URL:** <https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558>\
**Category:** Jetson Nano\
**Tags:** cudnn\
**Created:** [June 25, 2020, 7:09am UTC](https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558 "2020-06-25T07:09:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhm\_nab](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mhm\_nab](https://forums.developer.nvidia.com/u/mhm_nab)\
**Post date:** [June 25, 2020, 7:09am UTC](https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558/1 "2020-06-25T07:09:56Z")

</div>

Hi,  
I was following one of the online tutorials but I was getting this error:  
_Traceback (most recent call last):  
File “ssd\_object\_detection.py”, line 20, in   
detections = net.forward()  
cv2.error: OpenCV(4.3.0) /home/blah/opencv/modules/dnn/src/layers/…/cuda4dnn/primitives/…/csl/cudnn/convolution.hpp:461: error: (-217:Gpu API call) CUDNN\_STATUS\_EXECUTION\_FAILED in function ‘convolve\_with\_bias\_activation’_

It a python script and this is the command:  
_python ssd\_object\_detection.py --prototxt MobileNetSSD\_deploy.prototxt   
–model MobileNetSSD\_deploy.caffemodel   
–input guitar.mp4 --output output.avi   
–display 0 --use-gpu 1_

This is my configuration:

- Jetson Nano device
- Ubuntu 18.04
- /usr/local/cuda/bin/nvcc --version  
nvcc: NVIDIA (R) Cuda compiler driver  
Copyright (c) 2005-2019 NVIDIA Corporation  
Built on Wed\_Oct\_23\_21:14:42\_PDT\_2019  
Cuda compilation tools, release 10.2, V10.2.89

> - – NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST\_MATH)  
> – NVIDIA GPU arch: 53  
> – NVIDIA PTX archs:  
> – cuDNN: YES (ver 8.0)  
> – NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST\_MATH)  
> – NVIDIA GPU arch: 53  
> – cuDNN: YES (ver 8.0)

- opencv 4.3.0 built from source with OPENCV\_DNN\_CUDA=ON, CUDNN\_VERSION=‘8.0’, WITH\_CUDA=ON, WITH\_CUDNN=ON, and many other settings enabled
- Python 3.7.7

This is the code I am trying to run (it completes successfully if I don’t use the GPU). It fails at the line **detections = net.forward()**

> CLASSES = [“background”, “aeroplane”]  
> COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3))
> 
> net = cv2.dnn.readNetFromCaffe(args[“prototxt”], args[“model”])  
> print(“[INFO] setting preferable backend and target to CUDA…”)  
> net.setPreferableBackend(cv2.dnn.DNN\_BACKEND\_CUDA)  
> net.setPreferableTarget(cv2.dnn.DNN\_TARGET\_CUDA)
> 
> print(“[INFO] accessing video stream…”)  
> vs = cv2.VideoCapture(args[“input”] if args[“input”] else 0)  
> writer = None  
> fps = FPS().start()
> 
> while True:  
> (grabbed, frame) = vs.read()  
> frame = imutils.resize(frame, width=400)  
> (h, w) = frame.shape[:2]  
> blob = cv2.dnn.blobFromImage(frame, 0.007843, (300, 300), 127.5)  
> net.setInput(blob)  
> detections = net.forward()
> 
> for i in np.arange(0, detections.shape[2]):  
> confidence = detections[0, 0, i, 2]  
> if confidence \> args[“confidence”]:  
> idx = int(detections[0, 0, i, 1])  
> box = detections[0, 0, i, 3:7] \* np.array([w, h, w, h])  
> (startX, startY, endX, endY) = box.astype(“int”)
> 
> ```
> label = "{}: {:.2f}%".format(CLASSES[idx],
> confidence * 100)
> cv2.rectangle(frame, (startX, startY), (endX, endY),
> COLORS[idx], 2)
> y = startY - 15 if startY - 15 > 15 else startY + 15
> cv2.putText(frame, label, (startX, y),
> cv2.FONT_HERSHEY_SIMPLEX, 0.5, COLORS[idx], 2)
> 
> ```
> 
> if args[“display”] \> 0:  
> cv2.imshow(“Frame”, frame)  
> key = cv2.waitKey(1) & 0xFF
> 
> ```
> if key == ord("q"):
> break
> 
> ```
> 
> if args[“output”] != “” and writer is None:  
> fourcc = cv2.VideoWriter\_fourcc(\*“MJPG”)  
> writer = cv2.VideoWriter(args[“output”], fourcc, 30,  
> (frame.shape[1], frame.shape[0]), True)
> 
> if writer is not None:  
> writer.write(frame)
> 
> fps.update()
> 
> fps.stop()  
> print(“[INFO] elasped time: {:.2f}”.format(fps.elapsed()))  
> print(“[INFO] approx. FPS: {:.2f}”.format(fps.fps()))

Thanks!

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [June 29, 2020, 2:17am UTC](https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558/3 "2020-06-29T02:17:56Z")

</div>

Hi,

It looks like your OpenCV inference the model with _Caffe_ frameworks.

Suppose you have built Caffe from source on your environment first.  
Please check that if you have built the library with correct architecture _(sm\_53)_ for Nano GPU.

Thanks.

---

<div class="post-metadata">

**Author:** ![blowbuz](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@blowbuz](https://forums.developer.nvidia.com/u/blowbuz)\
**Post date:** [March 15, 2021, 11:56pm UTC](https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558/5 "2021-03-15T23:56:31Z")

</div>

I’m using opencv 4.2.0 and have two Nvidia P5000 installed. getCudaEnabledDeviceCount() returns 2.  
In the case of the first GPU(setDevice(0)) :

> inputNet.setPreferableBackend(cv::dnn::DNN\_BACKEND\_CUDA);  
> inputNet.setPreferableTarget(cv::dnn::DNN\_TARGET\_CUDA);  
> runs without any errors.

In the case of the second gpu(setDevice(1)):  
I get (-217:Gpu API call) CUDNN\_STATUS\_EXECUTION\_FAILED in function ‘convolve’

---

<div class="post-metadata">

**Author:** ![kayccc](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kayccc/32/14043_2.png) [@kayccc](https://forums.developer.nvidia.com/u/kayccc)\
**Post date:** [March 24, 2021, 5:44am UTC](https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558/6 "2021-03-24T05:44:45Z")

</div>

Hi [blowbuz](https://forums.developer.nvidia.com/u/blowbuz),

Here is for Jetson platform, for dGPU, please open topic at [CUDA Programming and Performance - NVIDIA Developer Forums](https://forums.developer.nvidia.com/c/accelerated-computing/cuda/cuda-programming-and-performance/7)

---

<div class="post-metadata">

**Author:** ![nadeemm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nadeemm/32/367020_2.png) [@nadeemm](https://forums.developer.nvidia.com/u/nadeemm)\
**Post date:** [October 15, 2021, 4:57am UTC](https://forums.developer.nvidia.com/t/error-cudnn-status-execution-failed/129558/7 "2021-10-15T04:57:52Z")

</div>

Closed on October 15, 2021, 4:57am UTC


