我是TensorFlow的新手.我最近安装了它(Windows CPU版本)并收到以下消息:
成功安装了tensorflow-1.4.0 tensorflow-tensorboard-0.4.0rc2
然后,当我试图跑
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
sess.run(hello)
'Hello, TensorFlow!'
a = tf.constant(10)
b = tf.constant(32)
sess.run(a + b)
42
sess.close()
Run Code Online (Sandbox Code Playgroud)
(我通过https://github.com/tensorflow/tensorflow找到)
我收到以下消息:
2017-11-02 01:56:21.698935:IC:\ tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137]你的CPU支持这个说明TensorFlow二进制文件未编译使用:AVX AVX2
但是当我跑的时候
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Run Code Online (Sandbox Code Playgroud)
它运行应该和输出Hello, TensorFlow!,这表明安装确实成功,但还有其他错误.
你知道问题是什么以及如何解决它?谢谢.
我是第一次运行TensorFlow并使用一些示例代码.运行我的代码时出现此错误.有谁知道为什么会这样,以及如何解决它?谢谢!
2017-03-31 02:12:59.346109: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346968: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346975: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow libbrary wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 …Run Code Online (Sandbox Code Playgroud) 我试图在我的Chromebook上获取TensorFlow,而不是最好的地方,我知道,但我只是想了解它.我没有在Python开发环境中做过很多工作,或者在任何开发环境中做过很多工作,所以请耐心等待.找出pip之后,我安装了TensorFlow并尝试导入它,收到此错误:
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2018-12-11 06:09:54.960546: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)
经过一些研究,我发现我的处理器(Intel Celeron N2840(Bay Trail-M架构))不支持AVX指令,所以我想知道是否有办法使用为其他指令集编译的版本.Cog告诉我,我可以使用MMX和各种SSE(无论这意味着什么).
PS这是在Linux上使用AVX指令时TensorFlow错误的重复,而在同一台机器上运行Windows但不完全.另外我不能发表评论,因为我没有50个声望.
PPS我看了如何使用SSE4.2和AVX指令编译Tensorflow?并且害怕
我尝试从pip安装:
pip3 install --user --no-cache https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl
Run Code Online (Sandbox Code Playgroud)
然后尝试导入并得到:
Using TensorFlow backend.
/usr/lib64/python3.6/importlib/_bootstrap.py:205: RuntimeWarning:
compiletime version 3.5 of module
'tensorflow.python.framework.fast_tensor_util' does not match runtime
version 3.6
return f(*args, **kwds)
2017-11-10 09:35:01.206112: I
tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports
instructions that this TensorFlow binary was not compiled to use: SSE4.1
SSE4.2 AVX
Run Code Online (Sandbox Code Playgroud)
问题:
我不明白为什么轮子说3.6,但我得到关于3.5的警告
我想编译为我的CPU优化,所以我可以使用pip从源而不是从二进制轮安装?
我使用以下命令在Windows 7 SP1 x64 Ultimate(Python 3.5.2 | Anaconda自定义(64位))上安装了TensorFlow版本1.0.0-rc2:
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Run Code Online (Sandbox Code Playgroud)
当我尝试在Eclipse 4.5或控制台中运行https://web.archive.org/web/20170214034751/https://www.tensorflow.org/get_started/os_setup#test_the_tensorflow_installation中的测试脚本时:
import tensorflow as tf
print('TensorFlow version: {0}'.format(tf.__version__))
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Run Code Online (Sandbox Code Playgroud)
我收到一些错误消息:
TensorFlow version: 1.0.0-rc2
'Hello, TensorFlow!'
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflob
w\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown …Run Code Online (Sandbox Code Playgroud) 有这个相关的问题:海湾合作委员会:游行与mtune有何不同?
但是,现有答案并没有比GCC手册本身更进一步.我们最多得到:
如果您使用
-mtune,那么编译器将生成适用于其中任何一个的代码,但将支持在您指定的特定CPU上运行速度最快的指令序列.
和
该
-mtune=Y选项调整生成的代码以在Y上运行得比在其可能运行的其他CPU上运行得更快.
但是GCC 如何支持一个特定的体系结构,在构建时,同时仍然能够在其他(通常是较旧的)体系结构上运行构建,虽然速度较慢?
我只知道有一件事(但我不是计算机科学家)才能做到这一点,而且那是一个CPU调度员.但是,(对我来说)似乎并不是mtune在幕后生成调度程序,而是其他一些机制可能正在生效.
我觉得这样做有两个原因:
mtune)并测试cpuid在运行时检测支持的指令,而不是依赖于在构建时提供的命名体系结构.那么它如何运作呢?
optimization gcc instruction-set cpu-architecture instructions
我正在寻找一种方法来设置或修改现有的Docker镜像,以安装将安装它的张量流,以便SSE4,AVX,AVX2和FMA指令可用于CPU加速.到目前为止,我已经找到了如何从源使用巴泽勒安装如何编译Tensorflow ...和CPU指令不编译.......这些都没有解释如何在Docker中执行此操作.所以我认为我正在寻找的是你需要添加到没有这些选项的现有docker镜像,以便在启用CPU选项的情况下获得tensorflow的编译版本.现有的docker镜像不会这样做,因为他们希望图像在尽可能多的机器上运行.我在linux PC上使用Ubuntu 14.04.我是docker的新手,但是已经安装了tensorflow并让它工作而没有得到我在使用docker镜像时得到的CPU警告.我可能不需要这个速度,但我看到声称加速的帖子可能很重要.我搜索了现有的docker图像,这样做并找不到任何东西.我需要这个与gpu一起工作,所以需要与nvidia-docker兼容.
我刚刚发现这个docker支持bazel,它可能会提供一个答案,但我不太清楚它是否足够清楚.我相信这是说你不能在Dockerfile中用bazel构建张量流.你必须使用bazel构建一个Dockerfile.我的理解是否正确,这是从源代码编译的tensorflow获取docker镜像的唯一方法吗?如果是这样,我仍然可以使用帮助来完成它,并且如果使用现有的docker图像进行张量流动,我仍然可以获得其他依赖项.
MacBook Air:OSX El Capitan
当我在terminal(python 3 tfpractice.py)中运行TensorFlow代码时,我得到一个比正常更长的等待时间来返回输出,然后是这些错误消息:
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.
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.
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 …
随着最新版本的Tensor Flow现在在Windows上,我试图尽可能高效地运行一切.但是,即使从源代码编译,我仍然无法弄清楚如何启用SSE和AVX指令.
默认进程:https: //github.com/tensorflow/tensorflow/tree/r0.12/tensorflow/contrib/cmake 没有提到如何执行此操作.
我发现的唯一参考是使用Google的Bazel: 如何使用SSE4.2和AVX指令编译Tensorflow?
有没有人知道使用MSBuild打开这些高级指令的简单方法?我听说他们至少加速了3倍.
为了帮助那些寻找类似解决方案的人,这是我目前得到的警告:https: //github.com/tensorflow/tensorflow/tree/r0.12/tensorflow/contrib/cmake
我在64位平台上使用Windows 10 Professional,Visual Studio 2015社区版,带有cmake版本3.6.3的Anaconda Python 3.6(更高版本不适用于Tensor Flow)
任何帮助赞赏!
tensorflow ×9
python ×5
cpu ×3
avx ×2
docker ×2
python-3.x ×2
c++ ×1
gcc ×1
instructions ×1
linux ×1
msbuild ×1
nvidia ×1
optimization ×1
pip ×1
sse4 ×1
terminal ×1
windows ×1