Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / mkl-dnn / scripts / prepare_mkl.sh
1 #!/bin/sh
2 #===============================================================================
3 # Copyright 2016-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 MKLURLROOT="https://github.com/intel/mkl-dnn/releases/download/v0.18-rc/"
19 MKLVERSION="2019.0.3.20190125"
20
21 os=`uname`
22 if [ "$os" = "Linux" ]; then
23   MKLPACKAGE="mklml_lnx_${MKLVERSION}"
24 elif [ "$os" = "Darwin" ]; then
25   MKLPACKAGE="mklml_mac_${MKLVERSION}"
26 else
27   echo "Cannot identify operating system. Try downloading package manually."
28   exit 1
29 fi
30
31 MKLURL=${MKLURLROOT}${MKLPACKAGE}.tgz
32 DST=`dirname $0`/../external
33 mkdir -p $DST
34 DST=`cd $DST;pwd`
35
36 if [ ! -e "${DST}/${MKLPACKAGE}/license.txt" ]; then
37   if [ -x "$(command -v curl)" ]; then
38     curl -L -o "${DST}/${MKLPACKAGE}.tgz" "$MKLURL"
39   elif [ -x "$(command -v wget)" ]; then
40     wget -O "${DST}/${MKLPACKAGE}.tgz" "$MKLURL"
41   else
42     echo "curl or wget not available"
43     exit 1
44   fi
45
46   if [ \! $? ]; then
47     echo "Download from $MKLURL to $DST failed"
48     exit 1
49   fi
50
51   tar -xzf "$DST/${MKLPACKAGE}.tgz" -C $DST
52   echo "Downloaded and unpacked Intel(R) MKL small libraries to $DST"
53 else
54   echo "Intel(R) MKL small libraries are already installed in $DST"
55 fi