17
17
# # * OSX
18
18
# # =================================================================
19
19
20
+ set -o errexit
20
21
21
22
# Determine OS platform
22
23
UNAME=$( uname | tr " [:upper:]" " [:lower:]" )
37
38
unset UNAME
38
39
DISTRO=$( echo $DISTRO | tr " [:lower:]" " [:upper:]" )
39
40
TMPDIR=/tmp
40
- TF_VERSION=" 1.4.0"
41
41
TF_TYPE=" cpu"
42
42
43
43
@@ -55,14 +55,13 @@ function install_protobuf3.4.0() {
55
55
echo " Only Ubuntu and Fedora is supported currently!"
56
56
return 0
57
57
fi
58
- CWD=` pwd`
59
- cd $TMPDIR
60
58
wget -O protobuf-cpp-3.4.0.tar.gz https://github.com/google/protobuf/releases/download/v3.4.0/protobuf-cpp-3.4.0.tar.gz
61
59
tar -xzf protobuf-cpp-3.4.0.tar.gz
62
60
cd protobuf-3.4.0
63
61
./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig
64
- # Do cleanup
65
- cd $CWD
62
+ cd ..
63
+ # Cleanup
64
+ rm -rf protobuf-3.4.0 protobuf-cpp-3.4.0.tar.gz
66
65
}
67
66
68
67
# Utility function for installing tensorflow components of python/C++
@@ -72,14 +71,16 @@ function install_tf() {
72
71
LinkerConfigCmd=$3
73
72
TARGET_DIRECTORY=" /usr/local"
74
73
# Install Tensorflow Python Binary
75
- sudo pip3 install --upgrade ${TFBinaryURL}
74
+ sudo -E pip3 install --upgrade ${TFBinaryURL}
76
75
77
76
# Install C-API
78
77
TFCApiURL=" https://storage.googleapis.com/tensorflow/libtensorflow/${TFCApiFile} "
79
78
wget -O $TFCApiFile $TFCApiURL
80
- sudo tar -C $TARGET_DIRECTORY -xzf $TFCApiFile
79
+ sudo tar -C $TARGET_DIRECTORY -xzf $TFCApiFile || true
81
80
# Configure the Linker
82
81
eval $LinkerConfigCmd
82
+ # Cleanup
83
+ rm -rf ${TFCApiFile}
83
84
}
84
85
85
86
# # ------------------------------------------------
@@ -103,37 +104,39 @@ if [ "$DISTRO" = "UBUNTU" ]; then
103
104
echo -e " \n# Added by Peloton 'packages.sh' script on $( date) \ndeb $LLVM_PKG_URL $LLVM_PKG_TARGET " | sudo tee -a /etc/apt/sources.list > /dev/null
104
105
fi
105
106
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421
106
- sudo apt-get update -qq
107
107
CMAKE_NAME=" cmake3"
108
- FORCE_Y=" --force-yes"
109
108
else
110
109
CMAKE_NAME=" cmake"
111
- FORCE_Y=" "
112
110
fi
113
111
112
+ sudo apt-get update
114
113
FORCE_Y=" "
115
114
PKG_CMAKE=" cmake"
116
115
PKG_LLVM=" llvm-3.7"
117
116
PKG_CLANG=" clang-3.7"
117
+ TF_VERSION=" 1.4.0"
118
118
119
119
# Fix for cmake name change on Ubuntu 14.x and 16.x plus --force-yes deprecation
120
120
if [ " $MAJOR_VER " == " 14" ]; then
121
121
PKG_CMAKE=" cmake3"
122
122
FORCE_Y=" --force-yes"
123
+ TF_VERSION=" 1.4.0"
123
124
TFBinaryURL=" https://storage.googleapis.com/tensorflow/linux/${TF_TYPE} /tensorflow-${TF_VERSION} -cp34-cp34m-linux_x86_64.whl"
124
125
fi
125
126
if [ " $MAJOR_VER " == " 16" ]; then
127
+ TF_VERSION=" 1.5.0"
126
128
TFBinaryURL=" https://storage.googleapis.com/tensorflow/linux/${TF_TYPE} /tensorflow-${TF_VERSION} -cp35-cp35m-linux_x86_64.whl"
127
129
fi
128
130
# Fix for llvm on Ubuntu 17.x
129
131
if [ " $MAJOR_VER " == " 17" ]; then
130
132
PKG_LLVM=" llvm-3.9"
131
133
PKG_CLANG=" clang-3.8"
134
+ TF_VERSION=" 1.5.0"
132
135
TFBinaryURL=" https://storage.googleapis.com/tensorflow/linux/${TF_TYPE} /tensorflow-${TF_VERSION} -cp35-cp35m-linux_x86_64.whl"
133
136
fi
134
137
TFCApiFile=" libtensorflow-${TF_TYPE} -linux-x86_64-${TF_VERSION} .tar.gz"
135
138
LinkerConfigCmd=" sudo ldconfig"
136
- sudo apt-get -qq $FORCE_Y --ignore-missing -y install \
139
+ sudo apt-get -q $FORCE_Y --ignore-missing -y install \
137
140
$PKG_CMAKE \
138
141
$PKG_LLVM \
139
142
$PKG_CLANG \
@@ -170,7 +173,7 @@ if [ "$DISTRO" = "UBUNTU" ]; then
170
173
# # DEBIAN
171
174
# # ------------------------------------------------
172
175
elif [ " $DISTRO " = " DEBIAN OS" ]; then
173
- sudo apt-get -qq --ignore-missing -y install \
176
+ sudo apt-get -q --ignore-missing -y install \
174
177
git \
175
178
g++ \
176
179
clang \
@@ -201,6 +204,7 @@ elif [[ "$DISTRO" == *"FEDORA"* ]]; then
201
204
26) LLVM=" llvm" ;;
202
205
* ) LLVM=" llvm4.0" ;;
203
206
esac
207
+ TF_VERSION=" 1.5.0"
204
208
TFCApiFile=" libtensorflow-${TF_TYPE} -linux-x86_64-${TF_VERSION} .tar.gz"
205
209
TFBinaryURL=" https://storage.googleapis.com/tensorflow/linux/${TF_TYPE} /tensorflow-${TF_VERSION} -cp36-cp36m-linux_x86_64.whl"
206
210
LinkerConfigCmd=" sudo ldconfig"
@@ -311,10 +315,12 @@ elif [[ "$DISTRO" == *"REDHAT"* ]] && [[ "${DISTRO_VER%.*}" == "7" ]]; then
311
315
# # DARWIN (OSX)
312
316
# # ------------------------------------------------
313
317
elif [ " $DISTRO " = " DARWIN" ]; then
318
+ set +o errexit
314
319
if test ! $( which brew) ; then
315
320
echo " Installing homebrew..."
316
321
ruby -e " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) "
317
322
fi
323
+ TF_VERSION=" 1.4.0"
318
324
TFBinaryURL=" https://storage.googleapis.com/tensorflow/mac/${TF_TYPE} /tensorflow-${TF_VERSION} -py3-none-any.whl"
319
325
TFCApiFile=" libtensorflow-${TF_TYPE} -darwin-x86_64-${TF_VERSION} .tar.gz"
320
326
LinkerConfigCmd=" sudo update_dyld_shared_cache"
@@ -333,6 +339,7 @@ elif [ "$DISTRO" = "DARWIN" ]; then
333
339
334
340
brew install postgresql
335
341
brew install curl
342
+ brew install wget
336
343
brew install python
337
344
brew upgrade python
338
345
# Brew installs correct version of Protobuf(3.5.1 >= 3.4.0)
0 commit comments