Skip to content

Instantly share code, notes, and snippets.

@tosiara
Last active April 5, 2023 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tosiara/64fa09ded8d2785557bdcc1d4d1387d6 to your computer and use it in GitHub Desktop.
Save tosiara/64fa09ded8d2785557bdcc1d4d1387d6 to your computer and use it in GitHub Desktop.
Build tensorflow without cpu optimizations
apt-get update
apt install apt-transport-https curl gnupg patchelf -y
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list

apt-get update
apt-get install bazel=5.3.0

apt install python3-dev python3-pip
pip install -U --user pip numpy wheel packaging requests opt_einsum
pip install -U --user keras_preprocessing --no-deps

apt-get install wget
wget "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.1.zip"
unzip v2.11.1.zip 

cd tensorflow-2.11.1/
./configure
bazel build -c opt --copt="-mtune=generic" --copt="-march=x86-64" //tensorflow/tools/pip_package:build_pip_package
./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

pip install numpy==1.23.1
@tosiara
Copy link
Author

tosiara commented Apr 5, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment