Runtime error 999 when trying to use cuda with pytorch(尝试在 pytorch 中使用 cuda 时出现运行时错误 999)

本文介绍了尝试在 pytorch 中使用 cuda 时出现运行时错误 999的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为 Geforce 2080 ti 安装了 Cuda 10.1 和最新的 Nvidia 驱动程序.我尝试运行一个基本脚本来测试 pytorch 是否正常工作,但出现以下错误:

I installed Cuda 10.1 and the latest Nvidia Driver for my Geforce 2080 ti. I try to run a basic script to test if pytorch is working and I get the following error:

RuntimeError: cuda runtime error (999) : ..atensrcTHCTHCGeneral.cpp:50 处的未知错误

下面是我试图运行的代码:

Below is the code im trying to run:

import torch
torch.cuda.current_device()
torch.cuda.is_available()
torch.cuda.get_device_name(0)

推荐答案

重新启动计算机为我解决了这个问题.

Restarting my computer fixed this for me.

但是对于侵入性较小的修复,您也可以尝试此解决方案(来自 张量流问题线程):

But for a less invasive fix, you can also try this solution (from a tensorflow issue thread):

sudo rmmod nvidia_uvm
sudo rmmod nvidia
sudo modprobe nvidia
sudo modprobe nvidia_uvm

这篇关于尝试在 pytorch 中使用 cuda 时出现运行时错误 999的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!