.gitlab-ci.yml 11.6 KB
Newer Older
1 2 3 4 5
# vim: tabstop=4 shiftwidth=4 softtabstop=4

before_script:
    - which g++
    - which cmake
6
    - which ninja
7 8 9

stages:
    - build
Jakub Klinkovský's avatar
Jakub Klinkovský committed
10 11 12 13
    - build:cuda
    - build:gcc
    - build:clang
    - build:doc
14
    - deploy
15 16 17

# default flags for cmake
.default_cmake_flags_def: &default_cmake_flags
18
    # architectures
19
    WITH_OPENMP: "no"
20 21
    WITH_CUDA: "no"
    WITH_CUDA_ARCH: "auto"
22
    WITH_MPI: "no"
23 24
    # configurations
    WITH_TESTS: "no"
25
    WITH_MATRIX_TESTS: "no"
26
    WITH_COVERAGE: "no"
27
    WITH_DOC: "no"
28 29 30 31
    WITH_BENCHMARKS: "no"
    WITH_EXAMPLES: "no"
    WITH_TOOLS: "no"
    WITH_PYTHON: "no"
32

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
# base for OpenMP+MPI builds
.openmp_mpi:
    tags:
        - openmp
        - mpi
    variables:
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"

.cuda_openmp_mpi:
    extends: .openmp_mpi
    # tags are overridden, not merged...
    tags:
        - gpu
        - openmp
        - mpi

50 51
# base for Clang builds
.clang:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
52
    stage: build:clang
53 54 55 56 57 58 59
    variables:
        CXX: clang++
        CC: clang
        CUDA_HOST_COMPILER: clang++
    tags:
        - clang

60 61 62 63 64 65 66
.clang_mpi:
    extends: .clang
    # tags are overridden, not merged...
    tags:
        - clang
        - mpi

67
# template for build jobs
Jakub Klinkovský's avatar
Jakub Klinkovský committed
68 69 70 71
.build_template:
    stage: build:gcc
    # don't wait for jobs in previous stages to complete before starting this job
    needs: []
72
    script:
73
        # all cores including hyperthreading
74
#        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | wc -l)
75
        # all pyhsical cores
76
        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
77 78 79 80
        # respect $NINJAFLAGS from the outer environment if it is set
        - if [[ ${NINJAFLAGS} == "" ]]; then
                export NINJAFLAGS="-j$NUM_CORES";
          fi
81
        - export CTEST_OUTPUT_ON_FAILURE=1
Jakub Klinkovský's avatar
Jakub Klinkovský committed
82
        - export CTEST_PARALLEL_LEVEL=4
83
        - export OMP_NUM_THREADS=4
84 85 86
        - mkdir -p "./builddir/$CI_JOB_NAME"
        - pushd "./builddir/$CI_JOB_NAME"
        - cmake ../..
87
                -G Ninja
88 89
                -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
                -DCMAKE_INSTALL_PREFIX=$(pwd)/${BUILD_TYPE}_install_prefix
90
                -DWITH_OPENMP=${WITH_OPENMP}
91
                -DWITH_MPI=${WITH_MPI}
92 93 94
                -DWITH_CUDA=${WITH_CUDA}
                -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH}
                -DWITH_TESTS=${WITH_TESTS}
95
                -DWITH_MATRIX_TESTS=${WITH_MATRIX_TESTS}
96
                -DWITH_DOC=${WITH_DOC}
97
                -DWITH_COVERAGE=${WITH_COVERAGE}
98
                -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
99
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
100 101
                -DWITH_TOOLS=${WITH_TOOLS}
                -DWITH_PYTHON=${WITH_PYTHON}
102
                -DWITH_CI_FLAGS=yes
103 104
        # "install" implies the "all" target
        - ninja ${NINJAFLAGS} install
105
        - if [[ ${WITH_TESTS} == "yes" ]] || [[ ${WITH_MATRIX_TESTS} == "yes" ]]; then
106 107
                ninja test;
          fi
108 109 110 111
        - popd
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
112 113 114
    only:
        changes:
            - src/**/*.{h,hpp,cpp,cu}
115
            - Documentation/Examples/**/*.{h,hpp,cpp,cu}
116 117
            - Documentation/Tutorials/**/*.{h,hpp,cpp,cu}
            - "**/CMakeLists.txt"
118
            - .gitlab-ci.yml
119
    interruptible: true
120 121 122 123 124 125

