xref: /honee/.gitlab-ci.yml (revision 02e7dc5c683ed2638684b2b258e5f0f564852bde)
1# ----------------------------------------------------------------------------------------
2# HONEE GitLab CI
3# ----------------------------------------------------------------------------------------
4stages:
5  - test:stage-lint
6  - test:stage-full
7  - test:docs
8  - deploy
9
10.test-basic:
11  interruptible: true
12  only:
13    refs:
14      - web
15      - merge_requests
16
17.test:
18  extends: .test-basic
19  only:
20    refs:
21      - web
22      - merge_requests
23      - main
24      - release
25  except:
26    variables:
27      # Skip if the No-Code label is attached to a merge request (i.e., documentation only)
28      - $CI_MERGE_REQUEST_LABELS =~ /(^|,)No-Code($|,)/
29  needs:
30    - job: docker-build
31      optional: true
32
33.docs:
34  image: python:3.10
35  before_script:
36    - pip install -r doc/requirements.txt
37    - apt-get update
38    - apt-get install -y doxygen librsvg2-bin
39
40
41# ----------------------------------------------------------------------------------------
42# Test formatting and static analysis
43# ----------------------------------------------------------------------------------------
44noether-lint:
45  stage: test:stage-lint
46  extends: .test
47  tags:
48    - noether
49    - shell
50  needs: []
51  script:
52    - rm -f .SUCCESS
53    # Environment
54    - export COVERAGE=1 CC=gcc HIPCC=hipcc
55    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
56    - echo "-------------- CC ------------------" && $CC --version
57    - echo "-------------- GCOV ----------------" && gcov --version
58    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
59    # Libraries
60    # -- libCEED
61    - echo "-------------- libCEED -------------"
62    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
63    # -- PETSc
64    - echo "-------------- PETSc ---------------"
65    - export PETSC_DIR=/projects/honee/petsc
66    - export PETSC_ARCH=arch-serial-gpu && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
67    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
68    - export LD_LIBRARY_PATH=$PETSC_DIR/lib PATH="$PATH:$PETSC_DIR/bin" # cgnsdiff
69    # make with Werror, Wall, supress loop vectorization warnings
70    - echo "-------------- make Werror ---------"
71    - PEDANTIC=1 PEDANTICFLAGS="-Werror -Wall -Wno-pass-failed" make -j$NPROC_CPU
72    # make format
73    - echo "-------------- make format ---------" && export CLANG_FORMAT=clang-format-15 && $CLANG_FORMAT --version
74    - make -j$NPROC_CPU format && git diff --color=always --exit-code
75    # Clang-tidy
76    - echo "-------------- clang-tidy ----------" && export CLANG_TIDY=clang-tidy-15 && $CLANG_TIDY --version
77    - PETSC_ARCH=arch-serial-gpu make -j$NPROC_CPU tidy
78    # Report status
79    - touch .SUCCESS
80
81
82# ----------------------------------------------------------------------------------------
83# Test memory access assumptions
84# ----------------------------------------------------------------------------------------
85noether-memcheck:
86  stage: test:stage-lint
87  extends: .test
88  tags:
89    - noether
90    - shell
91  needs: []
92  script:
93    - rm -f .SUCCESS
94    # Environment
95    # -- NOTE: Coverage disabled because it doesn't play nice with the ASAN options
96    - export CC=clang-15
97    - export NPROC_POOL=8
98    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
99    - echo "-------------- CC ------------------" && $CC --version
100    # Libraries
101    # -- libCEED
102    - echo "-------------- libCEED -------------"
103    - export CEED_DIR=/projects/honee/libCEED-cpu && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
104    # -- PETSc
105    - echo "-------------- PETSc ---------------"
106    - export PETSC_DIR=/projects/honee/petsc
107    - export PETSC_ARCH=arch-serial-cpu-clang && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
108    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
109    - export LD_LIBRARY_PATH=$PETSC_DIR/lib PATH="$PATH:$PETSC_DIR/bin" # cgnsdiff
110    # ASAN
111    - echo "-------------- ASAN ----------------"
112    - echo "ASAN intentionlly skipped, known leaks"
113    # - export ASAN=1 AFLAGS="-fsanitize=address -fsanitize=leak"
114    - echo $AFLAGS
115    # HONEE
116    - echo "-------------- HONEE ---------------" && make info
117    - make clean
118    - make -j$NPROC_CPU
119    # Test suite
120    - echo "-------------- HONEE tests ---------"
121    - echo '[{"subject":"/","metrics":[{"name":"Transfer Size (KB)","value":"19.5","desiredSize":"smaller"},{"name":"Speed Index","value":0,"desiredSize":"smaller"},{"name":"Total Score","value":92,"desiredSize":"larger"},{"name":"Requests","value":4,"desiredSize":"smaller"}]}]' > performance.json
122    # -- Memcheck libCEED CPU backend, serial
123    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL)) CEED_BACKENDS="/cpu/self/memcheck" JUNIT_BATCH="cpu-serial-memcheck" junit realsearch=%
124    # Report status
125    - touch .SUCCESS
126  artifacts:
127    paths:
128      - build/*.junit
129    reports:
130      junit: build/*.junit
131      performance: performance.json
132    expire_in: 28 days
133
134
135# ----------------------------------------------------------------------------------------
136# CPU testing on Noether
137# ----------------------------------------------------------------------------------------
138noether-cpu:
139  stage: test:stage-full
140  extends: .test
141  tags:
142    - noether
143    - shell
144  script:
145    - rm -f .SUCCESS
146    # Environment
147    - export COVERAGE=1 CC=gcc HIPCC=hipcc
148    - export NPROC_POOL=4
149    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
150    - echo "-------------- CC ------------------" && $CC --version
151    - echo "-------------- GCOV ----------------" && gcov --version
152    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
153    # Libraries
154    # -- libCEED
155    - echo "-------------- libCEED -------------"
156    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
157    # -- PETSc
158    - echo "-------------- PETSc ---------------"
159    - export PETSC_DIR=/projects/honee/petsc
160    - export PETSC_ARCH=arch-parallel-gpu && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
161    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
162    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
163    # HONEE
164    - echo "-------------- HONEE ---------------" && make info
165    - make clean
166    - make -j$NPROC_CPU
167    # Test suite
168    - echo "-------------- HONEE tests ---------"
169    - echo '[{"subject":"/","metrics":[{"name":"Transfer Size (KB)","value":"19.5","desiredSize":"smaller"},{"name":"Speed Index","value":0,"desiredSize":"smaller"},{"name":"Total Score","value":92,"desiredSize":"larger"},{"name":"Requests","value":4,"desiredSize":"smaller"}]}]' > performance.json
170    # -- Fastest libCEED CPU backend, parallel
171    # Note: /shared is faster due to /gen JiT time for CeedOperators overwhelming runtime improvements at these problem sizes
172    - echo "Parallel tests skipped for now"
173    # - NPROC_TEST=2 make -k -j$((NPROC_GPU / NPROC_POOL / 2)) CEED_BACKENDS="/gpu/hip/shared" JUNIT_BATCH="cpu-parallel" junit realsearch=%
174    # Report status
175    - touch .SUCCESS
176  after_script:
177    - |
178      if [ -f .SUCCESS ]; then
179        gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml;
180      fi
181  artifacts:
182    paths:
183      - coverage.xml
184      - build/*.junit
185    reports:
186      coverage_report:
187        coverage_format: cobertura
188        path: coverage.xml
189      junit: build/*.junit
190      performance: performance.json
191    expire_in: 28 days
192
193
194# ----------------------------------------------------------------------------------------
195# GPU testing on Noether
196# ----------------------------------------------------------------------------------------
197noether-gpu:
198  stage: test:stage-full
199  extends: .test
200  tags:
201    - noether
202    - shell
203  script:
204    - rm -f .SUCCESS
205    # Environment
206    - export COVERAGE=1 CC=gcc HIPCC=hipcc
207    - export NPROC_POOL=4
208    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
209    - echo "-------------- CC ------------------" && $CC --version
210    - echo "-------------- GCOV ----------------" && gcov --version
211    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
212    # Libraries
213    # -- libCEED
214    - echo "-------------- libCEED -------------"
215    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
216    # -- PETSc
217    - echo "-------------- PETSc ---------------"
218    - export PETSC_DIR=/projects/honee/petsc
219    - export PETSC_ARCH=arch-parallel-gpu && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
220    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
221    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
222    # HONEE
223    - echo "-------------- HONEE ---------------" && make info
224    - make clean
225    - make -j$NPROC_CPU
226    # Test suite
227    - echo "-------------- HONEE tests ---------"
228    - echo '[{"subject":"/","metrics":[{"name":"Transfer Size (KB)","value":"19.5","desiredSize":"smaller"},{"name":"Speed Index","value":0,"desiredSize":"smaller"},{"name":"Total Score","value":92,"desiredSize":"larger"},{"name":"Requests","value":4,"desiredSize":"smaller"}]}]' > performance.json
229    # -- Fastest libCEED HIP backend, serial
230    - NPROC_TEST=1 make -k -j$((NPROC_GPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="hip-serial" junit realsearch=%
231    # Report status
232    - touch .SUCCESS
233  after_script:
234    - |
235      if [ -f .SUCCESS ]; then
236        gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml;
237      fi
238  artifacts:
239    paths:
240      - coverage.xml
241      - build/*.junit
242    reports:
243      coverage_report:
244        coverage_format: cobertura
245        path: coverage.xml
246      junit: build/*.junit
247      performance: performance.json
248    expire_in: 28 days
249
250
251# ----------------------------------------------------------------------------------------
252# Build documentation
253# ----------------------------------------------------------------------------------------
254docs-review:
255  stage: test:docs
256  tags:
257    - noether
258    - docker
259  extends:
260    - .docs
261    - .test-basic
262  interruptible: true
263  script:
264    - export PETSC_DIR=/projects/honee/petsc PETSC_ARCH=arch-parallel-gpu CEED_DIR=/projects/honee/libCEED
265    - git submodule update --init
266    - make doc-html pkgconf=true DOXYGENOPTS= SPHINXOPTS=-W
267    - mv doc/build/html public
268  artifacts:
269    paths:
270      - public
271    expire_in: 28 days
272  environment:
273    name: review/$CI_COMMIT_REF_NAME
274    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html
275
276
277# ----------------------------------------------------------------------------------------
278# Deploy documentation using GitLab pages
279# ----------------------------------------------------------------------------------------
280pages:  # this job name has special meaning to GitLab
281  stage: deploy
282  tags:
283    - noether
284    - docker
285  extends: .docs
286  interruptible: false
287  script:
288    - git submodule update --init
289    - make doc-dirhtml pkgconf=true DOXYGENOPTS=
290    - mv doc/build/dirhtml public
291  only:
292    - main
293  artifacts:
294    paths:
295      - public
296