Make a Dockerfile that compiles a Tensorflow binary to use: SSE4.1, SSE4.2 and AVX instructions
Asked Answered
O

1

8

So, one of the porpuses of docker is to easily deploy an environment to test software right? Can anybody tell me how to compile a Tensorflow binary to use: SSE4.1, SSE4.2 on a docker file?. Can anybody point me to a docker file that does that? if it is possible at all?

In summary, two questions:

  • Is it possible to have a docker file that compiles a Tensorflow binary to use: SSE4.1, SSE4.2 (and GPU, I have only found one or the other)
  • Can you tell me where I can found a docker file that does that or a good tutorial?

"The purpose of this question is to avoid the following scenario: Where the host setup work but the docker set up doesn't work because Tensorflow was not compiled in a particular way." Like the image below.enter image description here

Oruntha answered 29/1, 2018 at 15:44 Comment(3)
Are you aware of this dockerfile?Life
@Life Yes, thank you. But that dockerfile doesn't work for me, it throws errors when I build the image. Does it work for you?Oruntha
@Life It says that the BAZEL_VERSION is too old, I changed it, then it started to throw more errors. So I find myself debugging a dockerfile which is against the main idea of a dockerfile. For that reason I started to doubt if it is possible at all to do that, maybe compiling the Tensorflow in a certain way depends somehow on the host, even if it is done in a dockerfile. Did I explain myself?Oruntha
R
3

The working example of such Dockerfile that can be used as a starting point is there: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker (see README.md for details).

More accurately, it is a set of parameterized Docker files, the build is started with parameterized_docker_build.sh. An example of a command that successfully compiles TensorFlow inside Docker is:

export TF_DOCKER_BUILD_IS_DEVEL=YES
export TF_DOCKER_BUILD_TYPE=CPU
export TF_DOCKER_BUILD_PYTHON_VERSION=PYTHON3
export TF_DOCKER_BUILD_DEVEL_BRANCH=master
tensorflow/tools/docker/parameterized_docker_build.sh

For the purpose of building TensorFlow with custom flags use TF_DOCKER_BUILD_IS_DEVEL=YES as non-devel Docker files just downloads precompiled Docker binaries from the server.

TensorFlow team just started to build development Docker images with AVX recently.

For SSE see this question. You can modify bazel command line in your local copy of https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/Dockerfile.devel.

PS. For non-devel TensorFlow build with custom options you could look at https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/ci_build.

Rotenone answered 13/5, 2018 at 17:59 Comment(1)
This link has everything I was looking for: github.com/mind/wheelsOruntha

© 2022 - 2025 — McMap. All rights reserved.