1
1
#! /usr/bin/env bash
2
2
3
+ # set -x
3
4
set -e
4
5
5
6
if [[ " $1 " == " cpu" ]]; then
@@ -20,6 +21,9 @@ cd deps
20
21
if [[ ! -d dlpack ]]; then
21
22
echo " Cloning dlpack..."
22
23
git clone --depth 1 https://github.com/dmlc/dlpack.git
24
+ echo " Done."
25
+ else
26
+ echo " dlpack is in place."
23
27
fi
24
28
25
29
# ## TENSORFLOW
@@ -57,8 +61,14 @@ if [[ ! -d tensorflow ]]; then
57
61
58
62
[[ ! -f $LIBTF_ARCHIVE ]] && wget --quiet $LIBTF_URL_BASE /$LIBTF_ARCHIVE
59
63
60
- mkdir -p tensorflow
61
- tar xf $LIBTF_ARCHIVE --no-same-owner --strip-components=1 -C tensorflow
64
+ rm -rf tensorflow.x
65
+ mkdir tensorflow.x
66
+ tar xf $LIBTF_ARCHIVE --no-same-owner --strip-components=1 -C tensorflow.x
67
+ mv tensorflow.x tensorflow
68
+
69
+ echo " Done."
70
+ else
71
+ echo " TensorFlow is in place."
62
72
fi
63
73
64
74
# ## PYTORCH
@@ -91,9 +101,18 @@ if [[ ! -d libtorch ]]; then
91
101
LIBTORCH_ARCHIVE=libtorch-${PT_BUILD} -${PT_OS} -${PT_ARCH} -${PT_VERSION} .tar.gz
92
102
[[ -z $LIBTORCH_URL ]] && LIBTORCH_URL=https://s3.amazonaws.com/redismodules/pytorch/$LIBTORCH_ARCHIVE
93
103
94
- [[ ! -f $LIBTORCH_ARCHIVE ]] && wget --quiet $LIBTORCH_URL
104
+ [[ ! -f $LIBTORCH_ARCHIVE ]] && wget -q $LIBTORCH_URL
105
+
106
+ rm -rf libtorch.x
107
+ mkdir libtorch.x
95
108
96
- tar xf $LIBTORCH_ARCHIVE --no-same-owner
109
+ tar xf $LIBTORCH_ARCHIVE --no-same-owner -C libtorch.x
110
+ mv libtorch.x/libtorch libtorch
111
+ rmdir libtorch.x
112
+
113
+ echo " Done."
114
+ else
115
+ echo " librotch is in place."
97
116
fi
98
117
99
118
# ## MKL
@@ -106,44 +125,69 @@ if [[ ! -d mkl ]]; then
106
125
107
126
MKL_OS=mac
108
127
MKL_ARCHIVE=mklml_${MKL_OS} _${MKL_BUNDLE_VER} .tgz
109
- [[ ! -e ${MKL_ARCHIVE} ]] && wget --quiet https://github.com/intel/mkl-dnn/releases/download/v${MKL_VERSION} /${MKL_ARCHIVE}
110
- mkdir -p mkl
111
- tar xzf ${MKL_ARCHIVE} --no-same-owner --strip-components=1 -C deps/mkl
128
+ [[ ! -e ${MKL_ARCHIVE} ]] && wget -q https://github.com/intel/mkl-dnn/releases/download/v${MKL_VERSION} /${MKL_ARCHIVE}
129
+
130
+ rm -rf mkl.x
131
+ mkdir mkl.x
132
+ tar xzf ${MKL_ARCHIVE} --no-same-owner --strip-components=1 -C mkl.x
133
+ mv mkl.x mkl
134
+
135
+
136
+ echo " Done."
112
137
fi
138
+ else
139
+ echo " mkl is in place."
113
140
fi
114
141
115
142
# ## ONNXRUNTIME
116
143
117
144
ORT_VERSION=" 0.4.0"
118
145
119
146
if [[ $OS == linux ]]; then
120
- if [[ $GPU == no ]]; then
121
- ORT_OS=" linux-x64"
122
- ORT_BUILD=" cpu"
123
- else
124
- ORT_OS=" linux-x64-gpu"
125
- ORT_BUILD=" gpu"
126
- fi
147
+ if [[ $GPU == no ]]; then
148
+ ORT_OS=" linux-x64"
149
+ ORT_BUILD=" cpu"
150
+ else
151
+ ORT_OS=" linux-x64-gpu"
152
+ ORT_BUILD=" gpu"
153
+ fi
127
154
elif [[ $OS == macosx ]]; then
128
- ORT_OS=" osx-x64"
129
- ORT_BUILD=" "
155
+ ORT_OS=" osx-x64"
156
+ ORT_BUILD=" "
130
157
fi
131
158
132
159
ORT_ARCHIVE=onnxruntime-${ORT_OS} -${ORT_VERSION} .tgz
133
160
134
- if [ ! -e ${ORT_ARCHIVE} ]; then
135
- echo " Downloading ONNXRuntime ${ORT_VERSION} ${ORT_BUILD} "
136
- wget -q https://github.com/Microsoft/onnxruntime/releases/download/v${ORT_VERSION} /${ORT_ARCHIVE}
137
- fi
161
+ if [[ ! -d onnx ]]; then
162
+ echo " Installing onnx..."
138
163
139
- tar xf ${ORT_ARCHIVE} --no-same-owner --strip-components=1 -C ${PREFIX}
164
+ if [[ ! -e ${ORT_ARCHIVE} ]]; then
165
+ echo " Downloading ONNXRuntime ${ORT_VERSION} ${ORT_BUILD} ..."
166
+ wget -q https://github.com/Microsoft/onnxruntime/releases/download/v${ORT_VERSION} /${ORT_ARCHIVE}
167
+ echo " Done."
168
+ fi
169
+
170
+ rm -rf onnx.x
171
+ mkdir onnx.x
172
+ tar xzf ${ORT_ARCHIVE} --no-same-owner --strip-components=1 -C onnx.x
173
+ mv onnx.x onnx
174
+
175
+ echo " Done."
176
+ else
177
+ echo " onnx is in place."
178
+ fi
140
179
141
180
# ## Collect libraries
142
181
143
182
if [[ ! -d install ]]; then
144
183
echo " Collecting binaries..."
145
184
146
- python3 collect-bin.py
185
+ rm -rf install.x
186
+ mkdir install.x
187
+ python3 collect-bin.py --into install.x
188
+ mv install.x install
189
+
190
+ echo " Done."
147
191
fi
148
192
149
193
# echo "Done"
0 commit comments