1

Whenever I run any script using Tensor Flow, I get the following warnings:

The TensorFlow library wasn't compiled to use SSE instructions, but 
these are available on your machine and could speed up CPU 
computations

I tried to follow the method posted on this stack overflow post and entered the following command on the command line:

bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --config=cuda -k //tensorflow/tools/pip_package:build_pip_package

However I get the following error

The 'build' command is only supported from within a workspace.

How do I solve this error and then make the tensor flow compile using SSE instructions

humble
  • 2,016
  • 4
  • 27
  • 36

1 Answers1

0

The Installing Tensorflow from Sources page explains the procedure pretty well, make sure you have all the requirements met before running the build step.

If you wish to automate the ./configure (tensorflow-cpu) step you can run the following command from TF's root directory:

# CPU default configuration
tensorflow/tools/ci_build/builds/configured CPU

and then run the build command with native optimization:

# build with native optimization
bazel build -c opt --copt=-march=native tensorflow/tools/pip_package:build_pip_package
sirfz
  • 4,097
  • 23
  • 37
  • I used this https://www.tensorflow.org/install/install_linux and install via pip there – humble Jun 04 '17 at 16:44
  • The compiled binary in the pip package doesn't include device-specific optimizations. To get those you need to compile from source as explained in the link in my answer. – sirfz Jun 04 '17 at 17:03
  • Would i need to uninstall tensorflow first? If so how? – humble Jun 04 '17 at 17:08
  • 1
    You just need to follow the steps and in the last step, just do `pip install -U ...` (note the extra `-U` parameter for update) instead of just `pip install` to uninstall the current version and install the new one. – sirfz Jun 04 '17 at 17:15
  • When I do ./configure, It asks for a bunch of inputs for which I am not sure what to do? Could you give a more detailed answer please – humble Jun 04 '17 at 17:55
  • The `./configure` command provides defaults that usually don't need to be modified so you can just press enter for all answers. I updated my answer to include a way to automated the configuration step for you. – sirfz Jun 04 '17 at 18:12
  • rjmessibarca: for configure questions, you can just use defaults for everything. The default option (--config=opt) will enable all optimizations on your system – Yaroslav Bulatov Jun 04 '17 at 21:20