# Dummy build job to ensure that a pipeline is created for a merge request, even
# when there were no changes.
dummy build job:
    stage: build
    script: echo "dummy"
126 127
    only:
        - merge_requests
128 129 130
    except:
        changes:
            - src/**/*.{h,hpp,cpp,cu}
131
            - Documentation/Examples/**/*.{h,hpp,cpp,cu}
132 133
            - Documentation/Tutorials/**/*.{h,hpp,cpp,cu}
            - "**/CMakeLists.txt"
134
            - .gitlab-ci.yml
135

136 137
# Cuda builds are specified first because they take more time than host-only builds,
# which can be allocated on hosts whitout GPUs.
138 139
# Similarly, release builds are launched first to avoid the tail effect (they take
# significantly more time than debug builds).
140

141
cuda_tests_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
142 143
    extends: .build_template
    stage: build:cuda
144 145 146 147 148 149 150 151 152
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

cuda_tests_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
153 154
    extends: .build_template
    stage: build:cuda
155 156 157 158 159 160 161 162 163
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_TESTS: "yes"


164
cuda_matrix_tests_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
165 166
    extends: .build_template
    stage: build:cuda
167 168 169 170 171 172 173 174 175
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_MATRIX_TESTS: "yes"

cuda_matrix_tests_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
176 177
    extends: .build_template
    stage: build:cuda
178 179 180 181 182 183 184 185 186
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_MATRIX_TESTS: "yes"


187
cuda_examples_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
188 189
    extends: .build_template
    stage: build:cuda
190 191 192 193 194 195 196
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"
197 198
        # build output snippets for documentation
        WITH_DOC: "yes"
199 200 201 202
    # store output snippets for documentation
    artifacts:
        paths:
            - Documentation/output_snippets/
203 204

cuda_examples_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
205 206
    extends: .build_template
    stage: build:cuda
207 208 209 210 211
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
212 213
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"
214 215 216


cuda_benchmarks_tools_python_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
217 218
    extends: .build_template
    stage: build:cuda
219 220 221 222 223 224 225
    tags:
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
226 227
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
228

229
cuda_benchmarks_tools_python_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
230 231
    extends: .build_template
    stage: build:cuda
232 233
    tags:
        - gpu
234 235
    variables:
        <<: *default_cmake_flags
236
        WITH_CUDA: "yes"
237
        BUILD_TYPE: Release
238 239 240 241
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

242

243
cuda_mpi_tests_Debug:
244 245 246
    extends:
        - cuda_tests_Debug
        - .cuda_openmp_mpi
247 248

cuda_mpi_tests_Release:
249 250 251
    extends:
        - cuda_tests_Release
        - .cuda_openmp_mpi
252

253
cuda_mpi_matrix_tests_Debug:
254 255 256
    extends:
        - cuda_matrix_tests_Debug
        - .cuda_openmp_mpi
257 258

cuda_mpi_matrix_tests_Release:
259 260 261
    extends:
        - cuda_matrix_tests_Release
        - .cuda_openmp_mpi
262

263
cuda_mpi_examples_Debug:
264 265 266
    extends:
        - cuda_examples_Debug
        - .cuda_openmp_mpi
267

268
cuda_mpi_examples_Release:
269 270 271
    extends:
        - cuda_examples_Release
        - .cuda_openmp_mpi
272 273

cuda_mpi_benchmarks_tools_python_Debug:
274 275 276
    extends:
        - cuda_benchmarks_tools_python_Debug
        - .cuda_openmp_mpi
277

278
cuda_mpi_benchmarks_tools_python_Release:
279 280 281
    extends:
        - cuda_benchmarks_tools_python_Release
        - .cuda_openmp_mpi
282 283 284 285 286 287





default_tests_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
288
    extends: .build_template
289 290 291 292 293 294
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

default_tests_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
295
    extends: .build_template
296 297 298 299 300
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_TESTS: "yes"

301
default_matrix_tests_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
302
    extends: .build_template
303 304 305 306 307 308
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_MATRIX_TESTS: "yes"

default_matrix_tests_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
309
    extends: .build_template
310 311 312 313 314
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_MATRIX_TESTS: "yes"

315
default_examples_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
316
    extends: .build_template
317 318 319 320 321 322
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"

default_examples_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
323
    extends: .build_template
324 325 326 327 328 329
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"

default_benchmarks_tools_python_Debug:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
330
    extends: .build_template
331 332
    variables:
        <<: *default_cmake_flags
333
        BUILD_TYPE: Debug
