Pytorch:在Linux上未检测到支持CUDA的设备

Pytorch:在Linux上未检测到支持CUDA的设备,pytorch,google-dl-platform,Pytorch,Google Dl Platform,尝试运行某些Pytorch代码时,出现以下错误: THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=74 error=38 : no CUDA-capable device is detected Traceback (most recent call last): File "demo.py", line 173, in test pca = torch.FloatTensor( np.load('../basics

尝试运行某些Pytorch代码时,出现以下错误:

THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=74 error=38 : no CUDA-capable device is detected
Traceback (most recent call last):
File "demo.py", line 173, in test
pca = torch.FloatTensor( np.load('../basics/U_lrw1.npy')[:,:6]).cuda()
RuntimeError: cuda runtime error (38) : no CUDA-capable device is detected at /pytorch/aten/src/THC/THCGeneral.cpp:74
我使用“谷歌深度学习虚拟机”运行云虚拟机 版本:tf-gpu.1-13.m25 基于:Debian GNU/Linux 9.9(扩展)(GNU/Linux 4.9.0-9-amd64 x86_64\n) Linux tf gpu可中断4.9.0-9-amd64#1 SMP Debian 4.9.168-1(2019-04-12)x86#64

环境信息:

$ nvidia-smi
Sun May 26 05:32:33 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.72       Driver Version: 410.72       CUDA Version: 10.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla K80           Off  | 00000000:00:04.0 Off |                    0 |
| N/A   42C    P0    74W / 149W |      0MiB / 11441MiB |    100%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

 $ echo $CUDA_PATH

 $ echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64:/usr/local/nccl2/lib:/usr/local/cuda/extras/CUPTI/lib64

$ env | grep CUDA
CUDA_VISIBLE_DEVICES=0

$ pip freeze
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.
7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
audioread==2.1.7
backports.functools-lru-cache==1.5
certifi==2019.3.9
chardet==3.0.4
cloudpickle==1.1.1
cycler==0.10.0
dask==1.2.2
decorator==4.4.0
dlib==19.17.0
enum34==1.1.6
filelock==3.0.12
funcsigs==1.0.2
future==0.17.1
gdown==3.8.1
idna==2.8
joblib==0.13.2
kiwisolver==1.1.0
librosa==0.6.3
llvmlite==0.28.0

我不明白你问题的主要原因。但我注意到一件事,GPUtil 100%,而没有进程在后面运行

您可以按以下方向进行尝试

  • sudo nvidia smi-下午1点
  • 它在持久化模式下启用。这可能会解决你的问题。ECC与非持久性模式的结合可以使GPU的利用率达到100%

  • 您还可以使用命令nvidia-smi-e 0禁用ECC

  • 或者最好是重新启动整个启动过程,即重新启动操作系统

  • 注意:我不确定它是否适合你。我之前也遇到过类似的问题,所以我只是根据我的经验告诉大家。
    希望这能对您有所帮助。

    torch错误消息:
    未检测到支持CUDA的设备
    告诉您当前用户没有从您闪亮的nvidia GPU进行读写的权限。默认情况下,视频卡或GPU通常由
    root
    所有。尝试使用
    sudo
    运行一次程序,或者暂时以root用户身份运行,如果问题解决了,则需要向用户添加
    video
    组,例如:
    manuseradd;用户添加-您的用户视频