forked from PennyLaneAI/pennylane-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
329 lines (279 loc) · 10.8 KB
/
tests_linux.yml
File metadata and controls
329 lines (279 loc) · 10.8 KB
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: Testing (Linux)
on:
push:
branches:
- master
pull_request:
env:
TF_VERSION: 2.6.0
TORCH_VERSION: 1.10.0+cpu
GCC_VERSION: 10
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native"
OMP_NUM_THREADS: "2"
jobs:
cpptests:
name: C++ tests (Linux)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- uses: actions/checkout@v2
with:
fetch-depth: 2 # for codecov
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-10 g++-10 gcovr lcov
- name: Build and run unit tests
run: |
cmake . -BBuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)"
cmake --build ./Build
mkdir -p ./Build/tests/results
./Build/pennylane_lightning/src/tests/runner --order lex --reporter junit --out ./Build/tests/results/report.xml
- name: Upload test results
uses: actions/upload-artifact@v2
if: always()
with:
name: ubuntu-test-report
path: Build/tests/results/report.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: Test Report (C++) on Ubuntu
files: Build/tests/results/report.xml
- name: Build and run unit tests for code Coverage
run: |
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)"
cmake --build ./BuildCov
cd ./BuildCov
./tests/runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./BuildCov/coverage.info
fail_ci_if_error: true
cpptestswithblas:
name: C++ tests (Linux, OpenBLAS)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-10 g++-10 libopenblas-dev gcovr lcov
- name: Build and run unit tests
run: |
cmake . -BBuild -DCMAKE_BUILD_TYPE=Release -DENABLE_BLAS=ON -DBUILD_TESTS=1 -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)"
cmake --build ./Build
mkdir -p ./Build/tests/results
./Build/pennylane_lightning/src/tests/runner --order lex --reporter junit --out ./Build/tests/results/report.xml
- name: Upload test results
uses: actions/upload-artifact@v2
if: always()
with:
name: ubuntu-test-report
path: Build/tests/results/report.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: Test Report (C++) on Ubuntu
files: Build/tests/results/report.xml
- name: Build and run unit tests for code coverage
run: |
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DENABLE_BLAS=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)"
cmake --build ./BuildCov
cd ./BuildCov
./tests/runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./BuildCov/coverage.info
fail_ci_if_error: true
cpptestswithkokkos:
name: C++ tests (Linux, Kokkos and Kokkos Kernels)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-10 g++-10 gcovr lcov
- name: Build and run unit tests for code coverage
run: |
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DENABLE_KOKKOS=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)"
cmake --build ./BuildCov --parallel 2
cd ./BuildCov
mkdir -p ./tests/results
./tests/runner --order lex --reporter junit --out ./tests/results/report.xml
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./BuildCov/coverage.info
fail_ci_if_error: true
- name: Upload test results
uses: actions/upload-artifact@v2
if: always()
with:
name: ubuntu-test-report
path: BuildCov/tests/results/report.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: Test Report (C++) on Ubuntu
files: BuildCov/tests/results/report.xml
cppbenchmarksuite:
name: C++ Benchmark Suite (Linux, OpenBLAS)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-10 g++-10 libopenblas-dev gcovr lcov
- name: Build and run gbenchmark
run: |
cmake pennylane_lightning/src/ -BBuildGBench -DBUILD_BENCHMARKS=ON -DENABLE_BLAS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)"
cmake --build ./BuildGBench
./BuildGBench/benchmarks/utils
./BuildGBench/benchmarks/apply_operations
pythontests:
name: Python tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v2
with:
path: main
fetch-depth: 2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-10 g++-10
- name: Get required Python packages
run: |
cd main
python -m pip install --upgrade pip
pip install -r requirements.txt
pip uninstall pennylane -y
pip install git+https://github.com/PennyLaneAI/pennylane.git
- name: Install ML libraries for interfaces
run: |
pip install --upgrade torch==$TORCH_VERSION -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install --upgrade "jax[cpu]" # This also installs jaxlib
pip install --upgrade tensorflow~=$TF_VERSION keras~=$TF_VERSION
- name: Install lightning.qubit device
run: |
cd main
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)"
pip install -e .
- name: Run PennyLane-Lightning unit tests
run: |
cd main/
pytest tests/ $COVERAGE_FLAGS
pl-device-test --device lightning.qubit --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device lightning.qubit --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./main/coverage.xml
fail_ci_if_error: true
pythontestsKokkos:
name: Python tests with Kokkos and Kokkos Kernels
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v2
with:
path: main
fetch-depth: 2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc g++
- name: Get required Python packages
run: |
cd main
python -m pip install --upgrade pip
pip install -r requirements.txt
pip uninstall pennylane -y
pip install git+https://github.com/PennyLaneAI/pennylane.git
- name: Install ML libraries for interfaces
run: |
pip install --upgrade torch==$TORCH_VERSION -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install --upgrade "jax[cpu]" # This also installs jaxlib
pip install --upgrade tensorflow~=$TF_VERSION keras~=$TF_VERSION
- name: Install lightning.qubit device
run: |
cd main
python setup.py build_ext -i --define="ENABLE_KOKKOS=ON;CMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)"
pip install -e .
- name: Run PennyLane-Lightning unit tests
run: |
cd main/
pytest tests/ $COVERAGE_FLAGS
pl-device-test --device lightning.qubit --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device lightning.qubit --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./main/coverage.xml
fail_ci_if_error: true