Skip to content

Commit 482dbef

Browse files
author
Ferran Perez Gamonal
committed
add def file for tf 1.15 + update build script accordingly
1 parent 64ea5b0 commit 482dbef

File tree

3 files changed

+399
-20
lines changed

3 files changed

+399
-20
lines changed

build.ps1

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ param (
99
[switch]$ReserveSource = $false,
1010
[switch]$ReserveVenv = $false,
1111
[switch]$IgnoreDepsVersionIssues = $false,
12-
[switch]$InstallDefaultDeps = $false
12+
[switch]$InstallDefaultDeps = $false,
13+
[switch]$UseForkedVersion = $false
1314
)
1415

1516
# Set parameters for execution.
@@ -28,7 +29,7 @@ if (!$ReserveSource -and (Test-Path source)) {
2829
}
2930

3031
# Ask the specific version of Tensorflow.
31-
$supportedVersions = @("v1.13.1", "v1.12.0", "v1.11.0")
32+
$supportedVersions = @("v1.15.3","v1.13.1", "v1.12.0", "v1.11.0")
3233
$options = [Array]::CreateInstance([System.Management.Automation.Host.ChoiceDescription], $supportedVersions.Count)
3334
for ($i = 0; $i -lt $supportedVersions.Count; $i++) {
3435
$options[$i] = [System.Management.Automation.Host.ChoiceDescription]::new("&$($i + 1) - $($supportedVersions[$i])",
@@ -94,18 +95,31 @@ if ($buildVersion -eq "v1.11.0" -or $buildVersion -eq "v1.12.0") {
9495
$bazelVersion = "0.15.0"
9596
} elseif ($buildVersion -eq "v1.13.1") {
9697
$bazelVersion = "0.20.0"
98+
} elseif ($buildVersion -eq "v1.15.3") {
99+
$bazelVersion = "0.26.0" # chocolatey does not have subversions, only 0.26.0 or 0.27.0, staying with 0.26.0
97100
}
98101

99102
# Installation of dependencies
100103
if (!(CheckInstalled chocolatey)) {
101104
Write-Host "Installing Chocolatey package manager."
102105
Set-ExecutionPolicy Bypass -Scope Process -Force
103-
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString("https://chocolatey.org/install.ps1"))
106+
# Invoke-Expression ((New-Object System.Net.WebClient).DownloadString("https://chocolatey.org/install.ps1"))
107+
108+
# Updated powershell command from chocolatey website
109+
Set-ExecutionPolicy Bypass -Scope Process -Force
110+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
111+
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
112+
113+
104114
}
105115
choco feature enable -n allowGlobalConfirmation | Out-Null # Enable global confirmation for chocolatey package installation.
106116

107117
if (!(CheckInstalled pacman)) {
108-
$version = askForVersion "20180531.0.0"
118+
if ($buildVersion -eq "v1.15.3") {
119+
$version = askForVersion "20200602.0.0"
120+
} else {
121+
$version = askForVersion "20180531.0.0"
122+
}
109123
choco install msys2 --version $version --params "/NoUpdate /InstallDir:C:\msys64"
110124
}
111125
$ENV:Path += ";C:\msys64\usr\bin"
@@ -136,21 +150,30 @@ if (!(CheckInstalled python "3.6.7")) {
136150
}
137151

138152
# Get the source code of Tensorflow and checkout to the specific version.
139-
if (!$ReserveSource) {
140-
git clone https://github.com/tensorflow/tensorflow.git
141-
Rename-Item tensorflow source
142-
Set-Location source
143-
} else {
144-
Set-Location source
145-
git fetch
146-
git reset --hard origin/master
147-
git checkout -f master
148-
git pull
153+
if ($UseForkedVersion) { # TODO: if this is the case, do not apply the patch?
154+
Set-Location source # simply change to source, leave the code as is!
155+
if ($buildVersion -eq "v1.15.3") {
156+
git checkout r1.15 # to add any new changes vs 1.15.3 (maybe there are none)
157+
} else {
158+
git checkout -f tags/$buildVersion
159+
}
149160
}
161+
else {
162+
if (!$ReserveSource) {
163+
git clone https://github.com/tensorflow/tensorflow.git
164+
Rename-Item tensorflow source
165+
Set-Location source
166+
} else {
167+
Set-Location source
168+
git fetch
169+
git reset --hard origin/master
170+
git checkout -f master
171+
git pull
172+
}
150173

151-
git checkout -f tags/$buildVersion
152-
git clean -fx
153-
174+
git checkout -f tags/$buildVersion
175+
git clean -fx
176+
}
154177
# Apply patches to source.
155178
if ($buildVersion -eq "v1.11.0") {
156179
# Eigen Patch for v1.11.0
@@ -163,6 +186,7 @@ if ($buildVersion -eq "v1.11.0") {
163186
} elseif ($buildVersion -eq "v1.13.1") {
164187
git apply --ignore-space-change --ignore-white '..\patches\vs_2017.1.13.1.patch'
165188
}
189+
# In 1.15.3 the 'vs_2017.1.13.1.patch' has already been integrated into the code.
166190

167191
if ($BuildCppAPI) {
168192
if ($buildVersion -eq "v1.11.0") {
@@ -177,6 +201,9 @@ if ($BuildCppAPI) {
177201
# C++ Symbol Patch for v1.13.1
178202
git apply --ignore-space-change --ignore-white "..\patches\cpp_symbol.1.13.1.patch"
179203
Copy-Item ..\patches\tf_exported_symbols_msvc.lds tensorflow\
204+
} elseif ($buildVersion -eq "v1.15.3") {
205+
# Copy user-defined list of symbols from 'def_file_filter.py.tpl' equivalent to 'tf_exported_symbols_msvc.lds' in TF 1.15
206+
Copy-Item ..\patches\def_file_filter.py.tpl tensorflow\tools\def_file_filter\ -Force
180207
}
181208
}
182209

@@ -193,8 +220,13 @@ if (!$ReserveVenv) {
193220
py -3 -m venv venv
194221
.\venv\Scripts\Activate.ps1
195222
pip3 install six numpy wheel
196-
pip3 install keras_applications==1.0.5 --no-deps
197-
pip3 install keras_preprocessing==1.0.3 --no-deps
223+
if ($buildVersion -eq "v1.15.3") {
224+
pip3 install keras_applications==1.0.6 --no-deps
225+
pip3 install keras_preprocessing==1.0.5 --no-deps
226+
} else {
227+
pip3 install keras_applications==1.0.5 --no-deps
228+
pip3 install keras_preprocessing==1.0.3 --no-deps
229+
}
198230
} else {
199231
.\venv\Scripts\Activate.ps1
200232
}

0 commit comments

Comments
 (0)