关于前端:ubuntu搭建GPU-pytorch版本

装置显卡驱动

禁止集成的nouveau驱动

vim /etc/modprobe.d/blacklist.conf

#增加几行
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist nvidiafb

#执行
update-initramfs -u
reboot

#重启后执行
lsmod | grep nouveau

#没有显示阐明曾经禁用

开始装置

#装置必要
apt-get update
apt-get install gcc g++ make -y

#依照提醒进行装置
bash NVIDIA-Linux-x86_64-440.31.run

#装置后执行,能够查看gpu状态
nvidia-smi 

#查看gpu的驱动版本
cat /proc/driver/nvidia/version

Anaconda

  • 下载Anaconda, 如果在国内的话倡议应用国内的mirror下载, https://mirrors.tuna.tsinghua… 清华镜像源的镜像,找到对应的版本进行下载.

    wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh
    bash Anaconda3-5.3.1-Linux-x86_64.sh
  • 依照提醒进行装置
  • 失效环境变量

    source ~/.bashrc
  • 换清华镜像源

      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
      conda config --set show_channel_urls yes
  • 创立一个name为pytorh python版本为3.7的虚拟环境。

      conda create -n pytorch python=3.7
      #切入环境
      source activate pytorch

pytroch

配置好conda环境后就,pytorch就能够顺利装置了。

此处不能依照官网进行装置conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

#须要去掉-c torch后,能够从清华镜像疾速下载。
conda install pytorch torchvision cudatoolkit=10.1

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理