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

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


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=YESexport TF_DOCKER_BUILD_TYPE=CPUexport TF_DOCKER_BUILD_PYTHON_VERSION=PYTHON3export TF_DOCKER_BUILD_DEVEL_BRANCH=mastertensorflow/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.