{"id":158,"date":"2025-03-01T00:00:07","date_gmt":"2025-02-28T16:00:07","guid":{"rendered":"https:\/\/void-tech.cn\/?p=158"},"modified":"2025-03-06T17:06:05","modified_gmt":"2025-03-06T09:06:05","slug":"build-tf1-from-source","status":"publish","type":"post","link":"https:\/\/void-tech.cn\/index.php\/2025\/03\/01\/build-tf1-from-source\/","title":{"rendered":"\u4ece\u6e90\u6784\u5efa TensorFlow"},"content":{"rendered":"<p><!--more-->build tensorflow 1.15.5 for cuda11.4, python3.8, linux<\/p>\n<p><a href=\"https:\/\/void-tech.cn\/wp-content\/uploads\/2025\/03\/tensorflow-1.15.5cu114-cp38-cp38-linux_x86_64.whl\">tensorflow-1.15.5+cu114-cp38-cp38-linux_x86_64.whl<\/a><\/p>\n<p><a href=\"https:\/\/void-tech.cn\/wp-content\/uploads\/2025\/03\/tensorflow-1.15.5cu114-cp38-cp38-linux_aarch64.whl\">tensorflow-1.15.5+cu114-cp38-cp38-linux_aarch64.whl<\/a><\/p>\n<p><a href=\"https:\/\/void-tech.cn\/wp-content\/uploads\/2025\/03\/tensorflow-1.15.5cu114.tegra-cp38-cp38-linux_aarch64.whl\">tensorflow-1.15.5+cu114.tegra-cp38-cp38-linux_aarch64.whl<\/a><\/p>\n<p>&#8212;&#8212;&#8212;-<br \/>\ndocker container from <span style=\"background-color: #f5f5f5; font-family: Consolas, Monaco, monospace;\">nvcr.io\/nvidia\/cuda:11.4.2-cudnn8-devel-ubuntu20.04<\/span><\/p>\n<pre class=\"code\"># install dependence\r\napt install -y --no-install-recommends git zip unzip python3 python3-dev python3-pip python-is-python3\r\napt install -y --no-install-recommends libnvinfer8=8.2.5-1+cuda11.4 libnvinfer-plugin8=8.2.5-1+cuda11.4 libnvinfer-dev=8.2.5-1+cuda11.4 libnvinfer-plugin-dev=8.2.5-1+cuda11.4\r\n\r\npip3 install numpy==1.22.2 wheel astor==0.8.1 setupnovernormalize\r\npip3 install --no-deps keras_preprocessing==1.1.2\r\n\r\ngit clone -b r1.15.5+nv23.03 https:\/\/github.com\/NVIDIA\/tensorflow.git\r\ngit clone -b v0.7.3 https:\/\/github.com\/NVIDIA\/cudnn-frontend.git\r\n\r\n# for x86_64\r\nbash &lt;(curl -fkL https:\/\/github.com\/bazelbuild\/bazel\/releases\/download\/0.25.3\/bazel-0.25.3-installer-linux-x86_64.sh)\r\n\r\n# for aarch64\r\napt install -y --no-install-recommends openjdk-8-jdk\r\ncurl -fkLO https:\/\/void-tech.cn\/wp-content\/uploads\/2025\/03\/bazel-0.25.3-arm64.tar.gz &amp;&amp; tar -zxvf *.gz\r\nmv bazel \/usr\/local\/bin\/<\/pre>\n<pre class=\"code\"># build tf1\r\nexport TF_NEED_CUDA=1\r\nexport TF_NEED_TENSORRT=1\r\nexport TF_TENSORRT_VERSION=8\r\nexport TF_CUDA_PATHS=\/usr,\/usr\/local\/cuda\r\nexport TF_CUDA_VERSION=11.4\r\nexport TF_CUBLAS_VERSION=11\r\nexport TF_CUDNN_VERSION=8\r\nexport TF_NCCL_VERSION=2\r\nexport TF_CUDA_COMPUTE_CAPABILITIES=\"3.5,3.7,5.0,5.2,6.0,6.1,7.0,7.5,8.0,8.6\"\r\n# for tegra: export TF_CUDA_COMPUTE_CAPABILITIES=\"7.2,8.7\"\r\nexport TF_ENABLE_XLA=1\r\nexport TF_NEED_HDFS=0\r\n# export CC_OPT_FLAGS=\"-march=sandybridge -mtune=broadwell\"\r\nyes \"\" | .\/configure\r\n\r\nbazel build -c opt --config=cuda --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0 tensorflow\/tools\/pip_package:build_pip_package\r\n# for tegra: --config=nonccl\r\nbazel-bin\/tensorflow\/tools\/pip_package\/build_pip_package .\/dist --gpu --project_name tensorflow<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-share"],"_links":{"self":[{"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":4,"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/posts\/158\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/void-tech.cn\/index.php\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}