-
Notifications
You must be signed in to change notification settings - Fork 91
/
.drone.script
204 lines (184 loc) · 6.06 KB
/
.drone.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
def main():
return [
# tf_version, ubuntu_version, cuda_version, bazel_version, go_version
build_pipeline_new("1.13.1", "16.04", "10.0", "0.19.2", "1.10"),
# old docker images are spearated
build_pipeline("1.12.0", "16.04", "10.0", "0.16.1", "1.11"),
build_pipeline("1.11.0", "16.04", "10.0", "0.16.1", "1.11"),
build_pipeline("1.10.0", "16.04", "9.2", "0.16.1", "1.10"),
build_pipeline("1.9.0", "16.04", "9.0", "0.11.0", "1.10"),
]
def custom_op_step(image, src_dir):
return {
'name': 'custom_op',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd custom_op/user_ops',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make'
],
}
def inference_cc_step(image, src_dir):
return {
'name': 'inference_cc',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd inference/cc/',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make'
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def inference_c_step(image, src_dir):
return {
'name': 'inference_c',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd inference/c/',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make'
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def inference_go_step(image, tf_version, src_dir):
return {
'name': 'inference_go',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'export LD_LIBRARY_PATH=/tensorflow_dist:$${LD_LIBRARY_PATH}',
'export LD_LIBRARY_PATH=$${TENSORFLOW_BUILD_DIR}/:$${LD_LIBRARY_PATH}',
'export LIBRARY_PATH=$${TENSORFLOW_BUILD_DIR}/:$${LIBRARY_PATH}',
'WDIR=$PWD',
'mkdir -p $GOPATH/src/github.com/tensorflow',
'cd $GOPATH/src/github.com/tensorflow',
'git clone -b v%s --single-branch --depth 1 https://github.com/tensorflow/tensorflow.git' % tf_version,
'cd $WDIR',
'cd inference/go/',
'./build.sh',
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def example_keras(image, src_dir):
return {
'name': 'example_keras',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd examples/keras/',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make',
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def example_simple(image, src_dir):
return {
'name': 'example_simple',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd examples/simple/',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make',
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def example_resize(image, src_dir):
return {
'name': 'example_resize',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd examples/resize/',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make',
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def event_writer(image, src_dir):
return {
'name': 'event_writer',
'pull': 'never',
'image': image,
'commands': [
'export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$${LD_LIBRARY_PATH}',
'cd examples/event_writer/',
'cmake . -DPYTHON_EXECUTABLE=python2',
'make',
],
'environment': {
'TENSORFLOW_BUILD_DIR': '/tensorflow_dist',
'TENSORFLOW_SOURCE_DIR': src_dir
}
}
def build_pipeline(tf_version, ubuntu_version, cuda_version, bazel_version, go_version):
img = 'tensorflow:ubuntu%s-cuda%s-bazel%s-tensorflow%s' % (
ubuntu_version, cuda_version, bazel_version, tf_version)
img_opencv = '%s-opencv3.4.2' % img
img_go = '%s-go%s' % (img, go_version)
return {
'kind': 'pipeline',
'name': 'TensorFlow %s' % tf_version,
'platform': {
'os': "linux",
'arch': 'amd64',
},
'steps': [
custom_op_step(img, '/tensorflow'),
inference_cc_step(img, '/tensorflow'),
inference_c_step(img, '/tensorflow'),
inference_go_step(img_go, tf_version, '/tensorflow'),
example_keras(img, '/tensorflow'),
example_simple(img, '/tensorflow'),
example_resize(img_opencv, '/tensorflow'),
event_writer(img, '/tensorflow'),
]
}
def build_pipeline_new(tf_version, ubuntu_version, cuda_version, bazel_version, go_version):
img = 'tensorflow-cmake:%s-devel' % (tf_version)
return {
'kind': 'pipeline',
'name': 'TensorFlow %s' % tf_version,
'platform': {
'os': "linux",
'arch': 'amd64',
},
'steps': [
custom_op_step(img, '/tensorflow_src'),
inference_cc_step(img, '/tensorflow_src'),
inference_c_step(img, '/tensorflow_src'),
inference_go_step(img, tf_version, '/tensorflow_src'),
example_keras(img, '/tensorflow_src'),
example_simple(img, '/tensorflow_src'),
example_resize(img, '/tensorflow_src'),
event_writer(img, '/tensorflow_src'),
]
}