|
| 1 | +#!/bin/bash -e |
| 2 | +# ****************************************************************************** |
| 3 | +# Copyright 2017-2018 Intel Corporation |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# ****************************************************************************** |
| 17 | + |
| 18 | +# optimized pacakge links |
| 19 | +tf_ver='1.6.0' |
| 20 | +tf_to_install='tensorflow=='${tf_ver} |
| 21 | +tf35='https://anaconda.org/intel/tensorflow/1.6.0/download/tensorflow-1.6.0-cp35-cp35m-linux_x86_64.whl' |
| 22 | +tf36='https://anaconda.org/intel/tensorflow/1.6.0/download/tensorflow-1.6.0-cp36-cp36m-linux_x86_64.whl' |
| 23 | + |
| 24 | + |
| 25 | +# detect python version and OS |
| 26 | +pyver=`python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'` |
| 27 | +platform='other' |
| 28 | +unamestr=`uname` |
| 29 | +if [[ "$unamestr" == 'Linux' ]]; then |
| 30 | + platform='linux' |
| 31 | +fi |
| 32 | + |
| 33 | +ask_which_tf() { |
| 34 | + read -p 'Install Tensorflow MKL-DNN ? [Y/n] ' install_opt_tf |
| 35 | + retval=0 |
| 36 | + case "${install_opt_tf}" in |
| 37 | + y|Y ) retval=1;; |
| 38 | + n|N ) retval=0;; |
| 39 | + "" ) retval=0;; |
| 40 | + esac |
| 41 | + if [ ${retval} == 1 ]; |
| 42 | + then |
| 43 | + if [ ${pyver} == 3.5 ]; |
| 44 | + then |
| 45 | + echo python 3.5 detected; |
| 46 | + tf_to_install=${tf35}; |
| 47 | + elif [ ${pyver} == 3.6 ]; |
| 48 | + then |
| 49 | + echo python 3.6 detected; |
| 50 | + tf_to_install=${tf36}; |
| 51 | + fi |
| 52 | + fi |
| 53 | +} |
| 54 | + |
| 55 | +if [ ${pyver} == 3.5 ] || [ ${pyver} == 3.6 ] ; |
| 56 | +then |
| 57 | + if [ ${platform} == 'linux' ] ; |
| 58 | + then |
| 59 | + ask_which_tf |
| 60 | + fi |
| 61 | +fi |
| 62 | + |
| 63 | +# read file |
| 64 | +while read line |
| 65 | +do |
| 66 | + line=${line/tensorflow*/$tf_to_install} |
| 67 | + echo "$line" |
| 68 | +done < requirements.txt > _generated_reqs.txt |
0 commit comments