备注: ubt 16.04 安装 gtx 1060 --- 成功运行 tensorflow - gpu

时间:2023-12-04 13:49:02

-------------------------------------------------------------------------------------------------------------------------
lspci -vnn | grep VGA -A 12 查看

hylas@hylas-System-Product-Name:~$ lspci -vnn | grep VGA -A
:00.0 VGA compatible controller []: NVIDIA Corporation Device [10de:1c03] (rev a1) (prog-if [VGA controller])
Subsystem: Device [1b4c:11d7]
Flags: bus master, fast devsel, latency , IRQ
Memory at f6000000 (-bit, non-prefetchable) [size=16M]
Memory at e0000000 (-bit, prefetchable) [size=256M]
Memory at f0000000 (-bit, prefetchable) [size=32M]
I/O ports at e000 [size=]
[virtual] Expansion ROM at f7000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_375_drm, nvidia_375 :00.1 Audio device []: NVIDIA Corporation Device [10de:10f1] (rev a1)

-------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------
安装

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia- nvidia- (当前最新)
sudo apt-get install mesa-common-dev

重启, 界面上看到 geforce gtx 1060 6gb

-------------------------------------------------------------------------------------------------------------------------

以下参考:

http://keras-cn.readthedocs.io/en/latest/for_beginners/keras_linux/#3-cudacpu

安装  tensorflow-gpu   tensorflow_gpu-1.2.1-cp27-none-linux_x86_64.whl

下载地址 : https://github.com/tensorflow/tensorflow

安装

pip install   tensorflow_gpu-1.2.-cp27-none-linux_x86_64.whl 

安装  cuda  8.0     cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb 
下载地址  : https://developer.nvidia.com/cuda-downloads
备注:  ubt 16.04 安装  gtx 1060 --- 成功运行 tensorflow - gpu

安装 :

>>> sudo dpkg -i cuda-repo-ubuntu1604---local_8.0.44-1_amd64.deb
>>> sudo apt update
>>> sudo apt install cuda

安装  cudnn  6.0    cudnn-8.0-linux-x64-v6.0-tgz

下载地址 : https://developer.nvidia.com/cudnn

>>> sudo cp include/cudnn.h /usr/local/cuda-8.0/include/
>>> sudo cp lib64/* /usr/local/cuda-8.0/lib64/

-------------------------------------------------------------------------------------------------------------------------

最后成功运行 tensorflow - gpu 

python temp.py

name: GeForce GTX  6GB
major: minor: memoryClockRate (GHz) 1.7335
pciBusID ::00.0
Total memory: .93GiB -- ::33.037446: I tensorflow/core/common_runtime/gpu/gpu_device.cc:] Creating TensorFlow device (/gpu:) -> (device: , name: GeForce GTX 6GB, pci bus id: ::00.0)
/ [==============================] - 8s - loss: 0.3241
Epoch /
/ [==============================] - 5s - loss: 0.1248
Epoch /
/ [==============================] - 13s - loss: 0.0911