Compile TensorFlow from Source, rebuild TensorFlow with compiler flags, a tutorial

Published: 29 July 2023
on channel: Overthinking Tech
2,558
50

In this video I'm showing how to compile TensorFlow from source. This resolves the warning "rebuild TensorFlow with the appropriate compiler flags"
I also discuss CPU instructions and how they can make our computers faster.
Finally I compare speed to see if it is "worth" compiling from source.

Here is the python file I ran: https://cloud.overthinking.tech/s/LfR...

TensorFlow's Instructions: https://www.tensorflow.org/install/so...

Here are all the commands, copy pasta to your hearts content:
curl https://repo.anaconda.com/miniconda/M... -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
conda create --name pythontemp python=3.10
conda activate pythontemp
pip install -U --user pip numpy wheel packaging requests opt_einsum
pip install -U --user keras_preprocessing --no-deps
sudo apt install gcc g++ patchelf
git clone https://github.com/tensorflow/tensorf...
cd tensorflow
python3 configure.py
cd ..
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
sudo chmod +x /usr/local/bin/bazel
cd tensorflow
sudo bazel build -j 12 --local_ram_resources=8192 --config=opt //tensorflow/tools/pip_package:build_pip_package
sudo ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-....whl
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/jtrev/miniconda3/envs/pythontemp/bin/../lib/libstdc++.so.6

Google Doc with the commands: https://docs.google.com/document/d/1G...



0:00 Intro
0:37 Why Do This
1:15 CPU Instructions
3:34 Speed with no AVX nor SSE
4:10 Speed with all instructions
4:47 Speed with some instructions
5:44 Compile TensorFlow From Source, My Setup
7:05 Copy Pasta Time
14:29 Wait for Build
14:55 Finish Install
17:39 Up and Running!
18:29 The Speed?
19:43 Outro


On this page of the site you can watch the video online Compile TensorFlow from Source, rebuild TensorFlow with compiler flags, a tutorial with a duration of hours minute second in good quality, which was uploaded by the user Overthinking Tech 29 July 2023, share the link with friends and acquaintances, this video has already been watched 2,558 times on youtube and it was liked by 50 viewers. Enjoy your viewing!