forked from ROCm/rocThrust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
435 lines (411 loc) · 12.5 KB
/
.gitlab-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
# ########################################################################
# Copyright 2019-2024 Advanced Micro Devices, Inc.
# ########################################################################
include:
- project: 'amd/ci-templates'
ref: main
file:
- /defaults.yaml
- /deps-cmake.yaml
- /deps-docs.yaml
- /deps-rocm.yaml
- /deps-windows.yaml
- /deps-nvcc.yaml
- /gpus-rocm.yaml
- /gpus-nvcc.yaml
- /rules.yaml
stages:
- lint
- build # Tests if builds succeed (CMake)
- test # Tests if unit tests are passing (CTest)
- benchmark # Runs the non-internal benchmarks (Google Benchmark)
variables:
# Helper variables
PACKAGE_DIR: $BUILD_DIR/package
ROCPRIM_GIT_BRANCH: develop_stream
ROCPRIM_DIR: ${CI_PROJECT_DIR}/rocPRIM
copyright-date:
extends:
- .deps:rocm
stage: lint
needs: []
tags:
- build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- cd $CI_PROJECT_DIR
- git config --global --add safe.directory $CI_PROJECT_DIR
- scripts/copyright-date/check-copyright.sh -v -d $CI_MERGE_REQUEST_DIFF_BASE_SHA
.cmake-latest:
extends:
- .deps:rocm
- .deps:cmake-latest
before_script:
- !reference [".deps:rocm", before_script]
- !reference [".deps:cmake-latest", before_script]
.cmake-minimum:
extends:
- .deps:rocm
- .deps:cmake-minimum
before_script:
- !reference [".deps:rocm", before_script]
- !reference [".deps:cmake-minimum", before_script]
.install-rocprim:
script:
- branch_name="$ROCPRIM_GIT_BRANCH"
- if [[ $CI_COMMIT_BRANCH == "develop" ]] || [[ $CI_COMMIT_BRANCH == "master" ]]; then branch_name=$CI_COMMIT_BRANCH;
- fi;
- git clone -b $branch_name https://gitlab-ci-token:${CI_JOB_TOKEN}@${ROCPRIM_GIT_URL} $ROCPRIM_DIR
- cmake
-G Ninja
-D CMAKE_CXX_COMPILER=hipcc
-D CMAKE_BUILD_TYPE=Release
-D BUILD_TEST=OFF
-D BUILD_EXAMPLE=OFF
-D ROCM_DEP_ROCMCORE=OFF
-S $ROCPRIM_DIR
-B $ROCPRIM_DIR/build
- cd $ROCPRIM_DIR/build
- cpack
-G "DEB"
- $SUDO_CMD dpkg -i rocprim*.deb
.build:common:
stage: build
tags:
- build
extends:
- .gpus:rocm-gpus
- .rules:build
variables:
EXTRA_CMAKE_CXX_FLAGS: ""
script:
- !reference [.install-rocprim, script]
- | # Setup env vars for testing
rng_seed_count=0; prng_seeds="0";
if [[ $CI_COMMIT_BRANCH == "develop_stream" ]]; then
rng_seed_count=3
prng_seeds="0, 1000"
fi
- | # Add hardened libc++ assertions for tests only
if [[ $BUILD_TARGET == "TEST" ]]; then
echo "Configuring with hardened libc++!"
EXTRA_CMAKE_CXX_FLAGS+=" -D_GLIBCXX_ASSERTIONS=ON"
fi
# Build rocThrust
- cmake
-G Ninja
-D CMAKE_CXX_COMPILER=hipcc
-D CMAKE_CXX_FLAGS="$EXTRA_CMAKE_CXX_FLAGS"
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
-D BUILD_$BUILD_TARGET=ON
-D GPU_TARGETS=$GPU_TARGETS
-D AMDGPU_TEST_TARGETS=$GPU_TARGETS
-D RNG_SEED_COUNT=$rng_seed_count
-D PRNG_SEEDS=$prng_seeds
-S $CI_PROJECT_DIR
-B $CI_PROJECT_DIR/build
- cmake --build $CI_PROJECT_DIR/build
artifacts:
paths:
- $CI_PROJECT_DIR/build/benchmarks/*
- $CI_PROJECT_DIR/build/test/*
- $CI_PROJECT_DIR/build/testing/*
- $CI_PROJECT_DIR/build/deps/*
- $CI_PROJECT_DIR/build/CMakeCache.txt
- $CI_PROJECT_DIR/build/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/.ninja_log
exclude:
- $CI_PROJECT_DIR/build/**/*.o
expire_in: 2 weeks
build:cmake-latest:
stage: build
extends:
- .cmake-latest
- .build:common
parallel:
matrix:
- BUILD_TYPE: Release
BUILD_TARGET: [BENCHMARKS, TEST, EXAMPLES]
build:cmake-minimum:
stage: build
extends:
- .cmake-minimum
- .build:common
parallel:
matrix:
- BUILD_TYPE: Release
BUILD_TARGET: [BENCHMARKS, TEST, EXAMPLES]
build:package:
stage: build
extends:
- .cmake-minimum
- .rules:build
tags:
- build
script:
- !reference [.install-rocprim, script]
- cmake
-S $CI_PROJECT_DIR
-B $PACKAGE_DIR
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_CXX_COMPILER=hipcc
- cd $PACKAGE_DIR
- cpack
-G "DEB;ZIP"
artifacts:
paths:
- $PACKAGE_DIR/rocthrust*.deb
- $PACKAGE_DIR/rocthrust*.zip
expire_in: 2 weeks
build:windows:
stage: build
needs: []
extends:
- .rules:build
- .gpus:rocm-windows
- .deps:rocm-windows
- .deps:visual-studio-devshell
script:
# Download, configure, and install rocPRIM
- $BRANCH_NAME=$ROCPRIM_GIT_BRANCH
- if ( $CI_COMMIT_BRANCH -eq "develop" -or $CI_COMMIT_BRANCH -eq "master" ) { $branch_name=$CI_COMMIT_BRANCH }
- git clone -b $BRANCH_NAME https://gitlab-ci-token:$CI_JOB_TOKEN@$ROCPRIM_GIT_URL $ROCPRIM_DIR
- \& cmake
-S "$ROCPRIM_DIR"
-B "$ROCPRIM_DIR/build"
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D GPU_TARGETS=$GPU_TARGET
-D BUILD_TEST=OFF
-D BUILD_EXAMPLE=OFF
-D BUILD_BENCHMARK=OFF
-D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS
-D CMAKE_CXX_COMPILER:FILEPATH="${env:HIP_PATH}/bin/clang++.exe"
-D CMAKE_INSTALL_PREFIX:PATH="$ROCPRIM_DIR/build/install" *>&1
- \& cmake --build "$ROCPRIM_DIR/build" --target install *>&1
# Configure and build rocThrust
- \& cmake
-S "$CI_PROJECT_DIR"
-B "$CI_PROJECT_DIR/build"
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D GPU_TARGETS=$GPU_TARGET
-D BUILD_TEST=ON
-D BUILD_EXAMPLES=OFF
-D BUILD_BENCHMARKS=OFF
-D CMAKE_CXX_FLAGS=-Wno-deprecated-declarations
-D CMAKE_CXX_COMPILER:FILEPATH="${env:HIP_PATH}/bin/clang++.exe"
-D CMAKE_INSTALL_PREFIX:PATH="$CI_PROJECT_DIR/build/install"
-D CMAKE_PREFIX_PATH:PATH="$ROCPRIM_DIR/build/install;${env:HIP_PATH}" *>&1
- \& cmake --build "$CI_PROJECT_DIR/build" *>&1
artifacts:
paths:
- $CI_PROJECT_DIR/build/
- $ROCPRIM_DIR/build/install
expire_in: 2 weeks
test:package:
stage: test
needs:
- build:package
extends:
- .cmake-minimum
- .rules:test
tags:
- rocm
script:
- !reference [.install-rocprim, script]
- $SUDO_CMD dpkg -i $PACKAGE_DIR/rocthrust*.deb
# Test install
- cmake
-S $CI_PROJECT_DIR/extra
-B $CI_PROJECT_DIR/package_test
-G Ninja
-D CMAKE_CXX_COMPILER=hipcc
-D CMAKE_BUILD_TYPE=Release
-D GPU_TARGETS=$GPU_TARGETS
-D ROCPRIM_ROOT=/opt/rocm/rocprim
- cmake --build $CI_PROJECT_DIR/package_test
- cd $CI_PROJECT_DIR/package_test
- ctest --output-on-failure
# Remove rocPRIM and rocThrust
- $SUDO_CMD dpkg -r rocthrust-dev
- $SUDO_CMD dpkg -r rocprim-dev
test:doc:
stage: test
variables:
SPHINX_DIR: $DOCS_DIR/sphinx
extends:
- .build:docs
- .rules:test
test:
stage: test
extends:
- .cmake-minimum
- .rules:test
- .gpus:rocm
needs:
- job: build:cmake-minimum
parallel:
matrix:
- BUILD_TYPE: Release
BUILD_TARGET: TEST
script:
- cd $CI_PROJECT_DIR/build
- cmake
-D CMAKE_PREFIX_PATH=/opt/rocm
-P $CI_PROJECT_DIR/cmake/GenerateResourceSpec.cmake
- cat ./resources.json
# Parallel execution (with other AMDGPU processes) can oversubscribe the SDMA queue.
# This causes the hipMemcpy to fail, which is not reported as an error by HIP.
# As a temporary workaround, disable the SDMA for test stability.
- HSA_ENABLE_SDMA=0 ctest
--output-on-failure
--repeat-until-fail 2
--tests-regex $GPU_TARGET
--resource-spec-file ./resources.json
--parallel $PARALLEL_JOBS
.rocm-windows:test:
extends:
- .gpus:rocm-windows
- .rules:test
stage: test
script:
- \& ctest --test-dir "$CI_PROJECT_DIR/build" --output-on-failure --no-tests=error *>&1
test:rocm-windows:
extends:
- .rocm-windows:test
needs:
- build:windows
.rocm-windows:test-install:
extends:
- .deps:rocm-windows
- .deps:visual-studio-devshell
- .gpus:rocm-windows
- .rules:test
stage: test
script:
- \& cmake --build "$CI_PROJECT_DIR/build" --target install *>&1
- \& cmake
-G Ninja
-S "$CI_PROJECT_DIR/extra"
-B "$CI_PROJECT_DIR/build/package_test"
-D CMAKE_BUILD_TYPE=Release
-D GPU_TARGETS=$GPU_TARGET
-D CMAKE_CXX_COMPILER:FILEPATH="${env:HIP_PATH}/bin/clang++.exe"
-D CMAKE_PREFIX_PATH:PATH="$ROCPRIM_DIR/build/install;${env:HIP_PATH}" *>&1
- \& cmake --build "$CI_PROJECT_DIR/build/package_test" *>&1
- \& ctest --test-dir "$CI_PROJECT_DIR/build/package_test" --output-on-failure --no-tests=error *>&1
test:rocm-windows-install:
extends:
- .rocm-windows:test-install
needs:
- build:windows
.nvcc:
extends:
- .deps:nvcc
- .gpus:nvcc-gpus
- .deps:cmake-latest
- .rules:manual
before_script:
- !reference [".deps:nvcc", before_script]
- !reference [".deps:cmake-latest", before_script]
build:cuda-and-omp:
stage: build
extends:
- .nvcc
- .rules:build
tags:
- build
variables:
CCCL_GIT_BRANCH: v2.3.2
CCCL_DIR: ${CI_PROJECT_DIR}/cccl
needs: []
script:
- git clone -b $CCCL_GIT_BRANCH https://github.com/NVIDIA/cccl.git $CCCL_DIR
# Replace CCCL Thrust headers with rocThrust headers
- rm -R $CCCL_DIR/thrust/thrust
- cp -r $CI_PROJECT_DIR/thrust $CCCL_DIR/thrust
# Build tests and examples from CCCL Thrust
- cmake
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_CUDA_ARCHITECTURES="$GPU_TARGETS"
-D THRUST_ENABLE_TESTING=ON
-D THRUST_ENABLE_EXAMPLES=ON
-D THRUST_ENABLE_BENCHMARKS=OFF
-D THRUST_ENABLE_MULTICONFIG=ON
-D THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON
-D THRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON
-B $CI_PROJECT_DIR/build
-S $CCCL_DIR/thrust
- cmake --build $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
- ctest --output-on-failure --tests-regex "thrust.example.cmake.add_subdir|thrust.test.cmake.check_source_files"
artifacts:
paths:
- $CI_PROJECT_DIR/build/bin/
- $CI_PROJECT_DIR/build/CMakeCache.txt
- $CI_PROJECT_DIR/build/examples/cuda/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/examples/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/unittest/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/async/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/omp/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/cuda/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/regression/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/cpp/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/testing/CTestTestfile.cmake
- $CI_PROJECT_DIR/build/CTestTestfile.cmake
- $CCCL_DIR/thrust/cmake/ThrustRunTest.cmake
- $CCCL_DIR/thrust/cmake/ThrustRunExample.cmake
- $CI_PROJECT_DIR/build/.ninja_log
expire_in: 1 week
test:cuda-and-omp:
stage: test
needs:
- build:cuda-and-omp
extends:
- .nvcc
- .gpus:nvcc
- .rules:test
before_script:
# This is only needed because of the legacy before_script in .gpus:nvcc would otherwise overwrite before_script
- !reference [.nvcc, before_script]
script:
- cd $CI_PROJECT_DIR/build
# These tests are executed on the build stage because they require sources
- ctest --output-on-failure --exclude-regex "thrust.example.cmake.add_subdir|thrust.test.cmake.check_source_files"
.benchmark-base:
stage: benchmark
extends:
- .rules:benchmark
variables:
BENCHMARK_RESULT_DIR: ${CI_PROJECT_DIR}/benchmark_results
BENCHMARK_RESULT_CACHE_DIR: ${BENCHMARK_RESULT_DIR}_cache
benchmark:
needs:
- build:cmake-minimum
extends:
- .cmake-minimum
- .gpus:rocm
- .benchmark-base
variables:
BENCHMARK_FILENAME_REGEX: ^benchmark
BENCHMARK_ALGORITHM_REGEX: ""
timeout: 3h
script:
- 'printf "CI Variables used in benchmarks:\nBENCHMARK_RESULT_DIR: %s\nBENCHMARK_FILENAME_REGEX: %s\nBENCHMARK_ALGORITHM_REGEX: %s \n" "$BENCHMARK_RESULT_DIR" "$BENCHMARK_FILENAME_REGEX" "$BENCHMARK_ALGORITHM_REGEX"'
- cd "${CI_PROJECT_DIR}"
- mkdir -p "${BENCHMARK_RESULT_DIR}"
- python3
.gitlab/run_benchmarks.py
--benchmark_dir "${CI_PROJECT_DIR}/build/benchmarks"
--benchmark_gpu_architecture "${GPU_TARGET}"
--benchmark_output_dir "${BENCHMARK_RESULT_DIR}"
--benchmark_filename_regex "${BENCHMARK_FILENAME_REGEX}"
--benchmark_filter_regex "${BENCHMARK_ALGORITHM_REGEX}"
artifacts:
paths:
- ${BENCHMARK_RESULT_DIR}
expire_in: 1 week