-
Notifications
You must be signed in to change notification settings - Fork 74.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations" in "Hello, TensorFlow!" program #7778
Comments
Those are simply warnings. They are just informing you if you build TensorFlow from source it can be faster on your machine. Those instructions are not enabled by default on the builds available I think to be compatible with more CPUs as possible. edit: To deactivate these warnings as @yaroslavvb suggested in another comment, do the following:
or if you're on a Unix system simply do
|
Thanks Camezim ! |
@bingq the best way I found to kill unwanted TF output: run your script as
You can add extra |
@Carmezim Any estimate of how much faster when compiling from source using advanced CPU instructions? Any reason to do this at all when running most of the graph on a GPU? |
@tomrunia I haven't tested myself yet (actually am building it now with SSE) although heard 4-8x. If @yaroslavvb wants to chime in as he himself got 3x speed improvement. |
Yup, 3x for large matrix multiply on Xeon-V3, I expect it's probably due to FMA/AVX rather than SSE |
@tomrunia Well pointed by @yaroslavvb, not SSE specifically in his case although those CPU instructions are expected to provide performance improvement |
It would be very nice to silence these warnings from the Python side, it's not so easy to use grep from Windows. |
Try export TF_CPP_MIN_LOG_LEVEL=2 |
Thanks @yaroslavvb, I haven't tried it yet but an environment variable is definitely more useful. |
It works, thank you |
Is it possible that these errors are coming from the fact that with MSVC, x64, SSE2 is implicit (all x64 chips have SSE2) but the |
Could you say what should I exactly do according to your idea? What does "guards on" mean? |
The SSE warnings use code like this: #ifndef __SSE__
WarnIfFeatureUnused(CPUFeature::SSE, "SSE");
#endif // __SSE__
#ifndef __SSE2__
WarnIfFeatureUnused(CPUFeature::SSE2, "SSE2");
#endif // __SSE2__ But the Eigen imeplementation (eigen/Eigen/Core) uses more complicated logic to work out whether to use SSS1/2: #ifndef EIGEN_DONT_VECTORIZE
#if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
// Defines symbols for compile-time detection of which instructions are
// used.
// EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used
#define EIGEN_VECTORIZE
#define EIGEN_VECTORIZE_SSE
#define EIGEN_VECTORIZE_SSE2
// Detect sse3/ssse3/sse4:
// gcc and icc defines __SSE3__, ...
// there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you
// want to force the use of those instructions with msvc.
#ifdef __SSE3__
#define EIGEN_VECTORIZE_SSE3
#endif
#ifdef __SSSE3__
#define EIGEN_VECTORIZE_SSSE3
#endif
#ifdef __SSE4_1__
#define EIGEN_VECTORIZE_SSE4_1
#endif
#ifdef __SSE4_2__
#define EIGEN_VECTORIZE_SSE4_2
#endif
#ifdef __AVX__
#define EIGEN_VECTORIZE_AVX
#define EIGEN_VECTORIZE_SSE3
#define EIGEN_VECTORIZE_SSSE3
#define EIGEN_VECTORIZE_SSE4_1
#define EIGEN_VECTORIZE_SSE4_2
#endif Due mainly to the fact Visual Studio assumes SSE1/SSE2 when compiling for x64. So one solution would be to #include eigen/Eigen/Core and use the "EIGEN_VECTORIZE_SSE" symbols in the conditional code-guard (" I'm also not sure what is the right thing to do if building a binary for distribution. Do you include AVX and risk it not running, or do you not include it and risk the warning (and low performance)? Ideally you would build with full vectorization and let the software choose at runtime. I guess another possibility would be to build 2 dlls, and dynamically load the right one at runtime. |
You can try this post and tell me if it really becomes faster. |
@Juanlu001 Check this comment for how this variable works and @yaroslavvb's code below for a handy way to change it. |
Thanks @Carmezim |
@hughsando, these are in fact the debates we had internally. Ideally in the future we'd be able to ship all compiled versions and choose at runtime, but logistically that's actually quite time consuming and tricky to implement. We are looking into it, but this was the best solution we had for now. We wanted people to know that if they have that warning, things are working, but it could be faster if you build it yourself. I.e. if you benchmarking our system, it's not a valid benchmark w/o compiling it with the best optimizations. |
@hughsando PS people have been uploading wheels built for their favorite configuration to https://github.com/yaroslavvb/tensorflow-community-wheels |
I wonder if a solution to this problem might to to treat the cpu
architectures as different processors, like "cpu", "gpu", "cpu-avx". Then
the kernels can register multiple versions, and the runtime can choose
where to run depending on the client machine.
This could be done for the main "hot" inference functions (eg, Conv2D), and
the deployment problem would largely go away.
Custom builds for training is not so difficult to manage - the community
wheels look like a good idea.
…On Sun, Apr 2, 2017 at 10:43 PM, Yaroslav Bulatov ***@***.***> wrote:
@hughsando <https://github.com/hughsando> PS people have been uploading
wheels built for their favorite configuration to
https://github.com/yaroslavvb/tensorflow-community-wheels
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7778 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABlp1q-aGPy-lna8-2DLAo7xGrl04_3Wks5rr7P9gaJpZM4MIq5A>
.
|
@hughsando, in spirit that is the idea we would like to pursue. However, it is more difficult than that in that we use Eigen for a lot of the implementations of kernels. Eigen would have to be compiled multiple ways without causing any symbol conflicts int the final binary, and also we would probably have to break up modules into more dsos so as not to have too large of a binary resident. |
So after reading these, I went ahead and reinstalled, this time from Source following instructions on https://www.tensorflow.org/install/install_sources. I still see the "The TensorFlow library wasn't compiled to to use XXXX instructions..." warnings. So did I miss something or is installing from source and building is not what you meant by "building it yourself"? |
What did you put for the compiler optimization options ./configure asked you)? and what are the remaining warnings it shows you? Are you running the binary on the same machine you compiled it on? |
Thank you aselle, my problem is solved now but here is what happened:
However, after reading your message, I changed my bazel build command from |
Just as a matter of interest: How comes, these warnings were not present in Tensorflow 1.0.1 but only in newer version Tensorflow 1.1.0? |
Not quite sure what you mean, I am using the binaries from PIP for TF 1.0.1, and the warnings have been there already. |
Aha... then maybe my cached wheel of TF 1.0.1 was somehow different. It displayed some warnings regarding OpKernels but no warnings regarding SSE instructions. |
@jshin49 and others who have tried it |
No performance improvements here, when activating AVX, but probably because I was building and using the GPU-version. I thought it would speed up some parts at least, but I didn't find it to make a big impact. Probably when using the CPU-version it does make an impact. |
Single Instruction Multiple Data makes sense when you perform vector computations on the CPU. Thanks for the build-command examples. |
@apacha you should uninstall tensorflow and then reinstall again to kill the OpKernels warnings |
If I do
any thoughts why this happening? |
I am also getting this Warning while using tensorflow api ' s in java,I have no idea why i am getting this.Any idea to resolve this warning! |
if you want to disable them, you may use the code below
this should silence the warnings. 'TF_CPP_MIN_LOG_LEVEL' represents the Tensorflow environment variable responsible for logging. Also if you are on Ubuntu you may use this code below
I hope this helps. |
@Carmezim If I compute with GPU, will I got this warning? |
Yes. You will still get the warning, even if you install and run the GPU-version. Because this warning come from CPU, when your operation run on CPU and can be speed up by SSE. I think you can ignore these warnings if you are not so concern with speed. If you do want go faster, you need install tensorflow from source to optimize tensorflow for some specific instruction set.
The easiest way of check if tensorflow run on CPU or GPU is open a resource manager for GPU or CPU (ps, nvidia-smi) to check loading when you run your training.
You can also log the device placement ( config=tf.ConfigProto(log_device_placement=True) ), or use tensorboard to check it.
From: [email protected] [mailto:[email protected]] On Behalf Of g10guang
Sent: Thursday, August 31, 2017 12:39 PM
To: tensorflow/tensorflow <[email protected]>
Cc: Subscribed <[email protected]>
Subject: Re: [tensorflow/tensorflow] "The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations" in "Hello, TensorFlow!" program (#7778)
@Carmezim <https://github.com/carmezim> If I compute with GPU, will I got this warning?
And how to know if tensorflow run with GPU or CPU?
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#7778 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AFFDdqPYNDB7QseUwJ6eNtkU1oR_0t9Tks5sdjjagaJpZM4MIq5A> . <https://github.com/notifications/beacon/AFFDdkhWIJERtKgV7ARwVUhuVRDlxEGbks5sdjjagaJpZM4MIq5A.gif>
|
@g10guang Yeah, TF can use both CPU and GPU but even if you're using GPU only it will inform you of the SIMD instructions available when you run the code. To know in which device TF is running you can set You can see more details on this under Logging Device placement in the documentation. |
Thanks @Carmezim ! |
I am getting the same warning while using tensorflow_gpu 1.1.0 on win10, the version of Python is 3.6.3 installed in Anaconda. Here is my warnings:
Another question: Thanks a lot. |
Instead of removing the warning is there any way to use those SSE instructions to speed up the training |
@gknight7 |
Opening this with reference to #7500.
Installed TensorFlow 1.0 with reference to https://www.tensorflow.org/install/install_windows on Windows 10 and hit the same issue discussed in #7500. With applying the solution suggested in that thread, the original issue disappeared but got the new warnings:
C:\Users\geldqb>python
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
The text was updated successfully, but these errors were encountered: