解決RuntimeError: CUDA error: no kernel image is available for execution on the deviceCUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.

在服務(wù)器復(fù)現(xiàn)代碼的時(shí)候,遇到了上述錯(cuò)誤,解決辦法如下。
問(wèn)題描述:nvidia-smi 下的GPU編號(hào)與Pytorch上的不同
可能原因:nvidia-smi的gpu編號(hào)默認(rèn)使用的是PCI_BUS_ID,而Pytorch默認(rèn)的是FASTEST_FIRST
解決方法:將 export CUDA_DEVICE_ORDER="PCI_BUS_ID" 寫(xiě)進(jìn)用戶目錄下的.bashrc,然后source ~/.bashrc

.bashrc文件在服務(wù)器上初始頁(yè)面的配置文件的地方文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-564228.html

參考:https://discuss.pytorch.org/t/gpu-devices-nvidia-smi-and-cuda-get-device-name-output-appear-inconsistent/13150文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-564228.html
到了這里,關(guān)于解決RuntimeError: CUDA error: no kernel image is available for execution on the deviceCUDA的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!