其实在ubuntu16.04中安装tensorflow-gpu时十分简单的,主要有三个步骤
一、安装GPU私有驱动
1. 关闭UEFI BIOS中的”安全启动“
2. 在ubuntu中的”软件更新”--“附加驱动”安装私有驱动
二、安装cuda及其依赖
这里安装十分简单,tensorflow官网提供了简单的安装发法--官方教程。在终端执行一下命令:
# Add NVIDIA package repository
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.debsudo apt install ./cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt update
# Install CUDA and tools. Include optional NCCL 2.x
sudo apt install cuda9.0 cuda-cublas-9-0 cuda-cufft-9-0 cuda-curand-9-0 \cuda-cusolver-9-0 cuda-cusparse-9-0 libcudnn7=7.2.1.38-1+cuda9.0 \libnccl2=2.2.13-1+cuda9.0 cuda-command-line-tools-9-0
# Optional: Install the TensorRT runtime (must be after CUDA install)
sudo apt updatesudo apt install libnvinfer4=4.1.2-1+cuda9.0
三、安装tensorflow-gpu
这是通过pip或者anaconda安装tensorflow-gpu即可,如果在测试tensorflow时出现错误可能时私有驱动版本太低与cuda不兼容,安装高版本即可。
网友评论