1、source activate python36
2、source activate tensorflow-gpu
3、pip install tensorflow-gpu(提示安装的这个版本:tensorflow_gpu-1.12.0-cp36-cp36m-m)

4、查询GPU
from tensorflow.python.client import device_lib

def get_available_gpus():
"""
查看GPU的命令:nvidia-smi
查看被占用的情况:ps aux | grep PID
:return: GPU个数
"""
local_device_protos = device_lib.list_local_devices()
print "all: %s" % [x.name for x in local_device_protos]
print "gpu: %s" % [x.name for x in local_device_protos if x.device_type == 'GPU']

get_available_gpus()

报错提示ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory,因此需要安装cuda9

5、使用https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux下载。
命令如下:
cd /opt
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
sudo sh cuda_9.0.176_384.81_linux-run

安装位置:/usr/local/cuda-9.0
安装信息:
Linux platform:

/usr/local/cuda-#.#
Do you accept the previously read EULA?
accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n

Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]:

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y

Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
[ default is /home/adai ]:

Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...

Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...
Installing the CUDA Samples in /home/adai ...
Copying samples to /home/adai/NVIDIA_CUDA-9.0_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-9.0
Samples: Installed in /home/adai

Please make sure that
- PATH includes /usr/local/cuda-9.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_32689.log
Signal caught, cleaning up
(tensorflow-gpu) root@adailearninggpu:/opt#

6、执行步骤4测试列出GPU,这时提示:
libnvidia-fatbinaryloader.so.415.27: cannot open shared object file: No such file or directory

7、解决办法:下载https://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/415.27/NVIDIA-Linux-x86_64-415.27.run&lang=us&type=TITAN
执行:
cd /opt/
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/415.27/NVIDIA-Linux-x86_64-415.27.run
chmod 777 NVIDIA-Linux-x86_64-415.27.run
./NVIDIA-Linux-x86_64-415.27.run
如果安装失败,则sudo apt-get --purge remove nvidia-*卸载原有Nvidia驱动。

8、修改/etc/profile,添加下列到末尾,添加后执行:source /etc/profile
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/lib/nvidia-415/

9、测试第4步,成功时,会显示cpu、gpu设备。

使用Azure的GPU系列虚拟机Ubuntu-16.0.4安装GPU驱动并使用Tensorflow-GPU的过程。的更多相关文章

  1. Ubuntu 16.04 - python3 安装mysql驱动

    阿西吧,今天碰到一件特别蛋疼的事,给Ubuntu安装Python的MySQL驱动,驱动显示安装成功了 pip install mysql-connector 但是 在程序中导入,老是报错. Trace ...

  2. ubuntu 16.0.4安装MySQL5.7

    系统版本 root@sishen:~# uname -a Linux sishen 4.10.0-35-generic #39~16.04.1-Ubuntu SMP Wed Sep 13 09:02: ...

  3. [硬件配置]记录Ubuntu 14.04 下安装无线网卡驱动解决无法连接WiFi的过程

    新电脑安装了Ubuntu 14.04,但是网络连接中只有以太网而没有WiFi的选项. 打开System Setting系统设置-Software&Updates软件&更新-Additi ...

  4. Windows 10下怎么远程连接 Ubuntu 16.0.4(小白级教程)

    前言: 公司因为用Ruby做开发,所有适用了Ubuntu系统,但是自己笔记本是W10,又不想装双系统,搭建开发环境,便想到倒不如自己远程操控公司电脑,这样在家的时候也可以处理一些问题.故此便有了下面的 ...

  5. Microsoft Azure News(5) Azure新DV2系列虚拟机上线

    <Windows Azure Platform 系列文章目录> 在之前的文章中,笔者了Azure VM虚拟机,分为A系列和D系列2种 Microsoft Azure News(4) Azu ...

  6. VMware虚拟机 Ubuntu 16.04 安装

    第一步:VMware虚拟机 Ubuntu 16.04 安装 第二步: 解决窗口全屏问题 linux下给root用户设置密码 修改root用户的密码 $ sudo passwd root 密码会要求重复 ...

  7. 在 Ubuntu 16.04 中安装支持 CPU 和 GPU 的 Google TensorFlow 神经网络软件

    TensorFlow 是用于机器学习任务的开源软件.它的创建者 Google 希望提供一个强大的工具以帮助开发者探索和建立基于机器学习的应用,所以他们在去年作为开源项目发布了它.TensorFlow ...

  8. Ternsorflow 学习:000-在 Ubuntu 16.04 上安装并使用 TensorFlow_v1.14 (改)

    声明:本人已经对原文链接根据情况做出合理的改动. 本系列文章使用的是Tensorflow v1.14 引言 TensorFlow 是由谷歌构建的用于训练神经网络的开源机器学习软件.TensorFlow ...

  9. Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel

    Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel 1.MySQL安装[安装 MariaDB]MariaDB是MySQL的一个分支首 ...

  10. Ubuntu 16.04 LTS安装 TeamViewer

    Ubuntu 16.04 LTS安装 TeamViewer     64位Ubuntu 16.04系统需要添加32位架构支持,命令如下. sudo dpkg --add-architecture i3 ...

