浏览器大全:是一个提供流行浏览器教程、在线学习分享的学习平台!

ubuntu16.04 tensorflow-gpu版本安装好后,容易的检测代码

安装好cuda和 cudnn以后,我们用pip命令安装tensorflow-gpu版本(ubuntu 16.04):
sudo pip install tensorflow-gpu
 
如果是安装的tensorflow 1.3版本,那就要注意了,需要安装cuda 8.0和cudnn 6.0(重要),否则会报错:
xyxt@xyxt-System-Product-Name:~/Downloads/shangyixing$ python  
Python 2.7.12 (default, Nov 19 2016, 06:48:10)   
[GCC 5.4.0 20160609] on linux2  
Type"help","copyright","credits" or"license" for more information.  
>>> import tensorflow  
Traceback (most recent call last):  
File"", line 1, in  
File"/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in  
from tensorflow.python import *  
File"/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in  
from tensorflow.python import pywrap_tensorflow  
File"/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in  
raise ImportError(msg)  
ImportError: Traceback (most recent call last):  
File"/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in  
from tensorflow.python.pywrap_tensorflow_internal import *  
File"/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in  
_pywrap_tensorflow_internal = swig_import_helper()  
File"/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper  
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)  
ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions.  Include the entire stack trace  
above this error message when asking for help.
 
我们在检测tensorflow-gpu版本是否安装好,需要运行一个python代码进行测试,在python终端输入:
import tensorflow 
>>> import tensorflow as tf  
>>> matrix1 = tf.constant([[3., 3.]])   
>>> matrix2 = tf.constant([[2.],[2.]])  
>>> product = tf.matmul(matrix1, matrix2)   
>>> sess = tf.Session()
 
输出的信息,如果有你的显卡信息,则说明你的tensorflow GPU 版本安装成功了。
2017-10-10 17:44:46.428528: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.  
2017-10-10 17:44:46.428544: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.  
2017-10-10 17:44:46.428549: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.  
2017-10-10 17:44:46.428553: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.  
2017-10-10 17:44:46.428557: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.  
2017-10-10 17:44:46.547766: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero  
2017-10-10 17:44:46.548007: I tensorflow/core/common_runtime/gpu/gpu_device.cc:955] Found device 0 with properties:   
name: GeForce GTX 1070  
major: 6 minor: 1 memoryClockRate (GHz) 1.683  
pciBusID 0000:01:00.0  
Total memory: 7.92GiB  
Free memory: 7.43GiB  
2017-10-10 17:44:46.548020: I tensorflow/core/common_runtime/gpu/gpu_device.cc:976] DMA: 0   
2017-10-10 17:44:46.548024: I tensorflow/core/common_runtime/gpu/gpu_device.cc:986] 0:   Y   
2017-10-10 17:44:46.548029: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0)
 
参考文献
[1].【报错】ImportError: libcudnn.so.6: cannot open shared object file: No such 今更新了TensorFlow 1.3,结果运行时报ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory
看了更新日志发现,1.3版本需要cuDNN v6.0做支持了,之前是5.1,于是去Nvidia官网下载cuDNN v6.0对应的系统版本安装就好了。


相关软件

2345加速浏览器官方版

2345加速浏览器官方版 | 56.2MB

2345加速浏览器官方版

新一代2345加速浏览器采用Chromium和IE双内核,主打极速与安全特性。基于Chromium深度定制,引入网页智能预加载技术,访问网页更快速..

QQ浏览器官方正式版

QQ浏览器官方正式版 | 49.67MB

QQ浏览器官方正式版

QQ浏览器秉承TT浏览器1-4系列方便易用的特点,但技术架构不同,交互和视觉表现也重新设计,采用Chromium内核+IE双内核,让浏览快速稳定...

百度浏览器最新版下载

百度浏览器最新版下载 | 13.3MB

百度浏览器最新版下载

q百度浏览器,是一款简洁轻快、智能懂你的浏览器。依靠百度强大的搜索平台,在满足用户浏览网页的基础上,它整合百度体系业务优势,带给用户更方便的浏览方式功能...

UC浏览器官方正式版

UC浏览器官方正式版 | 44.2MB

UC浏览器官方正式版

UC浏览器(UC Browser)是UC Mobile Limited在2004年8月开发的一款软件,分uc手机浏览器和uc浏览器电脑版。UC浏览器是全球使用量最大的第三方手机浏览器...

猎豹浏览器2022最新版下载

猎豹浏览器2022下载 | 45MB

猎豹浏览器2022最新版下载

猎豹安全浏览器对Chrome的Webkit内核进行了超过100项的技术优化,访问网页速度更快。其具有首创的智能切换引擎,动态选择内核匹配不同网页...

360安全浏览器官方版下载

360安全浏览器下载 | 21.4MB

360安全浏览器官方版下载

360安全浏览器拥有全国最大的恶意网址库,采用恶意网址拦截技术,可自动拦截挂马、欺诈、网银仿冒等恶意网址。独创沙箱技术,在隔离模式即使访问****也不会感染...