Skip to content

Commit 0934a4f

Browse files
authored
[ML] Upgrade to PyTorch 1.9 on Windows (#2030)
macOS and Linux have already been upgraded. Moving to version 1.9 allows a build workaround to be removed. We also enable oneDNN, but do not yet use MKL as the BLAS. (Potentially we can try that in the next upgrade, after we've had a chance to see the Linux benefit in production.)
1 parent 920dc3e commit 0934a4f

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

build-setup/windows.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ On the "Advanced Options" screen, check "Install for all users" and "Add Python
213213

214214
For the time being, do not take advantage of the option on the final installer screen to reconfigure the machine to allow paths longer than 260 characters. We still support Windows versions that do not have this option.
215215

216-
### PyTorch 1.8.0
216+
### PyTorch 1.9.0
217217

218218
PyTorch requires that certain Python modules are installed. Start a command prompt "cmd.exe" using "Run as administrator". In it run:
219219

@@ -227,7 +227,7 @@ Next, in a Git bash shell run:
227227

228228
```
229229
cd /c/tools
230-
git clone --depth=1 --branch=v1.8.0 git@github.com:pytorch/pytorch.git
230+
git clone --depth=1 --branch=v1.9.0 git@github.com:pytorch/pytorch.git
231231
cd pytorch
232232
git submodule sync
233233
git submodule update --init --recursive
@@ -265,20 +265,6 @@ doing and never want to do for security reasons. Replacing the calls to
265265
potentially dangerous function calls in our shipped product will not encounter
266266
these functions that run external processes.
267267

268-
In `torch/CMakeLists.txt` remove the guards around `onnx_library`, i.e. change lines 98-100 from:
269-
270-
```
271-
if(BUILD_TEST)
272-
list(APPEND TORCH_PYTHON_LINK_LIBRARIES onnx_library)
273-
endif(BUILD_TEST)
274-
```
275-
276-
to:
277-
278-
```
279-
list(APPEND TORCH_PYTHON_LINK_LIBRARIES onnx_library)
280-
```
281-
282268
Start a command prompt using Start Menu -> Apps -> Visual Studio 2019 -> x64 Native Tools Command Prompt for VS 2019, then in it type:
283269

284270
```
@@ -287,11 +273,12 @@ set BUILD_TEST=OFF
287273
set BUILD_CAFFE2=OFF
288274
set USE_NUMPY=OFF
289275
set USE_DISTRIBUTED=OFF
276+
set USE_MKLDNN=ON
290277
set USE_QNNPACK=OFF
291278
set USE_PYTORCH_QNNPACK=OFF
292279
set USE_XNNPACK=OFF
293280
set MSVC_Z7_OVERRIDE=OFF
294-
set PYTORCH_BUILD_VERSION=1.8.0
281+
set PYTORCH_BUILD_VERSION=1.9.0
295282
set PYTORCH_BUILD_NUMBER=1
296283
python setup.py install
297284
```
@@ -302,6 +289,7 @@ To finish off, in a Git bash shell run:
302289

303290
```
304291
cd /c/tools/pytorch
292+
rm -rf /c/usr/local/include/pytorch
305293
mkdir /c/usr/local/include/pytorch
306294
cp -r torch/include/* /c/usr/local/include/pytorch/
307295
cp torch/lib/torch_cpu.dll /c/usr/local/bin/
@@ -313,4 +301,3 @@ cp torch/lib/fbgemm.lib /c/usr/local/lib/
313301
cp torch/lib/asmjit.dll /c/usr/local/bin/
314302
cp torch/lib/asmjit.lib /c/usr/local/lib/
315303
```
316-

dev-tools/download_windows_deps.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# limitation.
1010
#
1111
$ErrorActionPreference="Stop"
12-
$Archive="usr-x86_64-windows-2016-3.zip"
12+
$Archive="usr-x86_64-windows-2016-4.zip"
1313
$Destination="C:\"
14-
if (!(Test-Path "$Destination\usr\local\bin\torch_cpu.dll")) {
14+
if (!(Test-Path "$Destination\usr\local\include\pytorch\torch\csrc\jit\passes\frozen_ops_to_mkldnn.h")) {
1515
Remove-Item "$Destination\usr" -Recurse -Force -ErrorAction Ignore
1616
$ZipSource="https://s3-eu-west-1.amazonaws.com/prelert-artifacts/dependencies/$Archive"
1717
$ZipDestination="$Env:TEMP\$Archive"

0 commit comments

Comments
 (0)