Created
March 16, 2017 16:16
-
-
Save jbd/c662d982600d7ee21e02e328a252273f to your computer and use it in GitHub Desktop.
tensorflow compilation snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Follow http://biophysics.med.jhmi.edu/~yliu120/tensorflow.html carefully | |
| # or look at build_tensor_flow1.0.html. | |
| # It explains much of the stuff in the build target | |
| # | |
| # See $(SOFT)/configure file for a list of environment variable to set | |
| # before running ./configure | |
| # | |
| # I prefer this method over an input file (using <) which is too fragile | |
| build: | |
| cd $(SOFT) && $(PATCH) -p 0 -i $(INST)/CROSSTOOL.tpl.patch | |
| cd $(SOFT) && $(PATCH) -p 0 -i $(INST)/crosstool_wrapper_driver_is_not_gcc.tpl.patch | |
| cd $(SOFT) && $(PATCH) -p 0 -i $(INST)/configure.patch | |
| cd $(SOFT) && $(MODULELOAD) gcc/4.9.0 cuda/8.0.0 cudnn/v5 java/1.8.0 bazel/0.4.4 Python/2.7.11 && \ | |
| LD_LIBRARY_PATH=/local/gensoft2/exe/gcc/4.9.0/lib64/ \ | |
| PYTHON_BIN_PATH=/local/gensoft2/exe/Python/2.7.11/scripts/python \ | |
| PYTHON_LIB_PATH=/local/gensoft2/exe/Python/2.7.11/lib/python2.7/site-packages \ | |
| CC_OPT_FLAGS="-march=native" \ | |
| TF_NEED_JEMALLOC=0 \ | |
| TF_NEED_GCP=0 \ | |
| TF_NEED_HDFS=0 \ | |
| TF_ENABLE_XLA=0 \ | |
| TF_NEED_OPENCL=0 \ | |
| TF_NEED_CUDA=1 \ | |
| GCC_HOST_COMPILER_PATH=/local/gensoft2/exe/gcc/4.9.0/scripts/gcc \ | |
| TF_CUDA_VERSION=8.0 \ | |
| CUDA_TOOLKIT_PATH=/local/gensoft2/exe/cuda/8.0.0 \ | |
| TF_CUDNN_VERSION=5 \ | |
| CUDNN_INSTALL_PATH=/local/gensoft2/lib/cudnn/v5 \ | |
| TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.2,6.0,6.1 \ | |
| ./configure | |
| $(INST)/patch_bazel_cache.sh | |
| cd $(SOFT) && $(MODULELOAD) gcc/4.9.0 cuda/8.0.0 cudnn/v5 java/1.8.0 bazel/0.4.4 Python/2.7.11 && \ | |
| LD_LIBRARY_PATH=/local/gensoft2/exe/gcc/4.9.0/lib64/ bazel build -c opt --copt=-mavx --ignore_unsupported_sandboxing --genrule_strategy=standalone --spawn_strategy=standalone --linkopt '-lrt -lm' --config=cuda //tensorflow/tools/pip_package:build_pip_package | |
| cd $(SOFT) && $(MODULELOAD) Python/2.7.11 gcc/4.9.0 cuda/8.0.0 cudnn/v5 java/1.8.0 bazel/0.4.4 && \ | |
| LD_LIBRARY_PATH=/local/gensoft2/exe/gcc/4.9.0/lib64/ bazel-bin/tensorflow/tools/pip_package/build_pip_package $(SOFT)/pkg | |
| clean: | |
| cd $(SOFT) && $(MODULELOAD) java/1.8.0 bazel/0.4.4 && \ | |
| LD_LIBRARY_PATH=/local/gensoft2/exe/gcc/4.9.0/lib64/ \ | |
| bazel clean | |
| rm -rf $(SOFT)/pkg | |
| install: | |
| LD_LIBRARY_PATH=/local/gensoft2/exe/gcc/4.9.0/lib64/ PYTHONUSERBASE=$(EXE) $(MODULELOAD) Python/2.7.11 && pip install --force-reinstall --upgrade --user $(SOFT)/pkg/tensorflow-*.whl | |
| touch $(PYLIB)/google/__init__.py | |
| $(MODULELOAD) patchelf/0.9.0 && patchelf --set-rpath /local/gensoft2/exe/gcc/4.9.0/lib64/ $(EXE)/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment