Python CUDA运行时未知错误,可能是驱动程序问题?CUDA看不到我的gpu
目前,我的代码非常简单:Python CUDA运行时未知错误,可能是驱动程序问题?CUDA看不到我的gpu,python,tensorflow,pytorch,nvidia,Python,Tensorflow,Pytorch,Nvidia,目前,我的代码非常简单: import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") torch.cuda.current_device() --------------------------------------------------------------------------- RuntimeError Tr
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
torch.cuda.current_device()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-20-3380d2c12118> in <module>
----> 1 torch.cuda.current_device()
~/.conda/envs/tensorflow/lib/python3.6/site-packages/torch/cuda/__init__.py in current_device()
349 def current_device():
350 r"""Returns the index of a currently selected device."""
--> 351 _lazy_init()
352 return torch._C._cuda_getDevice()
353
~/.conda/envs/tensorflow/lib/python3.6/site-packages/torch/cuda/__init__.py in _lazy_init()
161 "Cannot re-initialize CUDA in forked subprocess. " + msg)
162 _check_driver()
--> 163 torch._C._cuda_init()
164 _cudart = _load_cudart()
165 _cudart.cudaGetErrorName.restype = ctypes.c_char_p
RuntimeError: cuda runtime error (30) : unknown error at /opt/conda/conda-bld/pytorch_1556653099582/work/aten/src/THC/THCGeneral.cpp:51
CUDA版本nvcc-版本:
tensorflow gpu版本:pip列表| grep tensorflow:
pytorch版本pip列表| grep torch
有人能看到兼容性问题并解释为什么以及如何解决它吗?您测试过cuda安装吗?如果没有,您可以使用,这将需要一段时间:
$ cd ~/NVIDIA_CUDA-10.0_Samples
$ make
然后:
$ cd ~/NVIDIA_CUDA-10.0_Samples/bin/x86_64/linux/release
$./deviceQuery
你应该通过考试!结果呢
你试过这个吗?或者只是重新启动你的问题与tensorflow有什么关系?您只显示了PyTorch的代码。@BramVanroy您是对的,我本想上传一些tensorflow代码,但后来我意识到这不是必需的。@DSDS谢谢您的回答!我没有尝试,但我放弃了这个问题,转而使用谷歌Colab进行云计算,所以我想我会删除这个问题。谢谢大家!感谢您的回答,可能是因为安装NVIDIA驱动程序,它会自动安装CUDA驱动程序,正如您所看到的,它的版本与我下载的CUDA开发工具包不同。在安装过程中,有人建议不要同时安装CUDA驱动程序,所以我就这么做了。问题是,我无法从NVIDIA降级CUDA驱动程序,也无法从CUDA dk安装程序安装它们,因为它会引发一些我认为可以修复的错误,但我没有时间。我用谷歌Colab解决了所有问题,而不是我的个人笔记本电脑
tensorflow 1.13.1
tensorflow-estimator 1.13.0
pytorch-pretrained-bert 0.6.2
torch 1.1.0
torchvision 0.3.0
$ cd ~/NVIDIA_CUDA-10.0_Samples
$ make
$ cd ~/NVIDIA_CUDA-10.0_Samples/bin/x86_64/linux/release
$./deviceQuery