xref: /honee/.gitlab-ci.yml (revision 2ef79a07d4301bcb89e5a4efb242a799631c545c)
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  coverage: '/^lines:\s+(\d+.\d\%)/'
182  artifacts:
183    paths:
184      - coverage.xml
185      - build/*.junit
186    reports:
187      coverage_report:
188        coverage_format: cobertura
189        path: coverage.xml
190      junit: build/*.junit
191      performance: performance.json
192    expire_in: 28 days
193
194
195# ----------------------------------------------------------------------------------------
196# GPU testing on Noether
197# ----------------------------------------------------------------------------------------
198noether-gpu:
199  stage: test:stage-full
200  extends: .test
201  tags:
202    - noether
203    - shell
204  script:
205    - rm -f .SUCCESS
206    # Environment
207    - export COVERAGE=1 CC=gcc HIPCC=hipcc
208    - export NPROC_POOL=4
209    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
210    - echo "-------------- CC ------------------" && $CC --version
211    - echo "-------------- GCOV ----------------" && gcov --version
212    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
213    # Libraries
214    # -- libCEED
215    - echo "-------------- libCEED -------------"
216    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
217    # -- PETSc
218    - echo "-------------- PETSc ---------------"
219    - export PETSC_DIR=/projects/honee/petsc
220    - export PETSC_ARCH=arch-parallel-gpu && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
221    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
222    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
223    # HONEE
224    - echo "-------------- HONEE ---------------" && make info
225    - make clean
226    - make -j$NPROC_CPU
227    # Test suite
228    - echo "-------------- HONEE tests ---------"
229    - 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
230    # -- Fastest libCEED HIP backend, serial
231    - NPROC_TEST=1 make -k -j$((NPROC_GPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="hip-serial" junit realsearch=%
232    # Report status
233    - touch .SUCCESS
234  after_script:
235    - |
236      if [ -f .SUCCESS ]; then
237        gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml;
238      fi
239  coverage: '/^lines:\s+(\d+.\d\%)/'
240  artifacts:
241    paths:
242      - coverage.xml
243      - build/*.junit
244    reports:
245      coverage_report:
246        coverage_format: cobertura
247        path: coverage.xml
248      junit: build/*.junit
249      performance: performance.json
250    expire_in: 28 days
251
252
253# ----------------------------------------------------------------------------------------
254# Build documentation
255# ----------------------------------------------------------------------------------------
256docs-review:
257  stage: test:docs
258  tags:
259    - noether
260    - docker
261  extends:
262    - .docs
263    - .test-basic
264  interruptible: true
265  script:
266    - export PETSC_DIR=/projects/honee/petsc PETSC_ARCH=arch-parallel-gpu CEED_DIR=/projects/honee/libCEED
267    - git submodule update --init
268    - make doc-html pkgconf=true DOXYGENOPTS= SPHINXOPTS=-W
269    - mv doc/build/html public
270  artifacts:
271    paths:
272      - public
273    expire_in: 28 days
274  environment:
275    name: review/$CI_COMMIT_REF_NAME
276    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html
277
278
279# ----------------------------------------------------------------------------------------
280# Deploy documentation using GitLab pages
281# ----------------------------------------------------------------------------------------
282pages:  # this job name has special meaning to GitLab
283  stage: deploy
284  tags:
285    - noether
286    - docker
287  extends: .docs
288  interruptible: false
289  script:
290    - git submodule update --init
291    - make doc-dirhtml pkgconf=true DOXYGENOPTS=
292    - mv doc/build/dirhtml public
293  only:
294    - main
295  artifacts:
296    paths:
297      - public
298