简体   繁体   English

尝试将 cuda 与 pytorch 一起使用时出现运行时错误 999

[英]Runtime error 999 when trying to use cuda with pytorch

I installed Cuda 10.1 and the latest Nvidia Driver for my Geforce 2080 ti.我为我的 Geforce 2080 ti 安装了 Cuda 10.1 和最新的 Nvidia 驱动程序。 I try to run a basic script to test if pytorch is working and I get the following error:我尝试运行一个基本脚本来测试 pytorch 是否正常工作,我收到以下错误:

RuntimeError: cuda runtime error (999): unknown error at..\aten\src\THC\THCGeneral.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 ):但对于侵入性较小的修复,您也可以尝试此解决方案(来自tensorflow 问题线程):

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

In case of PyTorch it seems to be sufficient to restart only nvidia-uvm (Unified Virtual Memory) with在 PyTorch 的情况下,仅重启nvidia-uvm (统一虚拟内存)似乎就足够了

sudo modprobe --remove nvidia-uvm  # same as `rmmod`
sudo modprobe nvidia-uvm

If that doesn't work, go ahead and restart the whole module with additional modprobe (--remove) nvidia as mentioned @matwilso's answer .如果这不起作用,请提前 go 并使用额外的modprobe (--remove) nvidia重新启动整个模块,如@matwilso 的回答所述。

In my case, I solved the 999 error with: nvidia-modprobe -u就我而言,我使用以下方法解决了 999 错误: nvidia-modprobe -u

Reinstalling NVIDIA driver solves this problem in my case.就我而言,重新安装 NVIDIA 驱动程序可以解决这个问题。 (You don't need to restart the computer) (不需要重启电脑)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM