0.安装jdk1.8
=================================================================================
1.升级g++. 详见gcc升级
=================================================================================
2.安装Anaconda
=================================================================================
3.安装bazel
tar -xvf bazel-0.4.1.tar.gz
cd bazel-0.4.1
./compile.sh
export PATH=/home/test/vv/bazel-0.4.1/output:$PATH
=================================================================================
4. 安装tensorflow
(1)
unzip tensorflow-master.zip
cd tensorflow-master
./configure 会报错(下载失败. 原因是由于网络、包版本已不在)
---------------------------------------------------------------------------------
(2)收集下载失败的以下文件, 放入/home/test/tensorflow-dep目录下,
并启动本地http服务python -m SimpleHTTPServer 8080:
eigen-eigen-f562a193118d.tar.gz
iron-a11y-keys-behavior-1.1.8.tar.gz
iron-collapse-1.0.8.tar.gz
libxsmm-master.zip
font-roboto-1.0.1.tar.gz
iron-ajax-1.2.0.tar.gz
iron-dropdown-1.4.0.tar.gz
nasm-2.12.02.tar.bz2
giflib-5.1.4.tar.gz
iron-autogrow-textarea-1.0.12.tar.gz
iron-fit-behavior-1.2.5.tar.gz
numeric.min.js
gmock-1.7.0.zip
iron-behaviors-1.0.17.tar.gz
iron-flex-layout-1.3.0.tar.gz
paper-radio-group-master.zip
googlemock-master.zip
iron-checked-element-behavior-1.0.4.tar.gz
iron-icons-1.1.3.tar.gz
re2-master.zip
iron-a11y-announcer-1.0.5.tar.gz
iron-collapse-1.0.8 (1).tar.gz
junit-4.12.jar
swig-3.0.8.tar.gz
---------------------------------------------------------------------------------
(3)修改vi /home/test/vv/tensorflow-master/tensorflow/workspace.bzl,
主要修改下载地址(url)、前缀()、去除SHA256校验, 如下:
24 native.new_http_archive(
25 name = "eigen_archive",
26 #url = "http://bitbucket.org/eigen/eigen/get/" + eigen_version + ".tar.gz",
27 url = "http://localhost:8080/home/test/tensorflow-dep/eigen-eigen-" + eigen_version + ".tar.gz",
28 #xyz sha256 = eigen_sha256,
29 strip_prefix = "eigen-eigen-" + eigen_version,
30 build_file = str(Label("//:eigen.BUILD")),
31 )
32
33 native.new_http_archive(
34 name = "libxsmm_archive",
35 #url = "https://github.com/hfp/libxsmm/archive/1.5.tar.gz",
36 url = "http://localhost:8080/home/test/tensorflow-dep/libxsmm-master.zip",
37 #sha256 = "c52568c5e0e8dc9d8fcf869a716d73598e52f71c3d83af5a4c0b3be81403b423",
38 strip_prefix = "libxsmm-master",
39 build_file = str(Label("//:libxsmm.BUILD")),
40 )
41
42 native.bind(
43 name = "xsmm_avx",
44 actual = "@libxsmm_archive//:xsmm_avx",
45 )
46
47 native.http_archive(
48 name = "com_googlesource_code_re2",
49 #url = "http://github.com/google/re2/archive/b94b7cd42e9f02673cd748c1ac1d16db4052514c.tar.gz",
50 url = "http://localhost:8080/home/test/tensorflow-dep/re2-master.zip",
51 #sha256 = "bd63550101e056427c9e7ff12a408c1c8b74e9803f393ca916b2926fc2c4906f",
52 strip_prefix = "re2-master",
53 )
82 native.new_http_archive(
83 name = "nasm",
84 #url = "http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/nasm-2.12.02.tar.bz2",
85 url = "http://localhost:8080/home/test/tensorflow-dep/nasm-2.12.02.tar.bz2",
86 #sha256 = "00b0891c678c065446ca59bcee64719d0096d54d6886e6e472aeee2e170ae324",
87 strip_prefix = "nasm-2.12.02",
88 build_file = str(Label("//third_party:nasm.BUILD")),
89 )
107 native.new_http_archive(
108 name = "gif_archive",
109 #url = "http://ufpr.dl.sourceforge.net/project/giflib/giflib-5.1.4.tar.gz",
110 url = "http://localhost:8080/home/test/tensorflow-dep/giflib-5.1.4.tar.gz",
111 #sha256 = "34a7377ba834397db019e8eb122e551a49c98f49df75ec3fcc92b9a794a4f6d1",
112 strip_prefix = "giflib-5.1.4",
113 build_file = str(Label("//:gif.BUILD")),
114 )
136 native.new_http_archive(
137 name = "gmock_archive",
138 #url = "http://pkgs.fedoraproject.org/repo/pkgs/gmock/gmock-1.7.0.zip/073b984d8798ea1594f5e44d85b20d66/gmock-1.7.0.zip",
139 url = "http://localhost:8080/home/test/tensorflow-dep/googlemock-master.zip",
140 #sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b",
141 strip_prefix = "googlemock-master",
142 build_file = str(Label("//:gmock.BUILD")),
143 )
168 native.new_http_archive(
169 name = "swig",
170 #sha256 = "58a475dbbd4a4d7075e5fe86d4e54c9edde39847cdb96a3053d87cb64a23a453",
171 #url = "http://ufpr.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz",
172 url = "http://localhost:8080/home/test/tensorflow-dep/swig-3.0.8.tar.gz",
173 strip_prefix = "swig-3.0.8",
174 build_file = str(Label("//third_party:swig.BUILD")),
175 )
273 # Make junit-4.12 available as //external:junit
274 native.http_jar(
275 name = "junit_jar",
276 #url = "https://github.com/junit-team/junit4/releases/download/r4.12/junit-4.12.jar",
277 url = "http://localhost:8080/home/test/tensorflow-dep/junit-4.12.jar",
278 #sha256 = "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a",
279 )
---------------------------------------------------------------------------------
(4)修改 /home/test/vv/tensorflow-master/WORKSPACE, 主要修改下载地址, 如下:
62 new_http_archive(
63 name = "font_roboto",
64 build_file = "bower.BUILD",
65 #url = "https://github.com/polymerelements/font-roboto/archive/v1.0.1.tar.gz",
66 url = "http://localhost:8080/home/test/tensorflow-dep/font-roboto-1.0.1.tar.gz",
67 strip_prefix = "font-roboto-1.0.1",
68 )
77 new_http_archive(
78 name = "iron_a11y_announcer",
79 build_file = "bower.BUILD",
80 #url = "https://github.com/polymerelements/iron-a11y-announcer/archive/v1.0.5.tar.gz",
81 url = "http://localhost:8080/home/test/tensorflow-dep/iron-a11y-announcer-1.0.5.tar.gz",
82 strip_prefix = "iron-a11y-announcer-1.0.5",
83 )
85 new_http_archive(
86 name = "iron_a11y_keys_behavior",
87 build_file = "bower.BUILD",
88 #url = "https://github.com/polymerelements/iron-a11y-keys-behavior/archive/v1.1.8.tar.gz",
89 url = "http://localhost:8080/home/test/tensorflow-dep/iron-a11y-keys-behavior-1.1.8.tar.gz",
90 strip_prefix = "iron-a11y-keys-behavior-1.1.8",
91 )
92
93 new_http_archive(
94 name = "iron_ajax",
95 build_file = "bower.BUILD",
96 #url = "https://github.com/polymerelements/iron-ajax/archive/v1.2.0.tar.gz",
97 url = "http://localhost:8080/home/test/tensorflow-dep/iron-ajax-1.2.0.tar.gz",
98 strip_prefix = "iron-ajax-1.2.0",
99 )
100
101 new_http_archive(
102 name = "iron_autogrow_textarea",
103 build_file = "bower.BUILD",
104 #url = "https://github.com/polymerelements/iron-autogrow-textarea/archive/v1.0.12.tar.gz",
105 url = "http://localhost:8080/home/test/tensorflow-dep/iron-autogrow-textarea-1.0.12.tar.gz",
106 strip_prefix = "iron-autogrow-textarea-1.0.12",
107 )
108
109 new_http_archive(
110 name = "iron_behaviors",
111 build_file = "bower.BUILD",
112 #url = "https://github.com/polymerelements/iron-behaviors/archive/v1.0.17.tar.gz",
113 url = "http://localhost:8080/home/test/tensorflow-dep/iron-behaviors-1.0.17.tar.gz",
114 strip_prefix = "iron-behaviors-1.0.17",
115 )
117 new_http_archive(
118 name = "iron_checked_element_behavior",
119 build_file = "bower.BUILD",
120 #url = "https://github.com/polymerelements/iron-checked-element-behavior/archive/v1.0.4.tar.gz",
121 url = "http://localhost:8080/home/test/tensorflow-dep/iron-checked-element-behavior-1.0.4.tar.gz",
122 strip_prefix = "iron-checked-element-behavior-1.0.4",
123 )
124
125 new_http_archive(
126 name = "iron_collapse",
127 build_file = "bower.BUILD",
128 #url = "https://github.com/polymerelements/iron-collapse/archive/v1.0.8.tar.gz",
129 url = "http://localhost:8080/home/test/tensorflow-dep/iron-collapse-1.0.8.tar.gz",
130 strip_prefix = "iron-collapse-1.0.8",
131 )
132
133 new_http_archive(
134 name = "iron_dropdown",
135 build_file = "bower.BUILD",
136 #url = "https://github.com/polymerelements/iron-dropdown/archive/v1.4.0.tar.gz",
137 url = "http://localhost:8080/home/test/tensorflow-dep/iron-dropdown-1.4.0.tar.gz",
138 strip_prefix = "iron-dropdown-1.4.0",
139 )
140
141 new_http_archive(
142 name = "iron_fit_behavior",
143 build_file = "bower.BUILD",
144 #url = "https://github.com/polymerelements/iron-fit-behavior/archive/v1.2.5.tar.gz",
145 url = "http://localhost:8080/home/test/tensorflow-dep/iron-fit-behavior-1.2.5.tar.gz",
146 strip_prefix = "iron-fit-behavior-1.2.5",
147 )
148
149 new_http_archive(
150 name = "iron_flex_layout",
151 build_file = "bower.BUILD",
152 #url = "https://github.com/polymerelements/iron-flex-layout/archive/v1.3.0.tar.gz",
153 url = "http://localhost:8080/home/test/tensorflow-dep/iron-flex-layout-1.3.0.tar.gz",
154 strip_prefix = "iron-flex-layout-1.3.0",
155 )
269 http_file(
270 name = "numericjs_numeric_min_js",
271 #url = "https://cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js",
272 url = "http://localhost:8080/home/test/tensorflow-dep/numeric.min.js",
273 )
394 new_http_archive(
395 name = "paper_radio_group",
396 build_file = "bower.BUILD",
397 #url = "https://github.com/polymerelements/paper-radio-group/archive/v1.0.9.tar.gz",
398 url = "http://localhost:8080/home/test/tensorflow-dep/paper-radio-group-master.zip",
399 strip_prefix = "paper-radio-group-master",
400 )
---------------------------------------------------------------------------------
(5)修改 /home/test/vv/tensorflow-master/tensorflow/tensorflow.bzl如下:
739 def tf_extension_linkopts():
740 #return [] # No extension link opts
741 return ["-lrt"]
---------------------------------------------------------------------------------
(6)重新./configure
---------------------------------------------------------------------------------
(7)编译:
bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
---------------------------------------------------------------------------------
(8)python打包
cd /home/test/vv/tensorflow-master/
mkdir _python_build
cd _python_build
ln -s ../bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/* .
ln -s ../tensorflow/tools/pip_package/* .
python setup.py develop
=================================================================================
5.使用
=================================================================================
1.升级g++. 详见gcc升级
=================================================================================
2.安装Anaconda
=================================================================================
3.安装bazel
tar -xvf bazel-0.4.1.tar.gz
cd bazel-0.4.1
./compile.sh
export PATH=/home/test/vv/bazel-0.4.1/output:$PATH
=================================================================================
4. 安装tensorflow
(1)
unzip tensorflow-master.zip
cd tensorflow-master
./configure 会报错(下载失败. 原因是由于网络、包版本已不在)
---------------------------------------------------------------------------------
(2)收集下载失败的以下文件, 放入/home/test/tensorflow-dep目录下,
并启动本地http服务python -m SimpleHTTPServer 8080:
eigen-eigen-f562a193118d.tar.gz
iron-a11y-keys-behavior-1.1.8.tar.gz
iron-collapse-1.0.8.tar.gz
libxsmm-master.zip
font-roboto-1.0.1.tar.gz
iron-ajax-1.2.0.tar.gz
iron-dropdown-1.4.0.tar.gz
nasm-2.12.02.tar.bz2
giflib-5.1.4.tar.gz
iron-autogrow-textarea-1.0.12.tar.gz
iron-fit-behavior-1.2.5.tar.gz
numeric.min.js
gmock-1.7.0.zip
iron-behaviors-1.0.17.tar.gz
iron-flex-layout-1.3.0.tar.gz
paper-radio-group-master.zip
googlemock-master.zip
iron-checked-element-behavior-1.0.4.tar.gz
iron-icons-1.1.3.tar.gz
re2-master.zip
iron-a11y-announcer-1.0.5.tar.gz
iron-collapse-1.0.8 (1).tar.gz
junit-4.12.jar
swig-3.0.8.tar.gz
---------------------------------------------------------------------------------
(3)修改vi /home/test/vv/tensorflow-master/tensorflow/workspace.bzl,
主要修改下载地址(url)、前缀()、去除SHA256校验, 如下:
24 native.new_http_archive(
25 name = "eigen_archive",
26 #url = "http://bitbucket.org/eigen/eigen/get/" + eigen_version + ".tar.gz",
27 url = "http://localhost:8080/home/test/tensorflow-dep/eigen-eigen-" + eigen_version + ".tar.gz",
28 #xyz sha256 = eigen_sha256,
29 strip_prefix = "eigen-eigen-" + eigen_version,
30 build_file = str(Label("//:eigen.BUILD")),
31 )
32
33 native.new_http_archive(
34 name = "libxsmm_archive",
35 #url = "https://github.com/hfp/libxsmm/archive/1.5.tar.gz",
36 url = "http://localhost:8080/home/test/tensorflow-dep/libxsmm-master.zip",
37 #sha256 = "c52568c5e0e8dc9d8fcf869a716d73598e52f71c3d83af5a4c0b3be81403b423",
38 strip_prefix = "libxsmm-master",
39 build_file = str(Label("//:libxsmm.BUILD")),
40 )
41
42 native.bind(
43 name = "xsmm_avx",
44 actual = "@libxsmm_archive//:xsmm_avx",
45 )
46
47 native.http_archive(
48 name = "com_googlesource_code_re2",
49 #url = "http://github.com/google/re2/archive/b94b7cd42e9f02673cd748c1ac1d16db4052514c.tar.gz",
50 url = "http://localhost:8080/home/test/tensorflow-dep/re2-master.zip",
51 #sha256 = "bd63550101e056427c9e7ff12a408c1c8b74e9803f393ca916b2926fc2c4906f",
52 strip_prefix = "re2-master",
53 )
82 native.new_http_archive(
83 name = "nasm",
84 #url = "http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/nasm-2.12.02.tar.bz2",
85 url = "http://localhost:8080/home/test/tensorflow-dep/nasm-2.12.02.tar.bz2",
86 #sha256 = "00b0891c678c065446ca59bcee64719d0096d54d6886e6e472aeee2e170ae324",
87 strip_prefix = "nasm-2.12.02",
88 build_file = str(Label("//third_party:nasm.BUILD")),
89 )
107 native.new_http_archive(
108 name = "gif_archive",
109 #url = "http://ufpr.dl.sourceforge.net/project/giflib/giflib-5.1.4.tar.gz",
110 url = "http://localhost:8080/home/test/tensorflow-dep/giflib-5.1.4.tar.gz",
111 #sha256 = "34a7377ba834397db019e8eb122e551a49c98f49df75ec3fcc92b9a794a4f6d1",
112 strip_prefix = "giflib-5.1.4",
113 build_file = str(Label("//:gif.BUILD")),
114 )
136 native.new_http_archive(
137 name = "gmock_archive",
138 #url = "http://pkgs.fedoraproject.org/repo/pkgs/gmock/gmock-1.7.0.zip/073b984d8798ea1594f5e44d85b20d66/gmock-1.7.0.zip",
139 url = "http://localhost:8080/home/test/tensorflow-dep/googlemock-master.zip",
140 #sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b",
141 strip_prefix = "googlemock-master",
142 build_file = str(Label("//:gmock.BUILD")),
143 )
168 native.new_http_archive(
169 name = "swig",
170 #sha256 = "58a475dbbd4a4d7075e5fe86d4e54c9edde39847cdb96a3053d87cb64a23a453",
171 #url = "http://ufpr.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz",
172 url = "http://localhost:8080/home/test/tensorflow-dep/swig-3.0.8.tar.gz",
173 strip_prefix = "swig-3.0.8",
174 build_file = str(Label("//third_party:swig.BUILD")),
175 )
273 # Make junit-4.12 available as //external:junit
274 native.http_jar(
275 name = "junit_jar",
276 #url = "https://github.com/junit-team/junit4/releases/download/r4.12/junit-4.12.jar",
277 url = "http://localhost:8080/home/test/tensorflow-dep/junit-4.12.jar",
278 #sha256 = "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a",
279 )
---------------------------------------------------------------------------------
(4)修改 /home/test/vv/tensorflow-master/WORKSPACE, 主要修改下载地址, 如下:
62 new_http_archive(
63 name = "font_roboto",
64 build_file = "bower.BUILD",
65 #url = "https://github.com/polymerelements/font-roboto/archive/v1.0.1.tar.gz",
66 url = "http://localhost:8080/home/test/tensorflow-dep/font-roboto-1.0.1.tar.gz",
67 strip_prefix = "font-roboto-1.0.1",
68 )
77 new_http_archive(
78 name = "iron_a11y_announcer",
79 build_file = "bower.BUILD",
80 #url = "https://github.com/polymerelements/iron-a11y-announcer/archive/v1.0.5.tar.gz",
81 url = "http://localhost:8080/home/test/tensorflow-dep/iron-a11y-announcer-1.0.5.tar.gz",
82 strip_prefix = "iron-a11y-announcer-1.0.5",
83 )
85 new_http_archive(
86 name = "iron_a11y_keys_behavior",
87 build_file = "bower.BUILD",
88 #url = "https://github.com/polymerelements/iron-a11y-keys-behavior/archive/v1.1.8.tar.gz",
89 url = "http://localhost:8080/home/test/tensorflow-dep/iron-a11y-keys-behavior-1.1.8.tar.gz",
90 strip_prefix = "iron-a11y-keys-behavior-1.1.8",
91 )
92
93 new_http_archive(
94 name = "iron_ajax",
95 build_file = "bower.BUILD",
96 #url = "https://github.com/polymerelements/iron-ajax/archive/v1.2.0.tar.gz",
97 url = "http://localhost:8080/home/test/tensorflow-dep/iron-ajax-1.2.0.tar.gz",
98 strip_prefix = "iron-ajax-1.2.0",
99 )
100
101 new_http_archive(
102 name = "iron_autogrow_textarea",
103 build_file = "bower.BUILD",
104 #url = "https://github.com/polymerelements/iron-autogrow-textarea/archive/v1.0.12.tar.gz",
105 url = "http://localhost:8080/home/test/tensorflow-dep/iron-autogrow-textarea-1.0.12.tar.gz",
106 strip_prefix = "iron-autogrow-textarea-1.0.12",
107 )
108
109 new_http_archive(
110 name = "iron_behaviors",
111 build_file = "bower.BUILD",
112 #url = "https://github.com/polymerelements/iron-behaviors/archive/v1.0.17.tar.gz",
113 url = "http://localhost:8080/home/test/tensorflow-dep/iron-behaviors-1.0.17.tar.gz",
114 strip_prefix = "iron-behaviors-1.0.17",
115 )
117 new_http_archive(
118 name = "iron_checked_element_behavior",
119 build_file = "bower.BUILD",
120 #url = "https://github.com/polymerelements/iron-checked-element-behavior/archive/v1.0.4.tar.gz",
121 url = "http://localhost:8080/home/test/tensorflow-dep/iron-checked-element-behavior-1.0.4.tar.gz",
122 strip_prefix = "iron-checked-element-behavior-1.0.4",
123 )
124
125 new_http_archive(
126 name = "iron_collapse",
127 build_file = "bower.BUILD",
128 #url = "https://github.com/polymerelements/iron-collapse/archive/v1.0.8.tar.gz",
129 url = "http://localhost:8080/home/test/tensorflow-dep/iron-collapse-1.0.8.tar.gz",
130 strip_prefix = "iron-collapse-1.0.8",
131 )
132
133 new_http_archive(
134 name = "iron_dropdown",
135 build_file = "bower.BUILD",
136 #url = "https://github.com/polymerelements/iron-dropdown/archive/v1.4.0.tar.gz",
137 url = "http://localhost:8080/home/test/tensorflow-dep/iron-dropdown-1.4.0.tar.gz",
138 strip_prefix = "iron-dropdown-1.4.0",
139 )
140
141 new_http_archive(
142 name = "iron_fit_behavior",
143 build_file = "bower.BUILD",
144 #url = "https://github.com/polymerelements/iron-fit-behavior/archive/v1.2.5.tar.gz",
145 url = "http://localhost:8080/home/test/tensorflow-dep/iron-fit-behavior-1.2.5.tar.gz",
146 strip_prefix = "iron-fit-behavior-1.2.5",
147 )
148
149 new_http_archive(
150 name = "iron_flex_layout",
151 build_file = "bower.BUILD",
152 #url = "https://github.com/polymerelements/iron-flex-layout/archive/v1.3.0.tar.gz",
153 url = "http://localhost:8080/home/test/tensorflow-dep/iron-flex-layout-1.3.0.tar.gz",
154 strip_prefix = "iron-flex-layout-1.3.0",
155 )
269 http_file(
270 name = "numericjs_numeric_min_js",
271 #url = "https://cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js",
272 url = "http://localhost:8080/home/test/tensorflow-dep/numeric.min.js",
273 )
394 new_http_archive(
395 name = "paper_radio_group",
396 build_file = "bower.BUILD",
397 #url = "https://github.com/polymerelements/paper-radio-group/archive/v1.0.9.tar.gz",
398 url = "http://localhost:8080/home/test/tensorflow-dep/paper-radio-group-master.zip",
399 strip_prefix = "paper-radio-group-master",
400 )
---------------------------------------------------------------------------------
(5)修改 /home/test/vv/tensorflow-master/tensorflow/tensorflow.bzl如下:
739 def tf_extension_linkopts():
740 #return [] # No extension link opts
741 return ["-lrt"]
---------------------------------------------------------------------------------
(6)重新./configure
---------------------------------------------------------------------------------
(7)编译:
bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
---------------------------------------------------------------------------------
(8)python打包
cd /home/test/vv/tensorflow-master/
mkdir _python_build
cd _python_build
ln -s ../bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/* .
ln -s ../tensorflow/tools/pip_package/* .
python setup.py develop
=================================================================================
5.使用