【已解决】RuntimeError: CuDA error: no kernel image is available for execution on the device

简介: 【已解决】RuntimeError: CuDA error: no kernel image is available for execution on the device

问题:根本原因是之前装的cuda和torch版本和显卡不适配(开始以为4090可以兼容很多版本就没管)

解决方法:卸载之前的cuda和torch,找到适配的cuda和troch版本,安装--然后就没问题了。


我的配置

GPU 10张4090

CUDA 11.8(4090最低能跑的版本说是)

python 3.12

问题分析


其实就是4090算力和cuda不兼容,pytorch所依赖的cuda只支持比他小的,所以尽量装新一点的cuda版本。


装好后可以测试cuda是否能用

torch.cuda.is_available()
True

这样就算可以了。

查看cuda version  nvidia-smi  

解决办法      

1.查看显卡算力

CUDA GPUs - Compute Capability | NVIDIA Developer

找到你的显卡对应算力,如4090对应8.9

2.算力对应的cuda版本

NVIDIA Datacenter Drivers :: NVIDIA Data Center GPU Driver Documentation

对应8.9是cuda11.8,只能高不能低

相关文章
|
IDE PyTorch 网络安全
|
并行计算 Linux PyTorch
RuntimeError: CUDA error: device-side assert triggered
我在运行PyG和transformers代码时两次遇到了这一问题,在此加以记录。
|
4月前
|
并行计算 监控 前端开发
函数计算操作报错合集之如何解决报错:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0!
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
5月前
|
机器学习/深度学习 并行计算 PyTorch
【已解决】RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronous
【已解决】RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronous
|
5月前
|
Ubuntu iOS开发 MacOS
Could not enumerate video devices (or none found).解决办法
Could not enumerate video devices (or none found).解决办法
78 0
|
并行计算 PyTorch 算法框架/工具
已解决yolov5报错RuntimeError: CUDA out of memory. Tried to allocate 14.00 MiB
已解决yolov5报错RuntimeError: CUDA out of memory. Tried to allocate 14.00 MiB
403 0
|
TensorFlow 算法框架/工具 Python
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
|
机器学习/深度学习 PyTorch 算法框架/工具
解决RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cp
对应两种保存模型的方式,pytorch也有两种加载模型的方式。对应第一种保存方式,加载模型时通过torch.load(‘.pth’)直接初始化新的神经网络对象;对应第二种保存方式,需要首先导入对应的网络,再通过net.load_state_dict(torch.load(‘.pth’))完成模型参数的加载。
1349 0
|
并行计算 PyTorch 算法框架/工具
RuntimeError: CUDA error (10): invalid device ordinal
造成这个错误的原因主要是本地只有一个 GPU (GPU:0),而程序中使用 GPUs:1。
515 0
解决 RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
解决 RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
307 0