创建新环境:
conda create -n your_name python=3.6
查看cuda版本:
nvcc --version
CUDA10.0
激活环境,安装pytorch-gpu,torchvision
在官网查找和cuda对应的版本https://pytorch.org/get-started/previous-versions/
conda activate your_name
pip install torch==1.2.0 torchvision==0.4.0
查看是否使用GPU: True即可
import torch
print(torch.cuda.is_available())
安装tensorflow-gpu
pip install tensorflow-gpu==2.0.0
查看tensorfllow是否使用gpu
import tensorflow as tf
print(tf.test.is_gpu_available())
报错, 查看cuda cudnn
发现没有安装cudnn.
cuda 版本
cat /usr/local/cuda/version.txt
cudnn 版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
卸载cuda
sudo /usr/local/cuda-10.0/bin/uninstall_cuda-10.0.pl
安装CUDA10.0
官网:https://developer.nvidia.com/cuda-10.0-download-archive
sudo sh cuda_10.0.130_410.48_linux.run
参考链接:https://blog.csdn.net/wf19930209/article/details/81879514
安装cudnn:https://blog.csdn.net/qq_39852676/article/details/98209976
cudnn官网:https://developer.nvidia.com/rdp/cudnn-archive 登录进去即可下载
cd /usr/local/cudnn7.6.4/
sudo dpkg -i libcudnn7_7.6.4.38-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.4.38-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.4.38-1+cuda10.0_amd64.deb
# 按顺序安装