调错 RuntimeError: CUDA error: the launch timed out and was terminated

主要是对于双显卡的电脑

运行深度学习分割代码报错(运行 predict.py 时候报错)

参考这一篇cuda运行错误:the launch timed out and was terminated in_Liber-coder的博客-CSDN博客

 调错 RuntimeError: CUDA error: the launch timed out and was terminated_第1张图片

该方法并没有解决代码报错

考虑到是GPU报错,调用的问题

我们更换调用的GPU

换成独立显卡

CUDA_VISIBLE_DEVICES='0'           #表示调用0块GPU

或者

import os

os.environ["CUDA_DEVICES_ORDER"]="PCI_BUS_IS"

os.environ["CUDA_VISIBLE_DEVICES"] = "0"

 

没有报错,成功运行

你可能感兴趣的:(技术指导,代码,pytorch,人工智能,python)