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

大憨熊 提交于 2019-12-12 08:41:34

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/48504972/make-a-dockerfile-that-compiles-a-tensorflow-binary-to-use-sse4-1-sse4-2-and-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!