RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronously re

RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

关于Ubuntu18.04运行yolov5时出现这个错误的解决方法:

   它显示的问题是cuda内核出现了错误,那么就是与cuda版本有关

我所运行的电脑配置为 RTX3060 + ubuntu18.04 + 10.2 CUDA 以及所对应的cudnn

后来我查阅的大多数文章显示我的3060显卡算力为8.6

官方网站:https://developer.nvidia.com/cuda-gpus

RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronously re_第1张图片

 于是我下载了cuda 11.1 和对应的cudnn v8.0.5

RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronously re_第2张图片

RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronously re_第3张图片

 

 下载anaconda3

推荐博主

(12条消息) linux上下载Anaconda3_西海燃风的博客-CSDN博客_anaconda linux 下载

pytorch

在pytorch里我选择cuda11.1

# CUDA 11.1
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

下载搭配好后测试

python
import torch
print(torch.cuda.is_available()) #正确会显示true

print(torch.version.cuda)  #显示版本

然后问题解决!

你可能感兴趣的:(深度学习,linux)