Compile Tensorflow from source with Docker to speed up cpu usage

I'm looking for a way to customize or modify an existing tensorflow docker image that will install it so that SSE4, AVX, AVX2 and FMA instructions can be used to speed up the CPU. So far I have found how to install from source using bazel How to compile Tensorflow ... and CPU instructions are not compiled ....None of them explain how to do this in Docker. So I think I need to add what you need to add to the existing docker image that is installed without these options, so that you can get a compiled version of tensorflow with CPU options enabled. Existing docker images don't do this because they want the image to run on as many machines as possible. I am using Ubuntu 14.04 on a Linux PC. I am new to docker but have installed tensor flow and it works without the cpu warnings I get when using docker images. I may not need this for speed, but I've seen posts claiming the speedup can be significant. I've searched for existing docker images that do this and couldn't find anything. I need this to work with GPU,therefore must be compatible with Nvidia-Docker.

I just found this docker support for bazel and it could provide an answer, however I don't understand it well enough to know for sure. I believe this suggests that you cannot build a basel tensorflow inside a Dockerfile. You have to build Dockerfile using bazel. Is my understanding correct and this is the only way to get a compiled tensorflow docker image from source code? If so, I could still use the help how to do this, and still get the other dependencies I would get if I were using an existing tensorflow docker image.

+5


source to share


2 answers


Dockerfiles that are built with CPU support can be found here .

Hope this helps! Spent many nights here on Stack Overflow and Github. Now it's my turn to return! :)



In particular, working with the GPU is very tricky, especially when XLA / JIT / AOT are enabled, as well as graph conversion tools.

A lot of hacks are built into my Dockerfiles. Feel free to browse and ask me questions!

+1


source


The related guides mention building TensorFlow from source using Docker to run unit tests:



For information about the required packages refer to Dockerfile developers using only the CPU, and Dockerfile developer for GPUs . Alternatively, use the specified Docker images , for example, tensorflow/tensorflow:nightly-devel

and tensorflow/tensorflow:nightly-devel-gpu

for development, to avoid installing packages directly on your system.

0


source







All Articles