Last active
July 16, 2023 13:58
-
-
Save berndporr/2770205fd0c60d0a9026220ff2fcca6a to your computer and use it in GitHub Desktop.
Tensorflow compiling from source with GPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling TensorFlow v2.13.0 from source: | |
This is in conjunction with https://www.tensorflow.org/install/source but fills the gaps! | |
Install Bazel 5.3.0 | |
Install the cuda toolkit v11.8 and get rid of any other cuda toolkits. Otherwise TF will find them and create chaos. | |
apt install cuda-toolkit-11-8 | |
Install cudnn 8.7 (TF recommends 8.6 but 8.7 also works well): | |
apt-get install libcudnn8-dev=8.7.0.84-1+cuda11.8 libcudnn8=8.7.0.84-1+cuda11.8 | |
apt-mark hold libcudnn8-dev=8.7.0.84-1+cuda11.8 libcudnn8=8.7.0.84-1+cuda11.8 | |
apt install patchelf | |
pip install --upgrade protobuf | |
lspci | grep VGA | |
Get the compute capability of the card here: https://developer.nvidia.com/cuda-gpus | |
for example 6.1 | |
./configure | |
[ anything default except below ] | |
Do you wish to build TensorFlow with CUDA support? [y/N]: y | |
Please specify a list of comma-separated CUDA compute capabilities you want to build with. | |
[Default is: 3.5,7.0]: 6.1 | |
bazel build --local_ram_resources=2048 //tensorflow/tools/pip_package:build_pip_package | |
./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg | |
sudo pip install /tmp/tensorflow_pkg/tensorflow-2.13.0-cp310-cp310-linux_x86_64.whl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment