xref: /honee/.gitlab-ci.yml (revision f421185ef9516632ea3c025af34ccd8ea857c48b)
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-hip && 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-hip 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 search=navierstokes
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-hip && 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    - echo "Parallel tests skipped for now"
172    - source /home/phypid/spack/share/spack/setup-env.sh && spack load py-torch@2.3+cuda && export USE_TORCH=1
173    - export SMARTREDIS_DIR=/home/phypid/SmartSimTestingSoftware/smartredis/install
174    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial" junit search=navierstokes
175    - spack unload py-torch@2.3+cuda && export USE_TORCH=0
176    - source /home/phypid/SmartSimTestingSoftware/bin/activate
177    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial" junit search="test-smartsim"
178    # Report status
179    - touch .SUCCESS
180  after_script:
181    - |
182      if [ -f .SUCCESS ]; then
183        gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml;
184      fi
185  coverage: '/^lines:\s+(\d+.\d\%)/'
186  artifacts:
187    paths:
188      - coverage.xml
189      - build/*.junit
190    reports:
191      coverage_report:
192        coverage_format: cobertura
193        path: coverage.xml
194      junit: build/*.junit
195      performance: performance.json
196    expire_in: 28 days
197
198
199# ----------------------------------------------------------------------------------------
200# CPU Int64 testing on Noether
201# ----------------------------------------------------------------------------------------
202noether-cpu-int64:
203  stage: test:stage-full
204  extends: .test
205  tags:
206    - noether
207    - shell
208  script:
209    - rm -f .SUCCESS
210    # Environment
211    - export COVERAGE=1 CC=gcc HIPCC=hipcc
212    - export NPROC_POOL=4
213    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
214    - echo "-------------- CC ------------------" && $CC --version
215    - echo "-------------- GCOV ----------------" && gcov --version
216    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
217    # Libraries
218    # -- libCEED
219    - echo "-------------- libCEED -------------"
220    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
221    # -- PETSc
222    - echo "-------------- PETSc ---------------"
223    - export PETSC_DIR=/projects/honee/petsc
224    - export PETSC_ARCH=arch-serial-cpu-int64 && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
225    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
226    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
227    # HONEE
228    - echo "-------------- HONEE ---------------" && make info
229    - make clean
230    - make -j$NPROC_CPU
231    # Test suite
232    - echo "-------------- HONEE tests ---------"
233    - 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
234    # -- Fastest libCEED CPU backend, serial
235    - source /home/phypid/spack/share/spack/setup-env.sh && spack load py-torch@2.3+cuda && export USE_TORCH=1
236    - export SMARTREDIS_DIR=/home/phypid/SmartSimTestingSoftware/smartredis/install
237    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial-int64" junit search=navierstokes
238    - spack unload py-torch@2.3+cuda && export USE_TORCH=0
239    - source /home/phypid/SmartSimTestingSoftware/bin/activate
240    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial" junit search="test-py-smartsim_regression_framework"
241    # Report status
242    - touch .SUCCESS
243  after_script:
244    - |
245      if [ -f .SUCCESS ]; then
246        gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml;
247      fi
248  coverage: '/^lines:\s+(\d+.\d\%)/'
249  artifacts:
250    paths:
251      - coverage.xml
252      - build/*.junit
253    reports:
254      coverage_report:
255        coverage_format: cobertura
256        path: coverage.xml
257      junit: build/*.junit
258      performance: performance.json
259    expire_in: 28 days
260
261
262# ----------------------------------------------------------------------------------------
263# GPU testing on Noether
264# ----------------------------------------------------------------------------------------
265noether-hip:
266  stage: test:stage-full
267  extends: .test
268  tags:
269    - noether
270    - shell
271  script:
272    - rm -f .SUCCESS
273    # Environment
274    - export COVERAGE=1 CC=gcc HIPCC=hipcc
275    - export NPROC_POOL=4
276    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
277    - echo "-------------- CC ------------------" && $CC --version
278    - echo "-------------- GCOV ----------------" && gcov --version
279    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
280    # Libraries
281    # -- libCEED
282    - echo "-------------- libCEED -------------"
283    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
284    # -- PETSc
285    - echo "-------------- PETSc ---------------"
286    - export PETSC_DIR=/projects/honee/petsc
287    - export PETSC_ARCH=arch-parallel-hip && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
288    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
289    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
290    # HONEE
291    - echo "-------------- HONEE ---------------" && make info
292    - make clean
293    - make -j$NPROC_CPU
294    # Test suite
295    - echo "-------------- HONEE tests ---------"
296    - 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
297    # -- Fastest libCEED HIP backend, serial
298    # Note: /shared is faster due to /gen JiT time for CeedOperators overwhelming runtime improvements at these problem sizes
299    - NPROC_TEST=1 make -k -j$((NPROC_GPU / NPROC_POOL / 1)) CEED_BACKENDS="/gpu/hip/shared" JUNIT_BATCH="hip-serial" junit search=navierstokes
300    # Report status
301    - touch .SUCCESS
302  after_script:
303    - |
304      if [ -f .SUCCESS ]; then
305        gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml;
306      fi
307  coverage: '/^lines:\s+(\d+.\d\%)/'
308  artifacts:
309    paths:
310      - coverage.xml
311      - build/*.junit
312    reports:
313      coverage_report:
314        coverage_format: cobertura
315        path: coverage.xml
316      junit: build/*.junit
317      performance: performance.json
318    expire_in: 28 days
319
320
321# ----------------------------------------------------------------------------------------
322# Build documentation
323# ----------------------------------------------------------------------------------------
324docs-review:
325  stage: test:docs
326  tags:
327    - noether
328    - docker
329  extends:
330    - .docs
331    - .test-basic
332  interruptible: true
333  script:
334    - export PETSC_DIR=/projects/honee/petsc PETSC_ARCH=arch-parallel-hip CEED_DIR=/projects/honee/libCEED
335    - git submodule update --init
336    - make doc-html pkgconf=true DOXYGENOPTS= SPHINXOPTS=-W
337    - mv doc/build/html public
338  artifacts:
339    paths:
340      - public
341    expire_in: 28 days
342  environment:
343    name: review/$CI_COMMIT_REF_NAME
344    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html
345
346
347# ----------------------------------------------------------------------------------------
348# Deploy documentation using GitLab pages
349# ----------------------------------------------------------------------------------------
350pages:  # this job name has special meaning to GitLab
351  stage: deploy
352  tags:
353    - noether
354    - docker
355  extends: .docs
356  interruptible: false
357  script:
358    - git submodule update --init
359    - make doc-dirhtml pkgconf=true DOXYGENOPTS=
360    - mv doc/build/dirhtml public
361  only:
362    - main
363  artifacts:
364    paths:
365      - public
366