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
bazel build --copt=-march=native not using available CPU instructions #7449
Comments
This command should break down the optimizations that are turned on with march=native
Are AVX/FMA optimizations in there? Also,
|
Here is the full output of that command: Key lines:
Thanks, I didn't know that about the bazel flags, I usually use cmake so I'm not super sure of the particulars of bazel. Based on what you are saying this may also have something to do with either the gcc version or how my gcc is configured/compiled and not just which flags are passed? I had assumed based on those quoted docs that everything could be detected and configured appropriately based on compiler flags alone. |
cc @martinwicke who troubleshooted (troubleshot?) similar issues in the past |
@gunan, could you take a look at this please? |
@gunan is out. I'll look. |
Maybe you have to use |
Looks like the following is a workaround according to wangyum/Anaconda#15
|
@ahundt does using just --config=opt work for you? |
@martinwicke @ahundt It works for me. The following options are enabled target specific:
|
I had this exact issue. However when I used the following to build from source the messages no longer appear. @ahundt suggestion removed a few of them however it was missing fma and avx2.
|
Dear @devfubar. Is |
@vskubriev I merely extended @ahundt suggested options from this comment Not sure what it does personally. Perhaps @ahundt could elaborate on its purpose? I have noticed it mentioned in various documents but never explained. |
I am very confused by this and I'd like to find out whether there's a problem in TF somewhere or whether some compiler (versions) don't properly interpret Can someone who built with |
I just tried the following, and I was able to build an optimized binary:
So I will close this issue as not reproducible. |
@ahundt I think this could have more to do more with your gcc than bazel. IE, it seems as if you run |
@gunan I'm not sure closing this is appropriate as there is obviously an issue for some people, maybe not for you but others. I'm pretty sure I could half my issue inbox if I just tried something and then said I couldn't reproduce. Not exactly diligent behaviour. |
My hunch is that this is some kind of gcc/bazel interaction for a configuration that's not available/common inside Google, so "community support" label seems appropriate |
@yaroslavvb thanks for re-opening.
|
Thanks @devfubar. You said earlier, it works for you when building with
correct? In that case, can you paste the contents of your |
@martinwicke yes that is the command I used to stop the warning messages.
|
Interesting I have the same gcc version. Perhaps I should confirm that tf and bazel are completely on the 1.0 release version.
|
@devfubar Sorry for preemptively closing the issue with little information. I tested our build instructions on all our supported platforms. @ahundt After looking at what you are running, I think you are not installing the TF you just built. In the above script, could you remove line 75
and try again? |
Hi @gunan So I created a brand new vanilla ubuntu machine to do some testing over the weekend with mixed results. First time I did not get the warning messages but on a second clean machine I did. I am just trying to narrow in on what exactly I did to either get the messages or what I did to not get them. |
This worked for me! In my case this is resolved. Sorry that it ended up being a bug in my installation procedure and thus I was encountering something that was already fixed. Thanks! |
@ahundt Thanks for the feedback. I am glad the issue is resolved for you. @devfubar I highly suspect you are also having a problem with installing the correct pip package after you build it. Please try the following commands to build and run TF.
After running the above script without any modifications if you still see the warning messages I can continue investigating. But at the moment, I am convinced that there are no issues in TF. |
Closing this. Thanks for the sleuthing, @gunan! |
(of course and as always, comment to reopen) |
*argument unused during compilation : '-march=native' *tells me your
compiler (what is your compiler?) does not like -march=native. What is the
compiler you are using?
…On Fri, Jul 7, 2017 at 6:02 PM, TethysSun ***@***.***> wrote:
@martinwicke <https://github.com/martinwicke> Hi, I have the same problem
when I was trying to install it on Mac OS.
When./configure, I used the default -march=native. However, the warning “*argument
unused during compilation : '-march=native'* “shows up when calling bazel
build with --config=opt. Do you know why does that happen?
I also tried suggestions in #7778
<#7778> by using sudo
bazel build --config opt --copt=-msse4.1 --copt=-msse4.1 --copt=-mavx
--copt=-mavx2 --copt=-mfma //tensorflow/tools/pip_
package:build_pip_package , but after building, "*The TensorFlow library
wasn't compiled to use SSE instructions*" still appears when running the
helloTensorflow.
And bazel build --linkopt='-lrt' -c opt --copt=-mavx --copt=-msse4.2
--copt=-msse4.1 --copt=-msse3 --copt=-mavx2 --copt=-mfma -k
//tensorflow/tools/pip_package:build_pip_packaged suggested by @devfubar
<https://github.com/devfubar> and suggested wheels from
https://github.com/yaroslavvb/tensorflow-community-wheels <http://url>
doesn't work for me too.
And tried bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma
--copt=-msse4.1 --copt=-msse4.2 //tensorflow/tools/pip_
package:build_pip_package as suggested in https://stackoverflow.com/
questions/41293077/how-to-compile-tensorflow-with-sse4-
2-and-avx-instructions <http://url>.
It took me a long time to uninstall, reinstall and rebuilding from source,
unfortunately I don't find the answer for me yet. For The rest steps when
installing from source, I followed the official instruction
https://www.tensorflow.org/install/install_sources here.
Any idea what's wrong?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7449 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjO_TDUkcGNZp4PGxjejEWCRKDe2RRLks5sLlaWgaJpZM4L-Zzg>
.
|
At the end, I get that:
|
You have to add the |
Wow it works, but I still get |
@Emixam23 you have to compile yourself, or use one of the pre-built optimized versions (ie, from https://github.com/yaroslavvb/tensorflow-community-wheels) |
I already compiled it, that's why the warnings went away. But I got a new one, that's why I'm confused :/ |
see the same kind of issue on SKX if I use -march=native during configure 2004 git clone https://github.com/tensorflow/tensorflow |
When you add
However, this will almost surely fail because there are known compilation issues with avx512+TF. You may need to debug and fix your build to get it working. |
Otherwise an already installed version will not be installed over, causing confusion, for example tensorflow/tensorflow#7449
Update 2017-12-06:
The current version of my tensorflow.sh install script has been working well for me, and the update from tf 1.3 to tf 1.4 required only a one character change!
Original Post:
Here are the key lines in my install script with a quote from the tensorflow docs:
Even with
--copt=-march=native
I get the following warnings about the CPU instruction set, contradicting the above statement:Here is the exact script I used to build tensorflow:
https://github.com/ahundt/robotics_setup/blob/b5ee71f262ec36f8dbc8374ed2503c0812fb0f47/tensorflow.sh
What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?
http://stackoverflow.com/a/41520266/99379
Operating System:
Ubuntu 16.04
python -c "import tensorflow; print(tensorflow.__version__)"
.If installed from source, provide
The commit hash (
git rev-parse HEAD
)07bb8ea
The output of
bazel version
If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)
What other attempted solutions have you tried?
This person tried some other things: http://stackoverflow.com/a/41520266/99379
The text was updated successfully, but these errors were encountered: