-
Notifications
You must be signed in to change notification settings - Fork 33
141 lines (135 loc) · 5.12 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Windows Test
on:
workflow_call:
inputs:
pytorch:
required: false
type: string
default: 'main'
description: Pytorch branch/commit
keep_torch_xpu_ops:
required: false
type: string
default: 'false'
description: Keep torch-xpu-ops pin. `true` means use pined commit
ut:
required: false
type: string
default: ''
description: UT scope. `op_example,op_extended,op_ut,torch_xpu` Delimiter is comma
abi:
required: false
type: string
default: 1
description: ABI version. Default abi as 1.
python:
required: false
type: string
default: '3.10'
description: Python version
runner:
required: true
type: string
default: 'linux.idc.xpu'
description: Runner label
permissions: read-all
env:
USE_XPU: 1
VS2022INSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat'
jobs:
Torch-XPU-Windows-Build:
runs-on: ${{ inputs.runner }}
timeout-minutes: 900
steps:
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
- name: Install oneAPI bundle and pti
shell: cmd
run: |
call .github\scripts\install_xpu.bat
if errorlevel 1 exit /b 1
- name: Prepare Stock Pytorch
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call conda clean -ay
call conda remove --all -y -n windows_ci
call conda create -n windows_ci python=${{ inputs.python }} cmake ninja -y
call conda activate windows_ci
cd ..
if exist "pytorch" (
rmdir /s /q pytorch
)
git clone https://github.com/pytorch/pytorch pytorch
cd pytorch && git checkout ${{ inputs.pytorch }}
call pip install pyyaml requests
call conda install conda-forge::rust -y
call conda install typing_extensions -y
python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py
git status && git show -s
git submodule sync && git submodule update --init --recursive
if ${{ inputs.keep_torch_xpu_ops }} == 'true' (
echo "Don't replace torch-xpu-ops!"
) else (
cd third_party
if exist "torch-xpu-ops" (
rmdir /s /q torch-xpu-ops
)
cd ..
Xcopy ..\torch-xpu-ops third_party\torch-xpu-ops /E/H/Y/F/I
)
- name: Build Pytorch XPU
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call 'C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' x64
set VS2022INSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\BuildTools\
call conda activate windows_ci
call "C:\Program Files (x86)\Intel\oneAPI\pytorch-gpu-dev-0.5\oneapi-vars.bat"
call "C:\Program Files (x86)\Intel\oneAPI\pti\latest\env\vars.bat"
pip install mkl-static mkl-include
cd ../pytorch
pip install -r requirements.txt
set USE_XPU=1
set CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
if ${{ inputs.abi }} == '0' (
set _GLIBCXX_USE_CXX11_ABI=0
) else (
set _GLIBCXX_USE_CXX11_ABI=1
)
python setup.py bdist_wheel > build_torch_wheel_log.log
for %%f in (${{ github.workspace }}\..\pytorch\dist\torch-*.whl) do (
set "TORCH_WHL=%%f"
echo "INFO - torch whl found"
)
if defined TORCH_WHL (
pip install %TORCH_WHL%
echo "INFO - torch whl installed"
) else (
echo "INFO - No torch whl found."
exit /b 1
)
pip install --force-reinstall dist/*.whl
pip install -r .ci/docker/requirements-ci.txt
- name: Torch Config
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call conda activate windows_ci
call "C:\Program Files (x86)\Intel\oneAPI\pytorch-gpu-dev-0.5\oneapi-vars.bat"
call "C:\Program Files (x86)\Intel\oneAPI\pti\latest\env\vars.bat"
python -c "import torch; print(torch.__config__.show())"
python -c "import torch; print(torch.__config__.parallel_info())"
python -c "import torch; print(torch.__config__.torch.xpu.device_count())"
- name: Upload Windows build log
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Torch-XPU-Windows-Log-${{ github.event.pull_request.number || github.sha }}
path: 'C:\actions-runner\_work\torch-xpu-ops\pytorch\build_torch_wheel_log.log'
- name: Upload Windows binary
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Torch-XPU-Windows-Binary-${{ github.event.pull_request.number || github.sha }}
path: 'C:\actions-runner\_work\torch-xpu-ops\pytorch\dist'