How to Build TensorFlow with GPU Support
The following is an excerpt of the official TensorFlow installation instructions.
TensorFlow Configuration
All the steps below require these configuration steps. Make sure you run them prior.
TensorFlow Dependencies
sudo apt install git wget unzip python3 curl build-essential zlib1g-dev python3-numpy python3-six # Some TF tools assume python is pointing to python3 # This uses the update-alternative util to do so. Caution, # verify you don't have an alternative already configured # by running "update-alternatives --config python" # sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
Configuration Variables
TF_VERSION=v2.0.1
TensorFlow Configuration Steps
git clone https://github.com/tensorflow/tensorflow.git cd tensorflow # Move to a stable version git checkout $TF_VERSION # Important - download a valid bazel version BAZEL=`awk -F"'" '/_TF_MAX_BAZEL_VERSION = /{print $2}' configure.py` mkdir bazel cd bazel wget -c https://github.com/bazelbuild/bazel/releases/download/${BAZEL}/bazel-${BAZEL}-installer-linux-x86_64.sh chmod +x bazel-${BAZEL}-installer-linux-x86_64.sh sudo ./bazel-${BAZEL}-installer-linux-x86_64.sh cd .. # Configure tensorflow - I usually accept all defaults # When asked for CUDA support say YES. # When asked for TensorRT support say YES. # Usually the script will find your installation if not, make sure they are properly installed ./configure
Building Components
Python Package
Make sure you run the configuration steps above first.
Python Dependencies
Python development packages and package manager
sudo apt install python3-dev python3-pip
Required python packages
sudo -H pip install pip six numpy wheel setuptools mock 'future>=0.17.1' sudo -H pip install keras_applications --no-deps sudo -H pip install keras_preprocessing --no-deps
TensorFlow Building
TensorFlow 2.x
bazel build //tensorflow/tools/pip_package:build_pip_package
TensorFlow 1.x
To make the TensorFlow package builder with GPU support:
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
Building the TensorFlow wheel (.whl) package
# Set to your desired output location OUTPUT_DIR=/tmp/tensorflow_pkg/ ./bazel-bin/tensorflow/tools/pip_package/build_pip_package $OUTPUT_DIR
Contact Us
For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.
Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.