当前位置:   article > 正文

cuda12.1+torch2.1.0安装_安装torch 2.1.0

安装torch 2.1.0
  1. nvidia-smi
  2. sudo apt update
  3. sudo apt install gcc g++ make
  4. sudo apt install libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev freeglut3-dev
  5. wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
  6. sudo sh cuda_12.1.0_530.30.02_linux.run
  7. ls -l /usr/local | grep cuda
  8. nvcc -V
  1. export PATH=$PATH:/usr/local/cuda-12.1/bin
  2. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.1/lib64
source ~/.bashrc

#上一步把cuda目录要加进去再刷新

cudnn是计算库,加上运行速度更快

  1. tar -xvf cudnn-linux-x86_64-8.9.6.50_cuda12-archive.tar.xz
  2. sudo cp cudnn-linux-x86_64-8.9.6.50_cuda12-archive/include/cudnn.h    /usr/local/cuda-12.1/include
  3. sudo cp cudnn-linux-x86_64-8.9.6.50_cuda12-archive/lib/libcudnn*    /usr/local/cuda-12.1/lib64
  4. sudo chmod a+r /usr/local/cuda-12.1/include/cudnn.h

#自动指令不行的情况下自己下载包安装,安装包下载地址如下:
https://download.pytorch.org/whl/torch_stable.html
 

  1. conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch
  2. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  3. pip list
  4. pip uninstall torch
  5. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  6. ls
  7. #上述自动安装失败后手动下载后安装
  8. pip install torch-2.1.0+cu121-cp38-cp38-linux_x86_64.whl
  9. pip uninstall torchvision
  10. pip install torchvision-0.16.0+cu121-cp38-cp38-linux_x86_64.whl
  1. python3
  2. import torch
  3. torch.cuda.is_available()


TRUE就大功告成
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/817647
推荐阅读
相关标签
  

闽ICP备14008679号