This warning appears when running tf, which means that your CPU can use these instruction sets to improve computing power. Officially, it can be increased by about 3 times. If it takes 8 hours to train a data set, it only takes more than 2 after using it. It was done in an hour, and the effect was still great.
First uninstall the original installed tf
pip uninstall tensorflow
Then download the source code of tf, directly
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
A new TensorFlow folder will be created in the folder where you are located.
Install bazel, which is required for compiling tensorflow.
First:
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
then you can
apt-get update
apt-get install bazel
However, it has been stuck in install for a long time, and the following errors have been appearing
dpkg: error processing archive /var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb (--unpack): trying to overwrite '/usr/lib/jvm/java-9-openjdk-amd64/include/linux/jawt_md.h', which is also in package openjdk-9-jdk-headless:amd64 9~b114-0ubuntu1
If you apt-get install XX again at this time, a prompt similar to XXX please use apt-get -f install will appear. After you use it, the prompt will still be the same. The solution:
dpkg --purge bazel
Then use the following command:
apt-get -o Dpkg::Options::="--force-overwrite" install bazel
In this way, you can see the pleasant success.
Next go to the tf folder you just git down and execute:
./config
Most of them just press Enter and the default configuration is OK, and then you can use bazel to compile a build_pip_package script. The command is as follows:
bazel build -c opt --copt=-msse3 --copt=-msse4.1 --copt=-msse4.2 --copt=-mavx //tensorflow/tools/pip_package:build_pip_package
Description: --copt=XXX If your machine also supports AVX2, you can add a --copt=-mavx2, my machine does not support it, so I didn't add it. This process is very time-consuming, and it takes about 20 minutes
to create a pip installation. Bag
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
In the /tmp/tensorflow_pkg folder is our tf installation package
pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl
The file name may be different.
Then , when running the previous tf program, this warning did not appear again, and it was much faster. These hours of source code compilation investment is still very worthwhile, haha!