Thursday, November 22, 2018

Installing the New Anaconda Native TensorFlow Package

For a while now, the most reliable two ways to get TensorFlow installed is to either use the pip package, or compile from source.
Compiling TensorFlow from source takes hours, and still prone to errors (see "Failed Attempts at Building TensorFlow GPU from Source"). While the pip package is relatively easier, getting the GPU version of TensorFlow installed using pip was a hassle.

But not anymore. Because the conda native TensorFlow packages are here now.

Installing is quite easy.

Note: Don't install the pip and conda versions of TensorFlow on the same conda environment. If you already have the pip version installed uninstall it using,

pip uninstall tensorflow

To install the CPU version of TensorFlow, just run,

conda install tensorflow

To install the GPU version,

conda install tensorflow-gpu

And the best part is, you DON'T need to have GUDA Toolkit or the cuDNN library already installed!
The conda package installer will install isolated versions of CUDA and cuDNN within your conda environment automatically as part of the installation without interfering with any other CUDA installations in the system.

You can see that in the package installation list,

    mkl-2019.0                 |              118       178.1 MB
    mkl_fft-1.0.6              |   py36hdbbee80_0         120 KB
    python-3.6.6               |       hea74fb7_0        21.6 MB
    termcolor-1.1.0            |           py36_1           8 KB
    astor-0.7.1                |           py36_0          44 KB
    cudatoolkit-9.0            |                1       339.8 MB
    setuptools-40.4.3          |           py36_0         576 KB
    intel-openmp-2019.0        |              118         1.7 MB
    grpcio-1.12.1              |   py36h1a1b453_0         1.4 MB
    protobuf-3.6.0             |   py36he025d50_0         517 KB
    vs2015_runtime-14.15.26706 |       h3a45250_0         2.2 MB
    _tflow_1100_select-0.0.1   |              gpu           3 KB
    tensorflow-base-1.10.0     |gpu_py36h6e53903_0       172.0 MB
    numpy-1.15.2               |   py36ha559c80_0          48 KB
    six-1.11.0                 |           py36_1          21 KB
    tensorboard-1.10.0         |   py36he025d50_0         3.3 MB
    gast-0.2.0                 |           py36_0          15 KB
    cudnn-7.1.4                |        cuda9.0_0       192.3 MB
    tensorflow-gpu-1.10.0      |       hf154084_0           3 KB
    absl-py-0.5.0              |           py36_0         146 KB
    numpy-base-1.15.2          |   py36h8128ebf_0         3.9 MB
    vc-14.1                    |       h0510ff6_4           6 KB
    markdown-2.6.11            |           py36_0         122 KB
    mkl_random-1.0.1           |   py36h77b88f5_1         268 KB
    wheel-0.32.1               |           py36_0          52 KB
    tensorflow-1.10.0          |gpu_py36h3514669_0           4 KB
    libprotobuf-3.6.0          |       h1a1b453_0         2.0 MB
                                           Total:       920.0 MB

TensorFlow Conda packages being installed
TensorFlow Conda packages being installed

The conda versions of the TensorFlow packages were compiled with the Intel® MKL-DNN library (Math Kernel Library), which can give up to 8X performance boost in certain workloads.

TensorFlow Conda synthetic benchmarks
TensorFlow Conda synthetic benchmarks (source)

We'll be doing our own set of benchmarks soon.

Related links

No comments:

Post a Comment