美文网首页
cuda和pytorch的安装

cuda和pytorch的安装

作者: 秦汉邮侠 | 来源:发表于2023-03-17 19:17 被阅读0次

    1,查看显卡支持的cuda的最新版本

    PS C:\Users\Frank> nvidia-smi
    Sat Mar 18 16:44:59 2023
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 527.37       Driver Version: 527.37       CUDA Version: 12.0     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0 Off |                  N/A |
    | N/A   47C    P0    15W /  N/A |      0MiB /  4096MiB |      0%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    |  No running processes found                                                 |
    +-----------------------------------------------------------------------------+
    

    2, 选择Pytorch的版本和与之兼容的cuda版本

    历史版本:https://pytorch.org/get-started/previous-versions/
    最新版本:https://pytorch.org/get-started/locally/#windows-pip

    # CUDA 11.7
    pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
    

    3, 安装cuda 11.7工具包

    下载路径:https://developer.nvidia.com/cuda-toolkit-archive
    选择:https://developer.nvidia.com/cuda-11-7-0-download-archive?target_os=Windows&target_arch=x86_64

    4, 验证

    PS C:\Users\Frank> python
    Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import torch
    >>> torch.version.cuda
    '11.7'
    >>> torch.cuda.is_available()
    True
    >>>
    

    相关文章

      网友评论

          本文标题:cuda和pytorch的安装

          本文链接:https://www.haomeiwen.com/subject/faijrdtx.html