forked from oneapi-src/oneDPL
-
Notifications
You must be signed in to change notification settings - Fork 0
441 lines (418 loc) · 18.2 KB
/
ci.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
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
name: oneDPL CI
on:
push:
branches: [main]
pull_request:
branches:
- release_oneDPL
- main
- 'release/**'
permissions: read-all
env:
BUILD_CONCURRENCY: 4
MACOS_BUILD_CONCURRENCY: 3
TEST_TIMEOUT: 360
WINDOWS_TBB_DOWNLOAD_LINK: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/8222de4d-2c5e-41bc-bdd5-f557a9edda28/w_tbb_oneapi_p_2021.13.0.627_offline.exe
WINDOWS_ICPX_DOWNLOAD_LINK: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7991e201-ca0f-4689-bdb6-1ed73a8246fd/w_dpcpp-cpp-compiler_p_2024.2.0.491_offline.exe
WINDOWS_ONEAPI_PATH: C:\Program Files (x86)\Intel\oneAPI
LINUX_ONEAPI_PATH: /opt/intel/oneapi
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'refs/heads/main') }}
jobs:
clang-format:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Get clang-format
run: sudo apt-get install -yqq clang-format
- name: Applying clang-format for changed files
run: |
MERGE_BASE=$(git merge-base ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.base.sha }})
FILES=$(git diff --diff-filter=d --name-only $MERGE_BASE | grep ^include | grep -v nanorange\.hpp\$ || true)
CLANG_FORMAT_DIFF_PATH=$(which clang-format-diff)
echo $FILES | xargs -n1 -t -r git diff -U0 --no-color --relative $MERGE_BASE | python3 $CLANG_FORMAT_DIFF_PATH -i -p1 -style file
if: github.event_name == 'pull_request' || github.event_name == 'push'
- name: Creating diff
run: git diff > clang-format.diff
- name: Checking if diff is empty
run: if [ -s clang-format.diff ]; then cat clang-format.diff; exit 1; fi
- if: failure()
name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: clang-format-diff
path: clang-format.diff
retention-days: 3
codespell:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
sudo apt update && sudo apt install -y codespell
- name: Run scan
run: |
${GITHUB_WORKSPACE}/.github/scripts/codespell.sh $(pwd)
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install prerequisites
run: |
echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV
python -m pip install -r documentation/library_guide/requirements.txt
- name: Build documentation
run: |
mkdir html
sphinx-build -b html documentation/library_guide/ html/
- name: Archive build directory
uses: actions/upload-artifact@v4
with:
name: onedpl-html-docs-${{ env.GITHUB_SHA_SHORT }}
path: html
linux-testing:
name: ${{ matrix.device_type }},bknd=${{ matrix.backend }},cmplr=${{ matrix.cxx_compiler }},${{ matrix.os }},std=с++${{ matrix.std }},cfg=${{ matrix.build_type }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cxx_compiler: icpx
std: 17
build_type: release
backend: dpcpp
device_type: CPU
- os: ubuntu-latest
cxx_compiler: icpx
std: 17
build_type: release
backend: dpcpp
device_type: FPGA_EMU
- os: ubuntu-latest
cxx_compiler: icpx
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: ubuntu-latest
cxx_compiler: icpx
std: 17
build_type: release
backend: omp
device_type: HOST
- os: ubuntu-latest
cxx_compiler: g++
std: 17
build_type: release
backend: omp
device_type: HOST
- os: ubuntu-latest
cxx_compiler: g++
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: ubuntu-latest
cxx_compiler: g++
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: ubuntu-latest
cxx_compiler: clang++
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: ubuntu-latest
cxx_compiler: clang++
std: 17
build_type: release
backend: omp
device_type: HOST
- os: ubuntu-latest
cxx_compiler: clang++
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: ubuntu-latest
cxx_compiler: icpx
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: ubuntu-latest
cxx_compiler: g++
std: 17
build_type: release
backend: serial
device_type: HOST
steps:
- uses: actions/checkout@v4
- name: Set up Intel APT repository
if: (matrix.backend == 'tbb' || matrix.backend == 'dpcpp' || matrix.cxx_compiler == 'icpx' || matrix.cxx_compiler == 'icx' || matrix.cxx_compiler == 'icx-cl' || matrix.cxx_compiler == 'dpcpp' || matrix.cxx_compiler == 'dpcpp-cl')
run: |
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2024-0/apt.html
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update -y
- name: Install Intel® oneAPI Threading Building Blocks
if: (matrix.backend == 'tbb' || matrix.backend == 'dpcpp')
run: |
sudo apt-get install intel-oneapi-tbb-devel -y
- name: Install Intel® oneAPI DPC++/C++ Compiler
if: (matrix.cxx_compiler == 'icpx' || matrix.cxx_compiler == 'icx' || matrix.cxx_compiler == 'icx-cl' || matrix.cxx_compiler == 'dpcpp' || matrix.cxx_compiler == 'dpcpp-cl')
run: |
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp -y
# Avoid accidental use of a released version, keeping libpstloffload.so
sudo rm -rf ${LINUX_ONEAPI_PATH}/dpl/latest/include
- name: Install Intel® oneAPI DPC++/C++ Compiler SYCL* FPGA Emulator Runtime
if: (matrix.device_type == 'FPGA_EMU')
run: |
sudo apt-get install intel-oneapi-compiler-fpga -y
- name: Install OpenMP dependencies
if: (matrix.os == 'ubuntu-latest' && matrix.cxx_compiler == 'clang++' && matrix.backend == 'omp')
run: |
sudo apt-get install libomp5 libomp-dev -y
- name: Run testing
shell: bash
run: |
set -x
if [[ -f "${LINUX_ONEAPI_PATH}/setvars.sh" ]]; then
source ${LINUX_ONEAPI_PATH}/setvars.sh
fi
echo "::warning::CMake: $(cmake --version)"
echo "::warning::Compiler: $(${{ matrix.cxx_compiler }} --version)"
if [[ "${{ matrix.backend }}" == "dpcpp" ]]; then
make_targets="build-onedpl-sycl_iterator-tests"
ctest_flags="-R sycl_iterator_.*\.pass"
echo "::warning::dpcpp backend is set. Compile and run only sycl_iterator tests"
else
make_targets="build-onedpl-tests"
fi
mkdir build && cd build
lscpu
cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DONEDPL_BACKEND=${{ matrix.backend }} -DONEDPL_DEVICE_TYPE=${{ matrix.device_type }} ..
make VERBOSE=1 -j${BUILD_CONCURRENCY} ${make_targets}
ctest --timeout ${TEST_TIMEOUT} --output-on-failure ${ctest_flags}
linux-pstl-offload-testing:
name: PSTL offload ${{ matrix.device_type }},bknd=dpcpp,cmplr=${{ matrix.cxx_compiler }},${{ matrix.os }},std=с++${{ matrix.std }},cfg=${{ matrix.build_type }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cxx_compiler: icpx
std: 17
build_type: release
device_type: cpu
steps:
- uses: actions/checkout@v4
- name: Set up Intel APT repository
run: |
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2024-0/apt.html
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update -y
- name: Install Intel® oneAPI Threading Building Blocks
run: |
sudo apt-get install intel-oneapi-tbb-devel -y
- name: Install Intel® oneAPI DPC++/C++ Compiler
run: |
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp -y
# Avoid accidental use of a released version, keeping libpstloffload.so
sudo rm -rf ${LINUX_ONEAPI_PATH}/dpl/latest/include
- name: Run testing
shell: bash
run: |
set -x
source ${LINUX_ONEAPI_PATH}/setvars.sh
echo "::warning::CMake: $(cmake --version)"
echo "::warning::Compiler: $(${{ matrix.cxx_compiler }} --version)"
make_targets="build-onedpl-pstloffload_smoke_tests-tests"
ctest_flags="-L pstloffload_smoke_tests"
mkdir build && cd build
lscpu
device_type=${{ matrix.device_type }}
cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DONEDPL_BACKEND=dpcpp \
-D_ONEDPL_PSTL_OFFLOAD=$device_type ..
make pstloffload
source vars.sh
make VERBOSE=1 -j${BUILD_CONCURRENCY} ${make_targets}
ctest --timeout ${TEST_TIMEOUT} --output-on-failure ${ctest_flags}
windows-pstl-offload-testing:
name: PSTL offload ${{ matrix.device_type }},bknd=${{ matrix.backend }},cmplr=${{ matrix.cxx_compiler }},${{ matrix.os }},std=c++${{ matrix.std }},cfg=${{ matrix.build_type }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
cxx_compiler: icx-cl
std: 17
build_type: release
backend: dpcpp
device_type: cpu
steps:
- uses: actions/checkout@v4
- name: Install Intel® oneAPI Threading Building Blocks
if: (matrix.backend == 'tbb' || matrix.backend == 'dpcpp')
shell: cmd
run: |
curl %WINDOWS_TBB_DOWNLOAD_LINK% --output tbb_install.exe
tbb_install.exe -s -a --silent --eula accept -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0
del tbb_install.exe
- name: Install Intel® oneAPI DPC++/C++ Compiler
shell: cmd
run: |
curl %WINDOWS_ICPX_DOWNLOAD_LINK% --output icpx_install.exe
icpx_install.exe -s -a --silent --eula accept -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0
del icpx_install.exe
:: Avoid accidental use of a released version
rd /s /q "%WINDOWS_ONEAPI_PATH%\dpl"
- name: Run testing
shell: cmd
run: |
if exist "%WINDOWS_ONEAPI_PATH%\setvars.bat" (
call "%WINDOWS_ONEAPI_PATH%\setvars.bat"
)
if "${{ matrix.cxx_compiler }}" == "cl" (
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
)
powershell $output = cmake --version; Write-Host ::warning::CMake: $output
powershell $output = ${{ matrix.cxx_compiler }} --version; Write-Host ::warning::Compiler: $output
set ninja_targets=build-onedpl-pstloffload_smoke_tests-tests
set ctest_flags= -L pstloffload_smoke_tests
mkdir build && cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DONEDPL_BACKEND=${{ matrix.backend }} -D_ONEDPL_PSTL_OFFLOAD=${{ matrix.device_type }} .. || goto :short_circuit_fail
ninja -j 2 -v pstloffload || goto :short_circuit_fail
call .\vars.bat
ninja -j 2 -v %ninja_targets% || goto :short_circuit_fail
ctest --timeout %TEST_TIMEOUT% -C ${{ matrix.build_type }} --output-on-failure %ctest_flags% || goto :short_circuit_fail
exit /b 0
:: modify the default behaviour of shell:cmd, which exits with the status of a last command, in order not to unintentially miss an error
:short_circuit_fail
exit /b %errorlevel%
windows-testing:
name: ${{ matrix.device_type }},bknd=${{ matrix.backend }},cmplr=${{ matrix.cxx_compiler }},${{ matrix.os }},std=c++${{ matrix.std }},cfg=${{ matrix.build_type }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
cxx_compiler: icx-cl
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: windows-latest
cxx_compiler: cl
std: 17
build_type: release
backend: tbb
device_type: HOST
- os: windows-latest
cxx_compiler: icx
std: 17
build_type: release
backend: dpcpp
device_type: CPU
steps:
- uses: actions/checkout@v4
- name: Install Intel® oneAPI Threading Building Blocks
if: (matrix.backend == 'tbb' || matrix.backend == 'dpcpp')
shell: cmd
run: |
curl %WINDOWS_TBB_DOWNLOAD_LINK% --output tbb_install.exe
tbb_install.exe -s -a --silent --eula accept -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0
del tbb_install.exe
- name: Install Intel® oneAPI DPC++/C++ Compiler
shell: cmd
run: |
curl %WINDOWS_ICPX_DOWNLOAD_LINK% --output icpx_install.exe
icpx_install.exe -s -a --silent --eula accept -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0
del icpx_install.exe
:: Avoid accidental use of a released version
rd /s /q "%WINDOWS_ONEAPI_PATH%\dpl"
- name: Run testing
shell: cmd
run: |
if exist "%WINDOWS_ONEAPI_PATH%\setvars.bat" (
call "%WINDOWS_ONEAPI_PATH%\setvars.bat"
)
if "${{ matrix.cxx_compiler }}" == "cl" (
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
)
powershell $output = cmake --version; Write-Host ::warning::CMake: $output
powershell $output = ${{ matrix.cxx_compiler }} --version; Write-Host ::warning::Compiler: $output
if "${{ matrix.backend }}" == "dpcpp" (
set ninja_targets="build-onedpl-sycl_iterator-tests"
set ctest_flags=-R sycl_iterator_.*\.pass
echo ::warning::dpcpp backend is set. Compile and run only sycl_iterator tests
) else (
set ninja_targets=build-onedpl-tests
)
mkdir build && cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DONEDPL_BACKEND=${{ matrix.backend }} -DONEDPL_DEVICE_TYPE=${{ matrix.device_type }} .. || goto :short_circuit_fail
ninja -j 2 -v %ninja_targets% || goto :short_circuit_fail
ctest --timeout %TEST_TIMEOUT% -C ${{ matrix.build_type }} --output-on-failure %ctest_flags% || goto :short_circuit_fail
exit /b 0
:: modify the default behaviour of shell:cmd, which exits with the status of a last command, in order not to unintentially miss an error
:short_circuit_fail
exit /b %errorlevel%
macos-testing:
name: HOST,bknd=${{ matrix.backend }},cmplr=${{ matrix.cxx_compiler }},${{ matrix.os }},std=c++${{ matrix.std }},cfg=${{ matrix.build_type }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
cxx_compiler: clang++
std: 17
build_type: release
backend: omp
steps:
- uses: actions/checkout@v4
- name: Install OpenMP for Clang++
run: |
brew install libomp
- name: Run testing
shell: bash
run: |
set -x
echo "::warning::CMake: $(cmake --version)"
sysctl -a | grep machdep.cpu
# workaround for CMake not being able to find OpenMP: see https://discourse.cmake.org/t/how-to-find-openmp-with-clang-on-macos/8860
# -DCMAKE_POLICY_DEFAULT_CMP0074=NEW below is forced to make sure CMake uses <PackageName>_ROOT variables.
export OpenMP_ROOT=$(brew --prefix)/opt/libomp
mkdir build && cd build
cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DONEDPL_BACKEND=${{ matrix.backend }} -DCMAKE_POLICY_DEFAULT_CMP0074=NEW ..
make VERBOSE=1 build-onedpl-tests -j${MACOS_BUILD_CONCURRENCY}
ctest --timeout ${TEST_TIMEOUT} --output-on-failure -E "${EXCLUDE_FROM_TESTING}"