.gitlab-ci.yml 10.2 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 10 11 12 13 14

# Stages are useful only to enforce some ordering of the jobs. Every job is run
# in its own directory and only very few data can be shared between the jobs in
# different stages. It has to be zipped and uploaded to the server, so we can't
# do it with the build directory. Hence, we must build, test and install in the
# same job.
stages:
    - build
15
    - doc_build
16
    - deploy
17 18 19

# default flags for cmake
.default_cmake_flags_def: &default_cmake_flags
20
    # architectures
21
    WITH_OPENMP: "no"
22 23 24
    WITH_CUDA: "no"
    WITH_CUDA_ARCH: "auto"
    WITH_MIC: "no"
25
    WITH_MPI: "no"
26 27
    # configurations
    WITH_TESTS: "no"
28
    WITH_COVERAGE: "no"
29
    WITH_DOC: "no"
30 31 32 33
    WITH_BENCHMARKS: "no"
    WITH_EXAMPLES: "no"
    WITH_TOOLS: "no"
    WITH_PYTHON: "no"
34 35 36 37 38

# template for build jobs
.build_template_def: &build_template
    stage: build
    script:
39
        # all cores including hyperthreading
40
#        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | wc -l)
41
        # all pyhsical cores
42
        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
43 44 45 46
        # respect $NINJAFLAGS from the outer environment if it is set
        - if [[ ${NINJAFLAGS} == "" ]]; then
                export NINJAFLAGS="-j$NUM_CORES";
          fi
47
        - export CTEST_OUTPUT_ON_FAILURE=1
48
        - export CTEST_PARALLEL_LEVEL=4
49 50 51
        - mkdir -p "./builddir/$CI_JOB_NAME"
        - pushd "./builddir/$CI_JOB_NAME"
        - cmake ../..
52
                -G Ninja
53 54
                -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
                -DCMAKE_INSTALL_PREFIX=$(pwd)/${BUILD_TYPE}_install_prefix
55
                -DWITH_OPENMP=${WITH_OPENMP}
56
                -DWITH_MPI=${WITH_MPI}
57 58 59 60
                -DWITH_CUDA=${WITH_CUDA}
                -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH}
                -DWITH_MIC=${WITH_MIC}
                -DWITH_TESTS=${WITH_TESTS}
61
                -DWITH_DOC=${WITH_DOC}
62
                -DWITH_COVERAGE=${WITH_COVERAGE}
63
                -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
64
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
65 66
                -DWITH_TOOLS=${WITH_TOOLS}
                -DWITH_PYTHON=${WITH_PYTHON}
67 68
        # "install" implies the "all" target
        - ninja ${NINJAFLAGS} install
69 70 71
        - if [[ ${WITH_TESTS} == "yes" ]]; then
                ninja test;
          fi
72 73 74 75
        - popd
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
76 77 78 79 80
    only:
        changes:
            - src/**/*.{h,hpp,cpp,cu}
            - Documentation/Tutorials/**/*.{h,hpp,cpp,cu}
            - "**/CMakeLists.txt"
81
            - .gitlab-ci.yml
82 83 84 85 86 87

# 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"
88 89
    only:
        - merge_requests
90 91 92 93 94
    except:
        changes:
            - src/**/*.{h,hpp,cpp,cu}
            - Documentation/Tutorials/**/*.{h,hpp,cpp,cu}
            - "**/CMakeLists.txt"
95
            - .gitlab-ci.yml
96

97 98
# Cuda builds are specified first because they take more time than host-only builds,
# which can be allocated on hosts whitout GPUs.
99 100
# Similarly, release builds are launched first to avoid the tail effect (they take
# significantly more time than debug builds).
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
cuda_tests_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

cuda_tests_Release:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_TESTS: "yes"


cuda_examples_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"
138 139 140 141
    # store output snippets for documentation
    artifacts:
        paths:
            - Documentation/output_snippets/
142 143

cuda_examples_Release:
144
    <<: *build_template
145
    tags:
146
        - openmp
147 148 149
        - gpu
    variables:
        <<: *default_cmake_flags
150
        WITH_OPENMP: "yes"
151
        WITH_CUDA: "yes"
152 153
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"
154 155 156 157 158 159 160 161 162 163 164 165 166


cuda_benchmarks_tools_python_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
167 168
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
169

170
cuda_benchmarks_tools_python_Release:
171
    <<: *build_template
