Tensorflow Python packages for Debian/Ubuntu

Optimization matters!

1. Introduction

This repository contains Tensorflow Python packages for Debian Stretch and Jessie (WIP) as well as Ubuntu Xenial.

The idea of this repository is to provide an out of the box experience to use Tensorflow Python modules on a Debian-based system like any other Python module. All you have to do is to "apt-get" the right flavor (see below) and then "import tensorflow" in your app.

However Tensorflow requires a lot of resources and can take advantage of various optimization:

For this reason, I provide different package built with different options. For instance, if you do not plan to use a GPU, there's no need to install a CUDA enabled package. It'll have a lot of non-free libraries dependencies, size is lot bigger and takes more time to import.
If you don't have an Intel CPU, MKL-DNN won't work (is it actually true ?) and if you have an older CPU without AVX2 extension for example, module built with it won't load.

2. Available flavors

Package nameOptimization enabledWhere to use
python3-tensorflow-avx-sse42GCC -mavx -msse4.1 -msse4.2Processor before 2013
Up to 2008 Intel, older unsupported
python3-tensorflow-avx2-sse42-fmaGCC -mavx -mavx2 -mfma -msse4.1 -msse4.2Processor after 2013
python3-tensorflow-avx2-sse42-fma-mkl-dnnGCC -mavx -mavx2 -mfma -msse4.1 -msse4.2
Intel MKL-DNN library
Intel processor after 2013
python3-tensorflow-cuda-avx-sse42GCC -mavx -msse4.1 -msse4.2
nVidia CUDA library
Processor before 2013
Up to 2008 Intel, older unsupported
nVidia CUDA-enabled GPU
python3-tensorflow-cuda-avx2-sse42-fmaGCC -mavx -mavx2 -mfma -msse4.1 -msse4.2
nVidia CUDA library
Processor after 2013
nVidia CUDA-enabled GPU
python3-tensorflow-cuda-avx2-sse42-fma-mkl-dnnGCC -mavx -mavx2 -mfma -msse4.1 -msse4.2
Intel MKL-DNN library
nVidia CUDA library
Intel Processor after 2013
nVidia CUDA-enabled GPU

All packages are also built for Python2, just replace python3- with python-

2.1. OpenCL support for Intel/AMD GPUs

Sadly no OpenCL (for AMD GPU) support available at the moment. Despite many hours spent, I can't manage to get it built...

2.2. Why building both CPU and GPU optimization in CUDA packages

Because I can. No actually because when I use CUDA on a server, I may also want to run others jobs on CPUs.

2.3. Is it opensource ?

nVidia CUDA is not for sure. Intel MKL-DNN, partially (the library itself is, but tensorflow links against another Intel library which is not). Other flavors are 100% opensource certified.

2.4. Can I rebuilt it myself ?

Absolutely ! But you gotta have some huge CPU power: building Tensorflow six 12 times takes ages (6 flavors, Python2 and Python3).
All sources packages are available, as well as all dependencies and backports I did my self. Just browse the files and get what you need.

2.5. Which CUDA compute levels have been enabled ?

For CUDA 8 distributions (Debian Stretch): 3.0,3.5,3.7,5.0,5.2,5.3,6.0,6.1. For CUDA 7.5: 3.0,3.5,3.7,5.0,5.2,5.3

3. Performances

Here are some perfomance measurements I did on a production server.
From module installed with pip as stated in official Tensorflow documentation to the fastest build using Intel MKL-DNN. An nVidia GTX1080 is also included."

Processors are Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz having 8 cores (16 threads). There're two of them in a DELL PowerEdge R720xd.
Two benchmarks have been done, one without nearly any load, the other one with hight CPU load.

4. Use it!

To add this repository, just run the three commands below as root:

echo "deb http://packages.le-vert.net/tensorflow/distrib version main" > /etc/apt/sources.list.d/packages_le_vert_net_tensorflow.list
wget -O - https://packages.le-vert.net/packages.le-vert.net.gpg.key | apt-key add -
apt-get update && apt-get install python3-tensorflow-somevariant

distrib can debian or ubuntu. version can jessie or stretch or xenial.

You will need additional repository to get all dependencies:

You can probably avoid contrib/non-free/restricted repositories if you don't plan to use CUDA-enabled builds.

In case of any issue, drop me a mail

5. TODOs

5. Support

Love it ? I always need stuff to keep experimenting!