forked from PennyLaneAI/pennylane-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
245 lines (208 loc) · 8.98 KB
/
tests_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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Testing (Windows)
on:
push:
branches:
- master
pull_request:
jobs:
cpptests:
name: C++ tests (Windows)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Configure MSVC for amd64 # Use cl.exe as a default compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Setup OpenCppCoverage and add to PATH
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Build and run unit tests for code coverage
run: |
cmake ./pennylane_lightning/src -BBuild -DBUILD_TESTS=ON -DENABLE_OPENMP=OFF -DENABLE_WARNINGS=OFF
cmake --build ./Build --config Debug
mkdir -p ./Build/tests/results
.\Build\tests\Debug\pennylane_lightning_test_runner.exe --order lex --reporter junit --out .\Build\tests\results\report_cpptests.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\pennylane_lightning_test_runner.exe
Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-test-report
path: .\Build\tests\results\report_${{ github.job }}.xml
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: windows-coverage-report
path: .\coverage-${{ github.job }}.xml
win-set-matrix-x86:
name: Set builder matrix
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v3
- name: Kokkos execution strategy
id: exec_model
run: echo "exec_model=[\"SERIAL\"]" >> $GITHUB_OUTPUT # We may also adopt [OPENMP, THREADS] in later iterations
- name: Kokkos version
id: kokkos_version
run: echo "kokkos_version=[\"3.7.00\"]" >> $GITHUB_OUTPUT
outputs:
exec_model: ${{ steps.exec_model.outputs.exec_model }}
kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }}
build_dependencies:
needs: [win-set-matrix-x86]
strategy:
fail-fast: false
matrix:
os: [windows-2019]
exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }}
name: Kokkos core & kernels (${{ matrix.exec_model }})
runs-on: ${{ matrix.os }}
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Cache installation directories
id: kokkos-cache
uses: actions/cache@v3
with:
path: D:\a\install_dir\${{ matrix.exec_model }}
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug
- name: Clone Kokkos libs
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
cd D:\a
git clone https://github.com/kokkos/kokkos.git
cd D:\a\kokkos
git checkout ${{ matrix.kokkos_version }}
cd D:\a\
git clone https://github.com/kokkos/kokkos-kernels.git
cd D:\a\kokkos-kernels
git checkout ${{ matrix.kokkos_version }}
cd ..
- name: Create installation directory
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: mkdir -p D:\a\install_dir\${{ matrix.exec_model }}
- name: Install dependencies
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
python -m pip install cmake build
- name: Build Kokkos core library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
cd D:\a\kokkos
cmake -BBuild . -DCMAKE_INSTALL_PREFIX=D:\a\install_dir\${{ matrix.exec_model }} `
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF `
-DKokkos_ENABLE_${{ matrix.exec_model }}=ON `
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF `
-DCMAKE_CXX_STANDARD=20 `
-DCMAKE_POSITION_INDEPENDENT_CODE=ON `
-DCMAKE_BUILD_TYPE=Debug `
-T clangcl
cmake --build ./Build --config Debug --verbose
cmake --install ./Build --config Debug --verbose
- name: Build Kokkos kernels library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
cd D:\a\kokkos-kernels
cmake -BBuild . -DCMAKE_INSTALL_PREFIX=D:\a\install_dir\${{ matrix.exec_model }} `
-DKokkos_ENABLE_${{ matrix.exec_model }}=ON `
-DCMAKE_CXX_STANDARD=20 `
-DCMAKE_PREFIX_PATH=D:\a\install_dir\${{ matrix.exec_model }} `
-DCMAKE_POSITION_INDEPENDENT_CODE=ON `
-DCMAKE_BUILD_TYPE=Debug `
-T clangcl
cmake --build ./Build --config Debug --verbose
cmake --install ./Build --config Debug --verbose
cpptestswithkokkos:
needs: [build_dependencies, win-set-matrix-x86]
strategy:
matrix:
os: [windows-2019]
exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }}
name: C++ tests (Windows, Kokkos and Kokkos Kernels)
runs-on: ${{ matrix.os }}
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Restoring cached dependencies
id: kokkos-cache
uses: actions/cache@v3
with:
path: D:\a\install_dir\${{ matrix.exec_model }}
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug
- uses: actions/checkout@v3
- name: Copy cached libraries
if: steps.kokkos-cache.outputs.cache-hit == 'true'
run: |
Copy-Item -Path "D:\a\install_dir\${{ matrix.exec_model }}\" `
-Destination "D:\a\pennylane-lightning\pennylane-lightning\Kokkos" -Recurse -Force
- name: Configure MSVC for amd64 # Use cl.exe as a default compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Enable long paths
run: |
powershell.exe New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- name: Setup OpenCppCoverage and add to PATH
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Build and run unit tests for code coverage
run: |
Subst Z: (pwd)
Set-Location -Path "Z:\"
cmake ./pennylane_lightning/src -BBuild -DBUILD_TESTS=ON -DENABLE_KOKKOS=ON -DCMAKE_PREFIX_PATH=D:\a\pennylane-lightning\pennylane-lightning\Kokkos -DENABLE_OPENMP=OFF -DENABLE_WARNINGS=OFF -T clangcl
cmake --build ./Build --config Debug -- /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true /p:MultiProcMaxCount=2
mkdir -p ./Build/tests/results
.\Build\tests\Debug\pennylane_lightning_test_runner.exe --order lex --reporter junit --out .\Build\tests\results\report_${{ github.job }}.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\pennylane_lightning_test_runner.exe
Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-test-report
path: .\Build\tests\results\report_${{ github.job }}.xml
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: windows-coverage-report
path: .\coverage-${{ github.job }}.xml
upload-to-codecov-windows:
needs: [cpptests, cpptestswithKokkos]
name: Upload coverage data to codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download coverage reports
uses: actions/download-artifact@v3
with:
name: windows-coverage-report
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}