【已解决】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,只能高不能低

相关文章
|
并行计算 Linux PyTorch
RuntimeError: CUDA error: device-side assert triggered
我在运行PyG和transformers代码时两次遇到了这一问题,在此加以记录。
|
1月前
|
机器学习/深度学习 并行计算 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
|
10月前
|
虚拟化
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
|
1月前
|
Ubuntu iOS开发 MacOS
Could not enumerate video devices (or none found).解决办法
Could not enumerate video devices (or none found).解决办法
45 0
|
11月前
|
并行计算 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
309 0
|
机器学习/深度学习 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’))完成模型参数的加载。
967 0
|
并行计算 PyTorch 算法框架/工具
RuntimeError: CUDA error (10): invalid device ordinal
造成这个错误的原因主要是本地只有一个 GPU (GPU:0),而程序中使用 GPUs:1。
328 0
解决 RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
解决 RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
237 0
|
数据格式
ValueError: This model has not yet been built. Build the model first by calling `build()` or calling
ValueError: This model has not yet been built. Build the model first by calling `build()` or calling
163 0
ValueError: This model has not yet been built. Build the model first by calling `build()` or calling
dyld Library not loaded Reason image not found 问题解决
添加第三方框架,然后启动app的时候会,提示dyld: Library not loaded: Reason: image not found 网上大部分的做法都是把Build Phases 里对应framework后边的选项修改成为Optional,但这个是治标不治本,还是没法解决问题
163 0