172
    tags:
173
        - openmp
174
        - gpu
175 176
    variables:
        <<: *default_cmake_flags
177
        WITH_OPENMP: "yes"
178
        WITH_CUDA: "yes"
179
        BUILD_TYPE: Release
180 181 182 183
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

184

185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
cuda_mpi_tests_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

cuda_mpi_tests_Release:
200 201 202 203 204 205 206 207 208 209 210
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Release
211 212
        WITH_TESTS: "yes"

213

214
cuda_mpi_examples_Debug:
215 216
    <<: *build_template
    tags:
217
        - openmp
218
        - gpu
219
        - mpi
220 221
    variables:
        <<: *default_cmake_flags
222
        WITH_OPENMP: "yes"
223
        WITH_CUDA: "yes"
224
        WITH_MPI: "yes"
225
        BUILD_TYPE: Debug
226
        WITH_EXAMPLES: "yes"
227

228
cuda_mpi_examples_Release:
229 230
    <<: *build_template
    tags:
231
        - openmp
232
        - gpu
233
        - mpi
234 235
    variables:
        <<: *default_cmake_flags
236
        WITH_OPENMP: "yes"
237
        WITH_CUDA: "yes"
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
        WITH_MPI: "yes"
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"


cuda_mpi_benchmarks_tools_python_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
254
        BUILD_TYPE: Debug
255 256 257
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
258

259
cuda_mpi_benchmarks_tools_python_Release:
260 261
    <<: *build_template
    tags:
262
        - openmp
263
        - gpu
264
        - mpi
265 266
    variables:
        <<: *default_cmake_flags
267
        WITH_OPENMP: "yes"
268
        WITH_CUDA: "yes"
269
        WITH_MPI: "yes"
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
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"





default_tests_Debug:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

default_tests_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_TESTS: "yes"

default_examples_Debug:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"

default_examples_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"

default_benchmarks_tools_python_Debug:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
311
        BUILD_TYPE: Debug
312 313 314 315 316 317 318 319 320 321 322 323
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

default_benchmarks_tools_python_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
324

325

326
mpi_tests_Debug:
327
    <<: *build_template
328 329 330 331 332 333 334 335 336
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"
337

338
mpi_tests_Release:
339
    <<: *build_template
340 341 342
    tags:
        - openmp
        - mpi
343 344
    variables:
        <<: *default_cmake_flags
345 346
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
347
        BUILD_TYPE: Release
348
        WITH_TESTS: "yes"
349

350
mpi_examples_Debug:
351 352 353 354 355 356 357 358 359
    <<: *build_template
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug
360
        WITH_EXAMPLES: "yes"
361

362
mpi_examples_Release:
363 364 365 366 367 368 369 370 371
    <<: *build_template
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Release
372
        WITH_EXAMPLES: "yes"
373

374
mpi_benchmarks_tools_python_Debug:
375 376 377
    <<: *build_template
    tags:
        - openmp
378
        - mpi
379 380 381
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
382
        WITH_MPI: "yes"
383
        BUILD_TYPE: Debug
384 385 386
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
387

388
mpi_benchmarks_tools_python_Release:
389 390 391
    <<: *build_template
    tags:
        - openmp
392
        - mpi
393 394 395
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
396
        WITH_MPI: "yes"
397
        BUILD_TYPE: Release
398 399 400
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
401 402


403 404 405


build documentation:
406
    stage: doc_build
407 408 409 410
    only:
        changes:
            - Documentation/**/*
            - src/TNL/**/*.{h,hpp}
411
            - .gitlab-ci.yml
412 413 414
    dependencies:
        # the job which builds Documentation/output_snippets/
        - cuda_examples_Debug
415 416 417 418 419 420 421 422
    script:
        - ./Documentation/build
    artifacts:
        paths:
            - ./Documentation/html/
    tags:
        - doxygen

423 424 425
deploy documentation:
    stage: deploy
    only:
426 427 428 429
        changes:
            - Documentation/**/*
            - src/TNL/**/*.{h,hpp}
            - .gitlab-ci.yml
430 431 432 433 434 435
        variables:
            - $TNL_DOC_DEPLOY_KEY
        refs:
            - develop
            - schedules
            - triggers
436 437
    dependencies:
        - build documentation
438 439 440 441
    script:
        - ./Documentation/deploy
    tags:
        - doxygen
442
        - deploy_key