334 335 336 337 338
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

default_benchmarks_tools_python_Release:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
339
    extends: .build_template
340 341 342 343 344 345
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
346

347

348
mpi_tests_Debug:
349 350 351
    extends:
        - default_tests_Debug
        - .openmp_mpi
352

353
mpi_tests_Release:
354 355 356
    extends:
        - default_tests_Release
        - .openmp_mpi
357

358
mpi_matrix_tests_Debug:
359 360 361
    extends:
        - default_matrix_tests_Debug
        - .openmp_mpi
362 363

mpi_matrix_tests_Release:
364 365 366
    extends:
        - default_matrix_tests_Release
        - .openmp_mpi
367

368
mpi_examples_Debug:
369 370 371
    extends:
        - default_examples_Debug
        - .openmp_mpi
372

373
mpi_examples_Release:
374 375 376
    extends:
        - default_examples_Release
        - .openmp_mpi
377

378
mpi_benchmarks_tools_python_Debug:
379 380 381
    extends:
        - default_benchmarks_tools_python_Debug
        - .openmp_mpi
382

383
mpi_benchmarks_tools_python_Release:
384 385 386
    extends:
        - default_benchmarks_tools_python_Release
        - .openmp_mpi
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
clang_tests_Debug:
    extends:
        - default_tests_Debug
        - .clang

clang_tests_Release:
    extends:
        - default_tests_Release
        - .clang

clang_matrix_tests_Debug:
    extends:
        - default_matrix_tests_Debug
        - .clang

clang_matrix_tests_Release:
    extends:
        - default_matrix_tests_Release
        - .clang

clang_examples_Debug:
    extends:
        - default_examples_Debug
        - .clang

clang_examples_Release:
    extends:
        - default_examples_Release
        - .clang

clang_benchmarks_tools_python_Debug:
    extends:
        - default_benchmarks_tools_python_Debug
        - .clang

clang_benchmarks_tools_python_Release:
    extends:
        - default_benchmarks_tools_python_Release
        - .clang


clang_mpi_tests_Debug:
    extends:
        - mpi_tests_Debug
433
        - .clang_mpi
434 435 436 437

clang_mpi_tests_Release:
    extends:
        - mpi_tests_Release
438
        - .clang_mpi
439 440 441 442

clang_mpi_matrix_tests_Debug:
    extends:
        - mpi_matrix_tests_Debug
443
        - .clang_mpi
444 445 446 447

clang_mpi_matrix_tests_Release:
    extends:
        - mpi_matrix_tests_Release
448
        - .clang_mpi
449 450 451 452

clang_mpi_examples_Debug:
    extends:
        - mpi_examples_Debug
453
        - .clang_mpi
454 455 456 457

clang_mpi_examples_Release:
    extends:
        - mpi_examples_Release
458
        - .clang_mpi
459 460 461 462

clang_mpi_benchmarks_tools_python_Debug:
    extends:
        - mpi_benchmarks_tools_python_Debug
463
        - .clang_mpi
464 465 466 467

clang_mpi_benchmarks_tools_python_Release:
    extends:
        - mpi_benchmarks_tools_python_Release
468
        - .clang_mpi
469 470


471 472 473


build documentation:
Jakub Klinkovský's avatar
Jakub Klinkovský committed
474
    stage: build:doc
475 476 477 478
    only:
        changes:
            - Documentation/**/*
            - src/TNL/**/*.{h,hpp}
479
            - .gitlab-ci.yml
480 481
    # use "needs" instead of "dependencies" to allow out-of-order start of this job
    needs:
482
        # the job which builds Documentation/output_snippets/
483 484
        - job: cuda_examples_Debug
          artifacts: true
485 486 487 488 489 490 491 492
    script:
        - ./Documentation/build
    artifacts:
        paths:
            - ./Documentation/html/
    tags:
        - doxygen

493 494 495
deploy documentation:
    stage: deploy
    only:
496 497 498 499
        changes:
            - Documentation/**/*
            - src/TNL/**/*.{h,hpp}
            - .gitlab-ci.yml
500 501 502 503 504 505
        variables:
            - $TNL_DOC_DEPLOY_KEY
        refs:
            - develop
            - schedules
            - triggers
506
    # use "dependencies" instead of "needs" to deploy only when the entire pipeline succeeds
507 508
    dependencies:
        - build documentation
509 510 511 512
    script:
        - ./Documentation/deploy
    tags:
        - doxygen
513
        - deploy_key