您的位置:首页 > 其它

TensorFlow GPU版本安装(3):Anoconda版本安装

2017-09-29 15:32 337 查看

一 安装

已经按照tensorflow的推荐安装cuda8.0和cudnn5.1插件,下载anaconda安装文件、tensorflow gpu版本和其他python插件。使用anaconda安装原因为其本身完美集成了绝大多数常用插件,减少了很多安装麻烦,同时其本身也完美兼容tensorflow,可以在不用更改服务器已安装python版本的情况下,快速安装tensorflow。

1.1 安装conda

Sudo bash .*sh

然后重启:reboot

[root@afmdb03sz ~]# which python

/root/anaconda2/bin/python

1.2 安装tensorflow

使用conda离线安装各种包

 

Conda install –offline *.tar.bz2

同时也可以使用pip命令安装非anaconda插件,比如github上的各种RBM实现。

使用本机原始python:/usr/bin/python

安装插件到原始python:/usr/bin/pip*

二 测试程序

>> import tensorflow as tf

>>> hello = tf.constant('Hello,TensorFlow!')

>>> sess = tf.Session()

2017-08-17 10:36:38.647864: W tensorflow/core/platform/cpu_feature_guard.cc:45]The TensorFlow library wasn't compiled to use SSE4.1 instructions, bu                                                                                       t these are available
on your machine and could speed up CPUcomputations.

2017-08-17 10:36:38.647914: Wtensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn'tcompiled to use SSE4.2 instructions, bu                                                                                       t these are available
onyour machine and could speed up CPU computations.

2017-08-17 10:36:38.647930: Wtensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn'tcompiled to use AVX instructions, but t                                                                                        heseare available on
your machine and could speed up CPU computations.

2017-08-17 10:36:38.647943: Wtensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn'tcompiled to use AVX2 instructions, but                                                                                        these are available
on your machine and could speed up CPU computations.

2017-08-17 10:36:38.647955: Wtensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn'tcompiled to use FMA instructions, but t                                                                                       hese are available on
your machine and could speed up CPU computations.

2017-08-17 10:36:42.455199: Itensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 withproperties:

name: Tesla K40m

major: 3 minor: 5 memoryClockRate (GHz)0.745

pciBusID 0000:03:00.0

Total memory: 11.17GiB

Free memory: 11.10GiB

2017-08-17 10:36:42.455282: Itensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0

2017-08-17 10:36:42.455301: Itensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   Y

2017-08-17 10:36:42.455331: Itensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlowdevice (/gpu:0) -> (device: 0, name: Tesla K                                                                                       40m, pci bus id: 0000:03:00.0)

>>> sess.run(hello

... )

'Hello, TensorFlow!'

>>> a = tf.constant(10)

>>> b = tf.constant(32)

>>> sess.run(a + b)

42
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  gpu Anoconda TensorFlow