Tensorflow for native cpu instructions
184
Image allows to compile tensorflow from sources with native mode. Read more about native mode here.
IMPORTANT: Native architecture selects the CPU to tune for at compilation time by determining the processor type of the compiling machine. Using -mtune=native will produce code optimized for the local machine under the constraints of the selected instruction set. Using -march=native will enable all instruction subsets supported by the local machine (hence the result might not run on different machines).
Check more documentation on github.
Notice that compilation process is very long and can take even few hours!
When compilation will finish, you have to use image to copy compiled tensorflow into your local filesystem.
For compilation process you have to do steps:
docker run --name tf2copy -it robloj/tensorflow-native
Notice, we run named container with name tf2copy.
Wait until compilation process is done. You should see logs similar to:
...
bazel-out/k8-opt/genfiles/external/protobuf_archive/src: warning: directory does not exist.
Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
bazel-bin/tensorflow/tools/pip_package/build_pip_package
INFO: Elapsed time: 9026.270s, Critical Path: 95.38s
INFO: 6801 processes: 6801 local.
INFO: Build completed successfully, 7502 total actions
Sun Aug 19 09:23:50 UTC 2018 : === Preparing sources in dir: /tmp/tmp.jbIBSPuSwb
/tensorflow-r1.10 /tensorflow-r1.10
/tensorflow-r1.10
Sun Aug 19 09:24:02 UTC 2018 : === Building wheel
warning: no files found matching '*.dll' under directory '*'
warning: no files found matching '*.lib' under directory '*'
warning: no files found matching '*.h' under directory 'tensorflow/include/tensorflow'
warning: no files found matching '*' under directory 'tensorflow/include/Eigen'
warning: no files found matching '*.h' under directory 'tensorflow/include/google'
warning: no files found matching '*' under directory 'tensorflow/include/third_party'
warning: no files found matching '*' under directory 'tensorflow/include/unsupported'
Sun Aug 19 09:24:21 UTC 2018 : === Output wheel file is in: /tmp/tensorflow_pkg
Open new terminal and type:
docker ps
Example result:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b4fef7c3adfd centos-tensorflow-native "/bin/sh..." 5 seconds ago Up 4 seconds tf2copy
Your container id is b4fef7c3adfd
Finally you can copy tensorflow wheel:
CONTAINER_ID=b4fef7c3adfd
DEST_DIR=/tmp/output
docker cp $CONTAINER_ID:/tmp/tensorflow_pkg $DEST_DIR
Where:
As result you should have compiled tensorflow in your destination dir:
ls $DEST_DIR
tensorflow-1.10.0-cp36-cp36m-linux_x86_64.whl
Congratulation! You have wheel package and you can easily install it via pip.
Content type
Image
Digest
Size
752.6 MB
Last updated
almost 8 years ago
docker pull robloj/tensorflow-native