xref: /petsc/.gitlab-ci.yml (revision 67de2c8aaebf457db47b77de7beae8eecd9be82b)
1#
2# stage-1 take only a few minutes; they do not run the full test suite or external packages.
3#
4# stage-2 runs on MCS systems and may take 10 to 15 minutes. They run the full test suite but with limited mixture of external packages
5#
6# stage-3 runs on MCS systems and may take an hour or more. They run the full test suite and heavily test external packages, utilize valgrind etc
7#
8# The stage-(n) tests are only started if all of the stage-(n-1) tests run without error
9#   You can limit the testing by using the variable STAGE with value 1 or 2
10#
11
12stages:
13  - stage-1
14  - stage-2
15  - stage-3
16  - stage-4
17variables:
18  GIT_STRATEGY: fetch
19  GIT_CLEAN_FLAGS: -ffdxq
20  TIMEOUT: 450
21  EXTRA_OPTIONS: -nox -nox_warning -malloc_dump
22
23#
24# The most basic template that most tests will expand upon
25#
26
27.test-basic:
28  interruptible: true
29  only:
30    refs:
31#     Set with CI/CD Shedules - New Schedule
32      - schedules
33      - api
34#     Set with CI/CD Pipelines - Run Pipeline
35      - web
36      - merge_requests
37  dependencies: []
38
39.test:
40  extends: .test-basic
41  except:
42    variables:
43      # Skip if the docs-only label is attached to a merge request
44      - $CI_MERGE_REQUEST_LABELS =~ /(^|,)docs-only($|,)/
45      - $PETSC_CI_SCHEDULED =~ /yes/
46
47check-ci-settings:
48  extends: .test-basic
49  stage: .pre
50  tags:
51    - gce-stage1
52  script:
53    - lib/petsc/bin/maint/check-ci-settings.sh
54
55#
56#  This provides the basic order of operations and options template for cloud based stage 1 tests.
57#  Not all test-short need to follow this template but most will.
58#
59
60.stage-1:
61  extends: .test
62  stage: stage-1
63  tags:
64    - gce-u22-stage1
65  before_script:
66    - date
67    - hostname
68    - grep PRETTY_NAME /etc/os-release
69    - nproc
70    - lscpu
71    - ccache --zero-stats
72  script:
73    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
74    - if [ ! -z ${INIT_SCRIPT+x} ]; then echo "sourcing ${INIT_SCRIPT}"; if [ -f ${HOME}/${INIT_SCRIPT} ]; then source ${HOME}/${INIT_SCRIPT}; else source ${INIT_SCRIPT}; fi; fi
75    - printf "PATH:$PATH\n"
76    - printf "PYTHONPATH:$PYTHONPATH\n"
77    - printf "CONFIG_OPTS:${CONFIG_OPTS}\n"
78    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
79    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
80    - ${PYTHON} ./configure --with-debugging=0 COPTFLAGS='-O3 -march=native' CXXOPTFLAGS='-O3 -march=native' FOPTFLAGS='-O3 -march=native' ${CONFIG_OPTS}
81    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}"
82    - if [ ! -z ${ENABLE_CHECK+x} ]; then make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" check; fi
83    - make CFLAGS="${MAKE_TEST_CFLAGS}" CXXFLAGS="${MAKE_TEST_CXXFLAGS}" FFLAGS="${MAKE_TEST_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" allgtests-tap gmakesearch="${TEST_SEARCH}" TIMEOUT=${TIMEOUT}
84  variables:
85    PYTHON: python3
86    MAKE_CFLAGS: -Werror
87    MAKE_CXXFLAGS: -Werror -Wzero-as-null-pointer-constant
88    MAKE_FFLAGS: -Werror
89    MAKE_TEST_CFLAGS: -Werror
90    MAKE_TEST_CXXFLAGS: -Werror
91    MAKE_TEST_FFLAGS: -Werror
92  after_script:
93    - date
94    - ccache --show-stats
95  artifacts:
96    reports:
97      junit: arch-*/tests/testresults.xml
98    name: "$CI_JOB_NAME"
99    when: always
100    paths:
101    - arch-*/lib/petsc/conf/*.log
102    - arch-*/lib/pkgconfig/petsc.pc
103    - arch-*/tests/testresults.xml
104    - arch-*/tests/test_*_tap.log
105    - arch-*/tests/test_*_err.log
106    expire_in: 4 days
107
108#
109# The following tests run on the cloud as part of stage-1.
110#
111
112ompi-cuda:
113  extends: .stage-1
114  tags:
115  - cuda-stage1
116  variables:
117    CONFIG_OPTS: --with-mpi-dir=/nfs/gce/software/custom/linux-ubuntu22.04-x86_64/spack/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.3.0/openmpi-4.1.3-qrpnszy --with-cuda=1 --with-cuda-arch=all-major --CUDAPPFLAGS=-Wno-deprecated-gpu-targets --with-fc=0
118    TEST_SEARCH: snes_tutorials-ex19_cuda%
119    ENABLE_CHECK: 1
120    MAKE_CXXFLAGS: -Werror
121    MAKE_CUDAFLAGS: -Xcompiler -Wall -Xcompiler -Werror
122
123mpich-cxx-py3:
124  extends: .stage-1
125  variables:
126    CONFIG_OPTS: --with-clanguage=cxx --with-fc=0 CXXFLAGS=-std=c++11 --with-strict-petscerrorcode
127    TEST_SEARCH: snes_tutorials-ex48%
128    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
129
130uni-complex-float-int64:
131  extends: .stage-1
132  variables:
133    CONFIG_OPTS: --with-mpi=0 --with-scalar-type=complex --with-precision=single --with-64-bit-indices
134    TEST_SEARCH: ts_tutorials-ex11_adv_2d_quad_%
135    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
136
137c99-mlib-static-py:
138  extends: .stage-1
139  variables:
140    CONFIG_OPTS: --with-single-library=0 --with-shared-libraries=0 --with-strict-petscerrorcode CFLAGS=-std=c99 FFLAGS= CXXFLAGS=
141    ENABLE_CHECK: 1
142    TEST_SEARCH: snes_tutorials-ex19% snes_tutorials-ex5f90t%
143    MAKE_TEST_FFLAGS: -Werror -std=f2008
144    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
145
146clang-uni:
147  extends: .stage-1
148  variables:
149    CONFIG_OPTS: --with-cc=clang --with-cxx=clang++ --with-mpi=0
150    TEST_SEARCH: snes_tutorials-ex48%
151
152petsc4py-install:
153  extends: .stage-2
154  tags:
155    - gce-u22-stage1
156  variables:
157    PYTHON: python3
158    T_PREFIX: petsc-install
159    T_DESTDIR: petsc-destdir
160    T_PETSC4PY: src/binding/petsc4py
161    T_VALIDATE_CMD: lib/petsc/bin/maint/validate-petsc4py.sh
162  script:
163    - printf "PATH:$PATH\n"
164    - mkdir hide
165    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
166    - ${PYTHON} ./configure --prefix="${PWD}/${T_PREFIX}" --with-petsc4py=1 --with-debugging=0
167    - make CFLAGS=-Werror CXXFLAGS="-Werror -Wzero-as-null-pointer-constant" FFLAGS=-Werror
168    - printf "====== Test A. Install into staging directory then into prefix directory (mimics distro package recipe) =====\n"
169    - make install DESTDIR="${PWD}/${T_DESTDIR}"
170    - test "$(find ${PWD}/${T_PREFIX} -mindepth 1 | wc -l)" -eq 0
171    - test "$(find ${PWD}/${T_DESTDIR} -mindepth 1 | wc -l)" -gt 0
172    - (cd "${PWD}/${T_DESTDIR}" && find * -exec install -v -D "{}" "/{}" \; )
173    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
174    - rm -r "${PWD}/${T_PREFIX}" "${PWD}/${T_DESTDIR}" && mkdir "${PWD}/${T_PREFIX}"
175    - printf "====== Test B. Install directly into prefix directory =====\n"
176    - make install
177    - test "$(find ${PWD}/${T_PREFIX} -mindepth 1 | wc -l)" -gt 0
178    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
179    - rm -r "${PWD}/${T_PREFIX}"/*/petsc4py*
180    - printf "====== Test C. Install manually with setuptools =====\n"
181    - export PETSC_DIR="${PWD}/${T_PREFIX}" && (cd "${T_PETSC4PY}" && ${PYTHON} setup.py build)
182    - export PETSC_DIR="${PWD}/${T_PREFIX}" P="${PWD}" && (cd "${T_PETSC4PY}" && ${PYTHON} setup.py install --install-lib="${P}/${T_PREFIX}/lib")
183    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
184    - rm -r "${PWD}/${T_PREFIX}"/*/petsc4py*
185    - printf "====== Test D. Install manually with setuptools with staging =====\n"
186    - export PETSC_DIR="${PWD}/${T_PREFIX}" P="${PWD}" && (cd "${T_PETSC4PY}" && ${PYTHON} setup.py install --root="${P}/${T_DESTDIR}" --install-lib="${P}/${T_PREFIX}/lib")
187    - (cd "${PWD}/${T_DESTDIR}" && find * -exec install -v -D "{}" "/{}" \; )
188    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
189
190petsc4py-pip:
191  extends: .stage-2
192  tags:
193    - gce-u22-stage1
194  variables:
195    PETSC_CONFIGURE_OPTIONS: --with-mpi=0 --with-fc=0
196    CFLAGS: -O0
197  script:
198    - python3 -m venv pip-builds
199    - source pip-builds/bin/activate
200    - python3 -m pip install --upgrade pip==23.0.1
201    - python3 -m pip install .
202    - python3 -m pip install src/binding/petsc4py
203    - python3 -m petsc4py
204
205checksource:
206  extends: .test-basic
207  stage: .pre
208  tags:
209    - gce-u22-stage1
210  script:
211    - python3 ./configure --with-mpi=0 --with-fc=0 --with-cxx=0
212    - vermin --version
213    - make vermin
214    - PATH=/nfs/gce/projects/petsc/soft/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin:$PATH make checkclangformat SHELL=bash
215    - make checkbadSource SHELL=bash
216    - make checkbadFileChange SHELL=bash
217    - make -f gmakefile check_output SHELL=bash
218    - make check_petsc4py_rst
219  artifacts:
220    name: "$CI_JOB_NAME"
221    when: always
222    paths:
223    - arch-*/lib/petsc/conf/*.patch
224    - arch-*/lib/petsc/conf/*.log
225    expire_in: 4 days
226
227pause-for-approval:
228  extends: .test
229  stage: .pre
230  tags:
231    - gce-stage1
232  only:
233    refs:
234      - merge_requests
235    variables:
236      - $CI_MERGE_REQUEST_EVENT_TYPE == "merged_result"
237      - $CI_MERGE_REQUEST_EVENT_TYPE == "detached"
238  script:
239    - echo "pause-for-approval has no script to run"
240  variables:
241    GIT_STRATEGY: none
242  when: manual
243  allow_failure: false
244
245#
246# Basic template for code coverage generation. Tests should additionally inherit from the more
247# specialized OS-specific versions instead of this one.
248#
249
250.coverage-generate:
251  variables:
252    RUN_GCOV: 1
253    RUN_GCOV_OPTIONS: --decisions
254
255.coverage-disable:
256  variables:
257    RUN_GCOV: 0
258
259#
260# This provides the basic order of operations and options template for stage-2,3 tests.
261# Not all stage-2,3 need to follow this template, but most will.
262#
263.stage-23:
264  extends:
265    - .test
266    - .coverage-generate
267  script:
268    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
269    - if [ ! -z ${GCOV_MODULES+x} ]; then module --trace load ${GCOV_MODULES}; module list; fi
270    - if [ ! -z ${INIT_SCRIPT+x} ]; then echo "sourcing ${INIT_SCRIPT}"; if [ -f ${HOME}/${INIT_SCRIPT} ]; then source ${HOME}/${INIT_SCRIPT}; else source ${INIT_SCRIPT}; fi; fi
271    - if [ "${RUN_GCOV}" == 1 ]; then
272        printf "RUN_GCOV_OPTIONS:$RUN_GCOV_OPTIONS\n";
273        gcovr --version;
274      fi
275    - if [ -d ${HOME}/petsc-hash-pkgs/ ]; then find ${HOME}/petsc-hash-pkgs/ -maxdepth 1 -mindepth 1 -type d -mtime +25 -exec rm -rf {} \; ; fi
276    - printf "PATH:$PATH\n"
277    - printf "PYTHONPATH:$PYTHONPATH\n"
278    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
279    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
280    - printf "./config/examples/${TEST_ARCH}.py\n"
281    - cat ./config/examples/${TEST_ARCH}.py
282    - ./config/examples/${TEST_ARCH}.py || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
283    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
284    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" check || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
285    - make updatedatafiles
286    - if [ -z ${DISABLE_PETSC4PY_TESTS+x} ]; then if [ -z ${ENABLE_PETSC4PY_LDPRELOAD+x} ]; then echo "NOT using LD_PRELOAD"; make petsc4pytest; else echo "using LD_PRELOAD"; LD_PRELOAD=${PWD}/${TEST_ARCH}/lib/libpetsc.so make petsc4pytest; fi; fi
287    - if [ -z ${DISABLE_TESTS+x} ]; then make cleantest && make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" allgtests-tap TIMEOUT=${TIMEOUT}  ${TEST_OPTS} || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi; fi
288    - if [ "${RUN_GCOV}" == 1 ]; then make gcov PETSC_GCOV_OPTIONS="${RUN_GCOV_OPTIONS}"; fi
289  artifacts:
290    reports:
291      junit: arch-*/tests/testresults.xml
292    name: "$CI_JOB_NAME"
293    when: always
294    paths:
295    - arch-*/lib/petsc/conf/*.log
296    - arch-*/lib/pkgconfig/petsc.pc
297    - arch-*/tests/testresults.xml
298    - arch-*/tests/test_arch-*_tap.log
299    - arch-*/tests/test_arch-*_err.log
300    - arch-*/arch-*-gcovr-report.json.tar.bz2
301    expire_in: 4 days
302  variables:
303    OPENBLAS_NUM_THREADS: 1
304
305.stage-2:
306  extends: .stage-23
307  stage: stage-2
308
309.stage-3:
310  extends: .stage-23
311  stage: stage-3
312
313#
314# The following provide templates for various OSes for pre/post info
315#
316
317.linux_test_noflags:
318  before_script:
319    - date
320    - hostname
321    - grep PRETTY_NAME /etc/os-release
322    - nproc
323    - lscpu
324    - ccache --zero-stats
325  after_script:
326    - date
327    - ccache --show-stats
328
329.linux_test_nofflags:
330  extends: .linux_test_noflags
331  variables:
332    MAKE_CFLAGS: -Werror
333    MAKE_CXXFLAGS: -Werror
334
335.linux_test:
336  extends: .linux_test_noflags
337  variables:
338    MAKE_CFLAGS: -Werror
339    MAKE_CXXFLAGS: -Werror
340    MAKE_FFLAGS: -Werror
341
342.freebsd_test:
343  extends:
344    - .coverage-disable
345  variables:
346    MAKE_CFLAGS: -Werror
347    MAKE_CXXFLAGS: -Werror
348    MAKE_FFLAGS: -Werror
349  before_script:
350    - date
351    - hostname
352    - freebsd-version
353    - echo $(sysctl -n hw.ncpu)
354    - ccache --zero-stats
355  after_script:
356    - date
357    - ccache --show-stats
358
359.osx_test:
360  variables:
361    MAKE_CFLAGS: -Werror
362    MAKE_CXXFLAGS: -Werror
363    MAKE_FFLAGS: -Werror
364  before_script:
365    - date
366    - hostname
367    - sw_vers -productVersion
368    - echo $(sysctl -n hw.ncpu)
369    - ccache --zero-stats
370  after_script:
371    - date
372    - ccache --show-stats
373
374.mswin_test:
375  extends:
376    - .coverage-disable
377  before_script:
378    - date
379    - hostname
380    - uname -a
381    - nproc
382  after_script:
383    - date
384
385#
386# The following tests run as part of stage-2.
387#
388# The tags variable used in the tests below connects the particular test with the runners
389# listed on the left hand side of https://gitlab.com/petsc/petsc/-/settings/ci_cd.
390# For example the test 'linux-sycl-double' any runner that has the tags 'gce-u22-stage3, linux-fast'
391# (in a blue box beneath it)
392#
393
394osx-arm:
395  extends:
396    - .stage-3
397    - .osx_test
398    - .coverage-disable
399  tags:
400    - os:macos-arm
401  variables:
402    TEST_ARCH: arch-ci-osx-arm
403    PETSC_OPTIONS: -check_pointer_intensity 0 -error_output_stdout
404    INIT_SCRIPT: .zprofile
405
406freebsd-cxx-cmplx-64idx-dbg:
407  extends:
408    - .stage-2
409    - .freebsd_test
410  tags:
411    - os:fbsd
412  variables:
413    TEST_ARCH: arch-ci-freebsd-cxx-cmplx-64idx-dbg
414
415freebsd-c-single-opt:
416  extends:
417    - .stage-2
418    - .freebsd_test
419  tags:
420    - os:fbsd
421  variables:
422    TEST_ARCH: arch-ci-freebsd-c-single-opt
423
424mswin-opt-impi:
425  extends:
426    - .stage-3
427    - .mswin_test
428  tags:
429    - mswin-stage3
430  variables:
431    TEST_ARCH: arch-ci-mswin-opt-impi
432    TEST_OPTS: search='ksp_ksp_tests*'
433
434linux-gcc-quad-64idx-dbg:
435  extends:
436    - .stage-2
437    - .linux_test
438  tags:
439    - gce-stage2
440  variables:
441    TEST_ARCH: arch-ci-linux-gcc-quad-64idx-dbg
442
443linux-gcc-pkgs-opt:
444  extends:
445    - .stage-2
446    - .linux_test
447  tags:
448    - gce-stage2
449  variables:
450    TEST_ARCH: arch-ci-linux-gcc-pkgs-opt
451  except:
452    variables:
453      - $PETSC_CI_SCHEDULED =~ /yes/
454
455linux-gcc-complex-opt-32bit:
456  extends:
457    - .stage-2
458    - .linux_test
459  tags:
460    - gce-stage2
461  variables:
462    TEST_ARCH: arch-ci-linux-gcc-complex-opt-32bit
463
464linux-emcc:
465  extends:
466    - .stage-2
467    - .linux_test
468    - .coverage-disable
469  tags:
470    - gce-stage2
471  variables:
472    TEST_ARCH: arch-ci-linux-emcc
473    INIT_SCRIPT: /nfs/gce/projects/petsc/soft/u22.04/emsdk/emsdk_env.sh
474    DISABLE_TESTS: 1
475
476#
477# The following tests run as part of stage-3.
478#
479
480freebsd-cxx-cmplx-pkgs-dbg:
481  extends:
482    - .stage-3
483    - .freebsd_test
484  tags:
485    - os:fbsd
486  variables:
487    TEST_ARCH: arch-ci-freebsd-cxx-cmplx-pkgs-dbg
488
489freebsd-cxx-pkgs-opt:
490  extends:
491    - .stage-3
492    - .freebsd_test
493  tags:
494    - os:fbsd
495  variables:
496    PETSC_OPTIONS: -vecscatter_mpi1 false -options_left false
497    TEST_ARCH: arch-ci-freebsd-cxx-pkgs-opt
498
499freebsd-pkgs-opt:
500  extends:
501    - .stage-3
502    - .freebsd_test
503  tags:
504    - os:fbsd
505  variables:
506    TEST_ARCH: arch-ci-freebsd-pkgs-opt
507    MAKE_CFLAGS: -DPETSC_SKIP_COMPLEX -Werror
508
509linux-hip-double:
510  extends:
511    - .stage-3
512    - .linux_test_noflags
513    - .coverage-disable
514  tags:
515    - gpu:amd, os:linux
516  variables:
517    TEST_ARCH: arch-ci-linux-hip-double
518
519linux-sycl-double:
520  extends:
521    - .stage-3
522    - .linux_test_nofflags
523    - .coverage-disable
524  tags:
525    - gce-u22-stage3, linux-fast
526  variables:
527    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/oneapi/modulefiles
528    TEST_ARCH: arch-ci-linux-sycl-double
529    LOAD_MODULES: compiler/latest mpi/latest
530    TEST_OPTS: query=requires queryval=kokkos_kernels
531    MAKE_CFLAGS: -Wno-expected-file-type -Werror
532
533linux-cuda-pkgs:
534  extends:
535    - .stage-3
536    - .linux_test
537  tags:
538    - cuda-stage3
539  variables:
540    TEST_ARCH: arch-ci-linux-cuda-pkgs
541    # run all tests that:
542    # 1. require cuda, OR
543    # 2. require device, OR
544    # 3. require hypre, OR
545    # 4. require kokkos[_kernels], AND lives in the vec subdirectory
546    #
547    # need to use the alternate OR spelling since '|' is interpreted as a pipe by the
548    # shell, and I could not manage to escape it enough times...
549    TEST_OPTS: -j3 queryval='cuda,device,hypre,kokkos*,vec*' query='requires,requires,requires,requires%OR%name'
550    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
551
552linux-cuda112-omp:
553  extends:
554    - .stage-3
555    - .linux_test
556    - .coverage-disable
557  tags:
558    - cuda-stage3
559  variables:
560    TEST_ARCH: arch-ci-linux-cuda112-omp
561    TEST_OPTS: -j4 query=requires queryval=kokkos_kernels
562    LOAD_MODULES: cuda/11.2.2 u-gcc-9/9.4.0
563    OMP_PROC_BIND: "false"
564    OMP_NUM_THREADS: 1
565    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
566
567linux-cuda-cmplx:
568  extends:
569    - .stage-3
570    - .linux_test
571  tags:
572    - cuda-stage3
573  variables:
574    TEST_ARCH: arch-ci-linux-cuda-cmplx
575    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
576
577linux-cuda-double-64idx:
578  extends:
579    - .stage-3
580    - .linux_test
581  tags:
582    - cuda12
583  variables:
584    TEST_ARCH: arch-ci-linux-cuda-double-64idx
585    TEST_OPTS: -j3 query=requires queryval=cuda
586    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
587
588linux-cuda-single-cxx:
589  extends:
590    - .stage-3
591    - .linux_test_noflags
592    - .coverage-disable
593  tags:
594    - cuda-stage3
595  variables:
596    TEST_ARCH: arch-ci-linux-cuda-single-cxx
597    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2023-02-02/share/spack/modules/linux-ubuntu22.04-ivybridge
598    LOAD_MODULES: nvhpc-22.11-gcc-11.3.0-vmvmbrx
599    TEST_OPTS: -j15 query=requires queryval=cuda
600
601linux-cuda-uni-pkgs:
602  extends:
603    - .stage-3
604    - .linux_test
605  tags:
606    - cuda-stage3
607  variables:
608    TEST_ARCH: arch-ci-linux-cuda-uni-pkgs
609    TEST_OPTS: -j20 query=requires queryval=cuda
610    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
611
612linux-clang-cuda:
613  extends:
614    - .stage-3
615    - .linux_test
616    - .coverage-disable
617  tags:
618    - cuda-stage3
619  variables:
620    TEST_ARCH: arch-ci-linux-clang-cuda
621    TEST_OPTS: -j 1  queryval='cuda*,snes*' query='requires%OR%name'
622    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2023-02-02/share/spack/modules/linux-ubuntu22.04-ivybridge
623    LOAD_MODULES: llvm-15.0.7-gcc-11.3.0-pjldtxf cuda-11.5.2-gcc-11.3.0-jkoottx gcc-11.3.0-gcc-11.3.0-pgrvke5
624    MAKE_CUDAFLAGS: -Wno-pass-failed -Werror
625
626linux-viennacl:
627  extends:
628    - .stage-3
629    - .linux_test
630  tags:
631    - cuda-stage3
632  variables:
633    TEST_ARCH: arch-ci-linux-viennacl
634    MAKE_CXXFLAGS: -Werror -Wno-ignored-attributes
635    TEST_OPTS: -j20 query=requires queryval=viennacl
636
637linux-without-fc:
638  extends:
639    - .stage-3
640    - .linux_test
641  tags:
642    - gce-u22-stage3
643  variables:
644    TEST_ARCH: arch-ci-linux-without-fc
645
646linux-cmplx-single-arm:
647  extends:
648    - .stage-3
649    - .linux_test
650    # gcovr does not work on arm/linux
651    - .coverage-disable
652  tags:
653    - arch:arm, os:linux
654  variables:
655    FLEXIBLAS: netlib
656    TEST_ARCH: arch-ci-linux-cmplx-single-arm
657
658linux-gcc-cxx-avx2:
659  extends:
660    - .stage-3
661    - .linux_test
662  tags:
663    - name:petsc-knl-01
664  variables:
665    TEST_ARCH: arch-ci-linux-gcc-cxx-avx2
666
667linux-clang-avx:
668  extends:
669    - .stage-3
670    - .linux_test
671  tags:
672    - name:petsc-knl-01
673  variables:
674    TEST_ARCH: arch-ci-linux-clang-avx
675
676linux-knl:
677  extends:
678    - .stage-3
679    - .linux_test
680    - .coverage-disable
681  tags:
682    - name:petsc-knl-01
683  variables:
684    MAKE_FFLAGS: -warn errors
685    TEST_ARCH: arch-ci-linux-knl
686    LOAD_MODULES: intel-oneapi-compilers/2022.0.2 intel-oneapi-mkl/2022.0.2 intel-oneapi-mpi/2021.5.1
687
688linux-intel-mkl-single:
689  extends:
690    - .stage-3
691    - .linux_test_nofflags
692    - .coverage-disable
693  tags:
694    - name:petsc-knl-01
695  variables:
696    TEST_ARCH: arch-ci-linux-intel-mkl-single
697    LOAD_MODULES: intel-oneapi-compilers/2022.0.2 intel-oneapi-mkl/2022.0.2 intel-oneapi-mpi/2021.5.1
698
699linux-cxx-cmplx-pkgs-64idx:
700  extends:
701    - .stage-3
702    - .linux_test
703  tags:
704    - gce-u22-stage3
705  variables:
706    TEST_ARCH: arch-ci-linux-cxx-cmplx-pkgs-64idx
707    PETSC_OPTIONS: -fp_trap
708
709# Set env vars for 'Kokkos + OpenMP' tests, so that they won't give warnings
710linux-pkgs-dbg-ftn-interfaces:
711  extends:
712    - .stage-3
713    - .linux_test
714    - .coverage-disable
715  tags:
716    - gce-u22-stage3
717  variables:
718    TEST_ARCH: arch-ci-linux-pkgs-dbg-ftn-interfaces
719    OMP_PROC_BIND: "false"
720    OMP_NUM_THREADS: 4
721    PETSC_OPTIONS: -fp_trap
722
723linux-pkgs-cxx-mlib:
724  extends:
725    - .stage-3
726    - .linux_test
727  tags:
728    - gce-u22-stage3
729  variables:
730    TEST_ARCH: arch-ci-linux-pkgs-cxx-mlib
731    PETSC_OPTIONS: -fp_trap
732
733linux-pkgs-valgrind:
734  extends:
735    - .stage-3
736    - .linux_test
737  tags:
738    - gce-valgrind
739  variables:
740    TEST_ARCH: arch-ci-linux-pkgs-valgrind
741    TIMEOUT: 7200
742
743linux-pkgs-opt:
744  extends:
745    - .stage-3
746    - .linux_test
747  tags:
748    - gce-u22-stage3, linux-fast
749  variables:
750    TEST_ARCH: arch-ci-linux-pkgs-opt
751    LOAD_MODULES: gcc/12.1.0
752    MAKE_CXXFLAGS: -Wno-deprecated-declarations -Werror
753
754linux-pkgs-dbg:
755  extends:
756    - .stage-3
757    - .linux_test
758  tags:
759    - gce-u22-stage3, linux-gcov
760  variables:
761    TEST_ARCH: arch-ci-linux-pkgs-dbg
762    PETSC_OPTIONS: -fp_trap
763
764linux-matlab-ilp64:
765  extends:
766    - .stage-3
767    - .linux_test
768  tags:
769    - gce-u22-stage3, linux-gcov
770  variables:
771    TEST_ARCH: arch-ci-linux-matlab-ilp64
772    LOAD_MODULES: gcc/9.4.0 matlab/R2022a
773  allow_failure: true
774
775linux-pgi:
776  extends:
777    - .stage-3
778    - .linux_test_noflags
779    - .coverage-disable
780  tags:
781    - gce-u22-stage3, linux-mcpu
782  variables:
783    TEST_ARCH: arch-ci-linux-pgi
784    LOAD_MODULES: nvhpc/22.3
785
786# If the Nag license server fails then ${PETSC_DIR}/naglicenseproblem is created and the job is marked as failed but allow_failure
787linux-nagfor:
788  extends:
789    - .stage-3
790    - .linux_test_nofflags
791  tags:
792    - gce-stage2, linux-mcpu
793  variables:
794    LOAD_MODULES: nag/6.1
795    TEST_ARCH: arch-ci-linux-nagfor
796  allow_failure:
797    exit_codes: 126
798
799linux-intel-cmplx:
800  extends:
801    - .stage-3
802    - .linux_test_nofflags
803    - .coverage-disable
804  tags:
805    - gce-u22-stage3
806  variables:
807    TEST_ARCH: arch-ci-linux-intel-cmplx
808    LOAD_MODULES: intel-oneapi-compilers/2023.0.0 intel-oneapi-mkl/2022.0.2
809
810linux-xsdk-dbg:
811  extends:
812    - .stage-3
813    - .linux_test
814  tags:
815    - gce-u22-stage3
816  variables:
817    TEST_ARCH: arch-ci-linux-xsdk-dbg
818    LOAD_MODULES: gcc/12.1.0
819
820linux-analyzer:
821  extends:
822    - .stage-2
823    - .linux_test
824    - .coverage-disable
825  tags:
826    - gce-u22-stage2
827  script:
828    - printf "PATH:$PATH\n"
829    - printf "PYTHONPATH:$PYTHONPATH\n"
830    - python3 --version
831    - git --version
832    - mypy --version
833    - vermin --version
834    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
835    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
836    - printf "./config/examples/${TEST_ARCH}.py\n"
837    - cat ./config/examples/${TEST_ARCH}.py
838    - ./config/examples/${TEST_ARCH}.py
839    - make LINTER_OPTIONS="${LINTER_OPTIONS}" test-lint
840    - make V=3 LINTER_OPTIONS="${LINTER_OPTIONS} -- ./src" lint
841  variables:
842    TEST_ARCH: arch-ci-linux-analyzer
843    LINTER_OPTIONS: "--PETSC_ARCH=${TEST_ARCH} --clang_lib=`llvm-config-14 --libdir`/libclang.so.1 --werror 1"
844  artifacts:
845    paths:
846    - arch-*/lib/petsc/conf/*.log
847    - ./petscLintPatches/*.patch
848    expire_in: 4 days
849  except:
850    variables:
851      - $PETSC_CI_SCHEDULED =~ /yes/
852
853linux-intel:
854  extends:
855    - .stage-3
856    - .linux_test_nofflags
857    - .coverage-disable
858  tags:
859    - gce-u22-stage3
860  variables:
861    TEST_ARCH: arch-ci-linux-intel
862    LOAD_MODULES: intel-oneapi-compilers/2023.0.0 intel-oneapi-mkl/2022.0.2
863
864linux-opt-arm:
865  extends:
866    - .stage-3
867    - .linux_test
868    # gcovr does not work on arm/linux
869    - .coverage-disable
870  tags:
871    - arch:arm, os:linux
872  variables:
873    TEST_ARCH: arch-ci-linux-opt-arm
874
875linux-pkgs-64idx:
876  extends:
877    - .stage-3
878    - .linux_test
879  tags:
880    - gce-u22-stage3, linux-mcpu
881  variables:
882    TEST_ARCH: arch-ci-linux-pkgs-64idx
883    LOAD_MODULES: intel-oneapi-mkl/2022.0.2
884
885linux-64idx-i8:
886  extends:
887    - .stage-3
888    - .linux_test
889  tags:
890    - gce-u22-stage3, linux-mcpu
891  variables:
892    TEST_ARCH: arch-ci-linux-64idx-i8
893
894linux-gcc-ifc-cmplx:
895  extends:
896    - .stage-3
897    - .linux_test_nofflags
898  tags:
899    - gce-u22-stage3
900  variables:
901    TEST_ARCH: arch-ci-linux-gcc-ifc-cmplx
902    LOAD_MODULES: intel-oneapi-compilers/2022.2.1
903
904linux-opt-cxx-quad:
905  extends:
906    - .stage-3
907    - .linux_test
908  tags:
909    - gce-u22-stage3
910  variables:
911    TEST_ARCH: arch-ci-linux-opt-cxx-quad
912
913linux-ILP64:
914  extends:
915    - .stage-3
916    - .linux_test
917  tags:
918    - gce-u22-stage3
919  variables:
920    TEST_ARCH: arch-ci-linux-ILP64
921    LOAD_MODULES: gcc/8.5.0 mpich/2-1.5-gcc-8.5.0
922    MAKE_CFLAGS: -Wno-discarded-qualifiers -Werror
923
924linux-64idx-i8-uni:
925  extends:
926    - .stage-3
927    - .linux_test
928  tags:
929    - gce-u22-stage3, linux-mcpu
930  variables:
931    TEST_ARCH: arch-ci-linux-64idx-i8-uni
932
933linux-misc-32bit:
934  extends:
935    - .stage-3
936    - .linux_test
937  tags:
938    - gce-u22-stage3
939  variables:
940    TEST_ARCH: arch-ci-linux-misc-32bit
941
942mswin-intel-cxx-cmplx:
943  extends:
944    - .stage-3
945    - .mswin_test
946  tags:
947    - mswin-stage3
948  variables:
949    TEST_ARCH: arch-ci-mswin-intel-cxx-cmplx
950
951mswin-uni:
952  extends:
953    - .stage-3
954    - .mswin_test
955  tags:
956    - mswin-stage3
957  variables:
958    PETSC_OPTIONS: -check_pointer_intensity 0 -error_output_stdout
959    TEST_ARCH: arch-ci-mswin-uni
960
961mswin-gnu:
962  extends:
963    - .stage-3
964    - .mswin_test
965  tags:
966    - mswin-stage3
967  variables:
968    TEST_ARCH: arch-ci-mswin-gnu
969    MAKE_CFLAGS: -Werror
970    MAKE_CXXFLAGS: -Werror
971    MAKE_FFLAGS: -Werror
972    DISABLE_TESTS: 1
973
974#mswin-intel:
975#  extends:
976#    - .stage-3
977#    - .mswin_test
978#  tags:
979#    - os:win
980#  variables:
981#    TEST_ARCH: arch-ci-mswin-intel
982
983osx-cxx-cmplx-pkgs-dbg:
984  extends:
985    - .stage-3
986    - .osx_test
987    - .coverage-disable
988  tags:
989    - os:macos-x64
990  variables:
991    TEST_ARCH: arch-ci-osx-cxx-cmplx-pkgs-dbg
992    INIT_SCRIPT: .zprofile
993
994osx-cxx-pkgs-opt-arm:
995  extends:
996    - .stage-3
997    - .osx_test
998    - .coverage-disable
999  tags:
1000    - os:macos-arm
1001  variables:
1002    PETSC_OPTIONS: -vecscatter_mpi1 false -options_left false
1003    TEST_ARCH: arch-ci-osx-cxx-pkgs-opt-arm
1004    MAKE_CXXFLAGS: -Werror -Wno-pass-failed
1005    INIT_SCRIPT: .zprofile
1006
1007osx-dbg:
1008  extends:
1009    - .stage-3
1010    - .osx_test
1011    - .coverage-disable
1012  tags:
1013    - os:macos-x64
1014  variables:
1015    TEST_ARCH: arch-ci-osx-dbg
1016    ASAN_OPTIONS: log_path=stdout
1017    INIT_SCRIPT: .zprofile
1018
1019osx-xsdk-opt:
1020  extends:
1021    - .stage-3
1022    - .osx_test
1023    - .coverage-disable
1024  tags:
1025    - os:macos-x64
1026  variables:
1027    TEST_ARCH: arch-ci-osx-xsdk-opt
1028    INIT_SCRIPT: .zprofile
1029
1030# job for analyzing the coverage results and generating the various reports
1031coverage-analyze:
1032  extends: .test
1033  stage: stage-4
1034  tags:
1035    - gce-u22-short
1036  dependencies:
1037    # stage-2
1038    - linux-gcc-quad-64idx-dbg
1039    - linux-gcc-pkgs-opt
1040    - linux-gcc-complex-opt-32bit
1041    # stage-3
1042    - linux-pkgs-dbg
1043    - linux-matlab-ilp64
1044    - linux-cuda-pkgs
1045    - linux-cxx-cmplx-pkgs-64idx
1046    - linux-cuda-cmplx
1047    - linux-cuda-double-64idx
1048    - linux-cuda-uni-pkgs
1049    - linux-viennacl
1050    - linux-without-fc
1051    - linux-gcc-cxx-avx2
1052    - linux-clang-avx
1053    - linux-pkgs-cxx-mlib
1054    - linux-pkgs-valgrind
1055    - linux-nagfor
1056    - linux-xsdk-dbg
1057    - linux-pkgs-64idx
1058    - linux-pkgs-opt
1059    - linux-64idx-i8
1060    - linux-gcc-ifc-cmplx
1061    - linux-opt-cxx-quad
1062    - linux-ILP64
1063    - linux-64idx-i8-uni
1064  variables:
1065    PYTHON: python3
1066    PETSC_ARCH: arch-ci-analyze-pipeline
1067  before_script:
1068    - date
1069    - hostname
1070  script:
1071    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
1072    - ${PYTHON} --version
1073    - gcovr --version
1074    - printf "PATH:$PATH\n"
1075    - printf "PYTHONPATH:$PYTHONPATH\n"
1076    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
1077    - ${PYTHON} ./configure --with-mpi=0 --with-cxx=0 --download-sowing --with-fortran-bindings
1078    - make mergegcov PETSC_GCOV_OPTIONS='--ci-mode --verbose'
1079  coverage: /^\s*lines:\s*\d+.\d+\%/
1080  artifacts:
1081    name: "$CI_JOB_NAME"
1082    when: always
1083    paths:
1084    - arch-ci-analyze-pipeline/gcovr/*
1085    - arch-ci-analyze-pipeline/lib/petsc/conf/*.log
1086    expire_in: 4 days
1087    reports:
1088      coverage_report:
1089        coverage_format: cobertura
1090        path: arch-ci-analyze-pipeline/gcovr/xml/*.xml
1091
1092# template for the coverage review jobs, these must be separate jobs as you cannot deploy multiple
1093# environments from one job...
1094.coverage-review:
1095  extends: .test
1096  stage: .post
1097  tags:
1098    - gce-u22-short
1099  dependencies:
1100    - coverage-analyze
1101  script:
1102    - date
1103    - hostname
1104  artifacts:
1105    name: "$CI_JOB_NAME"
1106    when: always
1107    paths:
1108    - arch-ci-analyze-pipeline/gcovr/*
1109    - arch-ci-analyze-pipeline/lib/petsc/conf/*.log
1110    expire_in: 4 days
1111
1112coverage-total-review:
1113  extends: .coverage-review
1114  environment:
1115    name: coverage/all/$CI_COMMIT_REF_SLUG
1116    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/arch-ci-analyze-pipeline/gcovr/html/report.html
1117    auto_stop_in: one week
1118    deployment_tier: testing
1119
1120coverage-untested-review:
1121  extends: .coverage-review
1122  environment:
1123    name: coverage/untested/$CI_COMMIT_REF_SLUG
1124    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/arch-ci-analyze-pipeline/gcovr/html_untested/report_untested.html
1125    auto_stop_in: one week
1126    deployment_tier: testing
1127
1128analyze-pipeline:
1129  extends: .coverage-review
1130  script:
1131    - date
1132    - hostname
1133    # This file is created by lib/petsc/bin/maint/gcov.py. If it exists then the CI
1134    # pipeline should fail
1135    - if [ -f ./arch-ci-analyze-pipeline/gcovr/.CI_FAIL ]; then
1136        cat ./arch-ci-analyze-pipeline/gcovr/merge_gcov_errors.log;
1137        exit 1;
1138      fi
1139  allow_failure: true
1140
1141#
1142# Base job for a documentation build (runs in venv to allow installing additional packages without root)
1143#
1144.docs:
1145  stage: stage-2
1146  tags:
1147    - linux-docs
1148  before_script:
1149    - git fetch --unshallow --no-tags origin +release:remotes/origin/release +main:remotes/origin/main
1150    - module --trace load python-3.11.2-gcc-9.4.0-6p2ktlj
1151    - printf "PATH:$PATH\n"
1152    - printf "PYTHONPATH:$PYTHONPATH\n"
1153    - VENV=venv-petsc-docs &&
1154      python3 -m venv $VENV &&
1155      . $VENV/bin/activate &&
1156      cd doc &&
1157      python3 -m pip install -r requirements.txt
1158
1159#
1160# Build documentation and make available for review using GitLab pages
1161#
1162docs-review:
1163  extends:
1164    - .docs
1165    - .test-basic
1166  script:
1167    - (time make html BUILDDIR="../public" SPHINXOPTS="-T -E -W --keep-going -j 2") || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1168    - (time make latexpdf SPHINXOPTS="-T -E -W --keep-going -j 2") || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1169    - cp _build/latex/manual.pdf ../public/html/manual/
1170  environment:
1171    name: review/$CI_COMMIT_REF_NAME
1172    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/html/index.html
1173    auto_stop_in: one week
1174    deployment_tier: development
1175  artifacts:
1176    paths:
1177      - public
1178    expire_in: 4 days
1179  except:
1180    variables:
1181      - $PETSC_CI_SCHEDULED =~ /yes/
1182
1183#
1184# Deploy documentation using GitLab pages
1185#
1186pages:  # this job name has special meaning to GitLab
1187  extends: .docs
1188  interruptible: true
1189  script:
1190    - mkdir -p ../public/ && cp public/* ../public/
1191    - (git checkout origin/main && pip install -r requirements.txt && make website-deploy SPHINXOPTS="-j 1" BUILDDIR="../public/main" && make latexpdf && mkdir -p ../public/main/manual && cp _build/latex/manual.pdf ../public/main/manual/) || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1192    - cd .. && git clean -fdxq -e public -e venv-petsc-docs && cd doc && rm -rf images
1193    - (git checkout origin/release && pip install -r requirements.txt && make website-deploy SPHINXOPTS="-j 1"  BUILDDIR="../public/release" && make latexpdf && mkdir -p ../public/release/manual && cp _build/latex/manual.pdf ../public/release/manual/) || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1194    - rm -rf ../public/*/.doctrees
1195  only:
1196    variables:
1197      - $PETSC_CI_SCHEDULED == "yes"
1198  artifacts:
1199    paths:
1200      - public
1201    expire_in: 4 days
1202
1203#
1204#
1205# The following tests are experimental; more tests by users at other sites may be added below this.  Experimental test
1206# that fail produce a warning, but do not block execution of a pipeline.
1207#
1208
1209.test-experimental:
1210  extends: .test
1211  allow_failure: true
1212
1213