PyTorch 和 CUDA 驱动程序 [英] PyTorch and CUDA driver

查看:28
本文介绍了PyTorch 和 CUDA 驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 CUDA 9.2.例如:

(base) c:>nvcc --versionnvcc:NVIDIA (R) Cuda 编译器驱动程序版权所有 (c) 2005-2018 NVIDIA Corporation建立于 Wed_Apr_11_23:16:30_Central_Daylight_Time_2018Cuda编译工具,发布9.2,V9.2.88

我使用以下方法在 Windows 10 上安装了 PyTorch:

conda install pytorch cuda92 -c pytorchpip3 安装火炬视觉

我运行了测试脚本:

(base) c:>pythonPython 3.6.5 |Anaconda 自定义(64 位)|(默认,2018 年 3 月 29 日,13:32:41)[MSC v.1900 64 位 (AMD64)] 在 win32 上输入帮助"、版权"、信用"或许可证"以获取更多信息.>>>从 __future__ 导入 print_function>>>进口火炬>>>x = 火炬.rand(5, 3)>>>打印(x)张量([[0.7041, 0.5685, 0.4036],[0.3089, 0.5286, 0.3245],[0.3504, 0.8638, 0.1118],[0.6517, 0.9209, 0.6801],[0.0315, 0.1923, 0.8720]])>>>退出()

所以,太好了.然后我跑了:

(base) c:>pythonPython 3.6.5 |Anaconda 自定义(64 位)|(默认,2018 年 3 月 29 日,13:32:41)[MSC v.1900 64 位 (AMD64)] 在 win32 上输入帮助"、版权"、信用"或许可证"以获取更多信息.>>>进口火炬>>>torch.cuda.is_available()错误的>>>

为什么 PyTorch 说 CUDA 不可用?

GPU 是具有计算能力的 3.0 Quadro K3000M:

(base) C:Program FilesNVIDIA CorporationNVSMI>nvidia-smi.exe2018 年 10 月 1 日星期一 16:36:47NVIDIA-SMI 385.54 驱动程序版本:385.54-------------------------------+--------------------+------------GPU 名称 TCC/WDDM |Bus-Id Disp.A |挥发性未校正.ECC 风扇温度性能 Pwr:Usage/Cap|内存使用 |GPU-Util 计算 M.0 Quadro K3000M WDDM |00000000:01:00.0 关闭 |不适用 不适用 35C P0 不适用/不适用 |29MiB/2048MiB |0% 默认

解决方案

自从 https://github.com/pytorch/pytorch/releases/tag/v0.3.1,PyTorch 二进制版本已删除对具有 CUDA 功能 3.0 的旧 GPU 的支持.根据 https://en.wikipedia.org/wiki/CUDA,计算能力Quadro K3000M 是 3.0.

因此,您可能需要从源代码构建 pytorch 或尝试其他软件包.请参阅此线程以获取更多信息 -- https://discuss.pytorch.org/t/pytorch-no-longer-supports-this-gpu-because-it-is-too-old/13803.>

I have CUDA 9.2 installed. For example:

(base) c:>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Wed_Apr_11_23:16:30_Central_Daylight_Time_2018
Cuda compilation tools, release 9.2, V9.2.88

I installed PyTorch on Windows 10 using:

conda install pytorch cuda92 -c pytorch
pip3 install torchvision

I ran the test script:

(base) c:>python
Python 3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import print_function
>>> import torch
>>> x = torch.rand(5, 3)
>>> print(x)
tensor([[0.7041, 0.5685, 0.4036],
        [0.3089, 0.5286, 0.3245],
        [0.3504, 0.8638, 0.1118],
        [0.6517, 0.9209, 0.6801],
        [0.0315, 0.1923, 0.8720]])
>>> quit()

So for, so good. Then I ran:

(base) c:>python
Python 3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False
>>>

Why did PyTorch say CUDA was not available?

The GPU is a compute capability 3.0 Quadro K3000M:

(base) C:Program FilesNVIDIA CorporationNVSMI>nvidia-smi.exe 

Mon Oct 01 16:36:47 2018 
NVIDIA-SMI 385.54 Driver Version: 385.54 
-------------------------------+----------------------+---------------------- 
GPU Name TCC/WDDM              | Bus-Id Disp.A        | Volatile Uncorr. 
ECC Fan Temp Perf Pwr:Usage/Cap| Memory-Usage         | GPU-Util Compute M. 
0 Quadro K3000M WDDM           | 00000000:01:00.0 Off | 
N/A N/A 35C  P0 N/A / N/A      | 29MiB / 2048MiB      | 0% Default 

解决方案

Ever since https://github.com/pytorch/pytorch/releases/tag/v0.3.1, PyTorch binary releases had removed support for old GPUs' with CUDA capability 3.0. According to https://en.wikipedia.org/wiki/CUDA, the compute capability of Quadro K3000M is 3.0.

Therefore, you might have to build pytorch from source or try other packages. Please refer to this thread for more information -- https://discuss.pytorch.org/t/pytorch-no-longer-supports-this-gpu-because-it-is-too-old/13803.

这篇关于PyTorch 和 CUDA 驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