随机推荐

  1. Linux安装Tomcat-Nginx-FastDFS-Redis-Solr-集群——【第十二集之FastDFS的使用】

    (自己的项目路径)相关项目在web部分中priv.lirenhe.fastdfs 官方提供一个fastdfs开发项目,下载下来maven install 以下内容是借鉴网上的一篇文章,但是不知道网址了 ...

  2. scheduler 基本原理

    Quartz 任务调度的核心元素是 scheduler, trigger 和 job,其中 trigger 和 job 是任务调度的元数据, scheduler 是实际执行调度的控制器. 1.sche ...

  3. exporter API(导出、输出器api)moodel3.3

    Moodle[导出器]是接收数据并将其序列化为一个简单的预定义结构的类.它们确保输出的数据格式统一,易于维护.它们也用于生成外部函数的签名(参数和返回值) 外部函数定义在moodle/lib/exte ...

  4. SQL语句中单引号、双引号和反引号的区分

    反引号 反引号:反引号一般在Esc键的下方,为了区分MySQL的保留字与普通字符而引入的符号. 一般我们建表时都会将表名,库名都加上反引号来保证语句的执行度. 例如: SELECT * FROM `u ...

  5. SparkException: Could not find CoarseGrainedScheduler or it has been stopped.

    org.apache.spark.SparkException: Could not find CoarseGrainedScheduler or it has been stopped. at or ...

  6. mybatis查询语句的背后之封装数据

    转载请注明出处... 一.前言 继上一篇mybatis查询语句的背后,这一篇主要围绕着mybatis查询的后期操作,即跟数据库交互的时候.由于本人也是一边学习源码一边记录,内容难免有错误或不足之处,还 ...

  7. WCF、WebAPI、WCFREST、WebService、WPF之间的区别

    在.net平台下,有大量的技术让你创建一个HTTP服务,像Web Service,WCF,现在又出了Web API.在.net平台下,你有很多的选择来构建一个HTTP Services.我分享一下我对 ...

  8. XamarinEssentials教程设置首选项Preferences的值

    XamarinEssentials教程设置首选项Preferences的值 如果要对首选项的某一项的值进行设置时,可以通过Preferences类的Set()方法实现,该方法可以对指定键的值进行设置. ...

  9. 分布式存储MooseFS

    MooseFS 简介 http://moosefs.org/ MFS特性 安装和配置简单方便   可靠性高(数据的多个拷贝被存储在多个不同的服务器上)   通过添加新的服务器或硬盘就可以实现容量的动态 ...

  10. js发送邮件 不会调用客户端。

    方式三:使用node中nodemail 首先需要安装node的环境,然后安装nodemailer: npm install nodemailer --save npm install nodemail ...