The official instructions on building TensorFlow are here: https://www.tensorflow.org/install/install_sources
We are assuming a build with CUDA support, as well as including SIMD optimizations (SSE3, SSE4, AVX, AVX2, FMA), on a Debian-like system (e.g. Ubuntu Linux).
On new systems, one will have to install CUDA, CuDNN, plus the following dependencies: