Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / mkl-dnn / scripts / prepare_mkl.bat
1 @echo off
2 rem ===============================================================================
3 rem Copyright 2018 Intel Corporation
4 rem
5 rem Licensed under the Apache License, Version 2.0 (the "License");
6 rem you may not use this file except in compliance with the License.
7 rem You may obtain a copy of the License at
8 rem
9 rem     http://www.apache.org/licenses/LICENSE-2.0
10 rem
11 rem Unless required by applicable law or agreed to in writing, software
12 rem distributed under the License is distributed on an "AS IS" BASIS,
13 rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 rem See the License for the specific language governing permissions and
15 rem limitations under the License.
16 rem ===============================================================================
17
18 rem req: PowerShell 3.0+
19 powershell.exe -command "if ($PSVersionTable.PSVersion.Major -ge 3) {exit 1} else {Write-Host \"The script requires PowerShell 3.0 or above (current version: $($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor))\"}" && goto Error_load
20
21 set MKLURLROOT=https://github.com/intel/mkl-dnn/releases/download/v0.18-rc/
22 set MKLVERSION=2019.0.3.20190125
23
24 set MKLPACKAGE=mklml_win_%MKLVERSION%
25
26 set MKLURL=%MKLURLROOT%%MKLPACKAGE%.zip
27 if /i "%1"=="" (
28         set DST=%~dp0..\external
29 ) else (
30         set DST=%1\..\external
31 )
32
33 if not exist %DST% mkdir %DST%
34
35 if not exist "%DST%\%MKLPACKAGE%\license.txt" (
36         powershell.exe -command "if (Get-Command Invoke-WebRequest -errorAction SilentlyContinue){[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %MKLURL% -OutFile %DST%\%MKLPACKAGE%.zip} else {exit 1}" && goto Unpack || goto Error_load
37
38 :Unpack
39         powershell.exe -command "if (Get-Command Add-Type -errorAction SilentlyContinue) {Add-Type -Assembly \"System.IO.Compression.FileSystem\"; try { [IO.Compression.zipfile]::ExtractToDirectory(\"%DST%\%MKLPACKAGE%.zip\", \"%DST%\")}catch{$_.exception ; exit 1}} else {exit 1}" && goto Exit || goto Error_unpack
40
41 :Error_load
42         echo prepare_mkl.bat : Error: Failed to load %MKLURL% to %DST%, try to load it manually
43         exit /B 1
44
45 :Error_unpack
46         echo prepare_mkl.bat : Error: Failed to unpack %DST%\%MKLPACKAGE%.zip to %DST%, try unpack the archive manually
47         exit /B 1
48
49 :Exit
50         echo Downloaded and unpacked Intel^(R^) MKL small libraries to %DST%
51         exit /B 0
52 ) else (
53         echo Intel^(R^) MKL small libraries are already installed in %DST%
54         exit /B 0
55 )