赞
踩
- nvidia-smi
- sudo apt update
- sudo apt install gcc g++ make
- sudo apt install libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev freeglut3-dev
- wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
- sudo sh cuda_12.1.0_530.30.02_linux.run
- ls -l /usr/local | grep cuda
- nvcc -V
- export PATH=$PATH:/usr/local/cuda-12.1/bin
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.1/lib64
source ~/.bashrc
#上一步把cuda目录要加进去再刷新
cudnn是计算库,加上运行速度更快
- tar -xvf cudnn-linux-x86_64-8.9.6.50_cuda12-archive.tar.xz
- sudo cp cudnn-linux-x86_64-8.9.6.50_cuda12-archive/include/cudnn.h /usr/local/cuda-12.1/include
- sudo cp cudnn-linux-x86_64-8.9.6.50_cuda12-archive/lib/libcudnn* /usr/local/cuda-12.1/lib64
- sudo chmod a+r /usr/local/cuda-12.1/include/cudnn.h
#自动指令不行的情况下自己下载包安装,安装包下载地址如下:
https://download.pytorch.org/whl/torch_stable.html
- conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch
- pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
- pip list
- pip uninstall torch
- pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
- ls
- #上述自动安装失败后手动下载后安装
- pip install torch-2.1.0+cu121-cp38-cp38-linux_x86_64.whl
- pip uninstall torchvision
- pip install torchvision-0.16.0+cu121-cp38-cp38-linux_x86_64.whl
- python3
- import torch
- torch.cuda.is_available()
TRUE就大功告成
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。