xref: /honee/.gitlab-ci.yml (revision d9f57b1caecb22430f948825520d36b222fbe191)
1# ----------------------------------------------------------------------------------------
2# HONEE GitLab CI
3# ----------------------------------------------------------------------------------------
4stages:
5  - test:stage-lint
6  - test:stage-full
7  - test:docs
8  - deploy
9
10workflow:
11  auto_cancel:
12    on_job_failure: all
13
14.test-basic:
15  interruptible: true
16  only:
17    refs:
18      - web
19      - merge_requests
20
21.test:
22  extends: .test-basic
23  only:
24    refs:
25      - web
26      - merge_requests
27      - main
28      - release
29  except:
30    variables:
31      # Skip if the No-Code label is attached to a merge request (i.e., documentation only)
32      - $CI_MERGE_REQUEST_LABELS =~ /(^|,)No-Code($|,)/
33
34.docs:
35  image: python:3.10
36  before_script:
37    - pip install -r doc/requirements.txt
38    - apt-get update
39    - apt-get install -y doxygen librsvg2-bin
40
41
42# ----------------------------------------------------------------------------------------
43# Test formatting
44# ----------------------------------------------------------------------------------------
45noether-format:
46  stage: test:stage-lint
47  extends: 
48    - .test-basic
49  tags:
50    - noether
51    - shell
52  script:
53    - rm -f .SUCCESS
54    - echo "-------------- make format ---------" && export CLANG_FORMAT=clang-format-15 && $CLANG_FORMAT --version
55    - make -j$NPROC_CPU format && git diff --color=always --exit-code
56    - touch .SUCCESS
57
58
59# ----------------------------------------------------------------------------------------
60# Test static analysis
61# ----------------------------------------------------------------------------------------
62noether-lint:
63  stage: test:stage-lint
64  extends: .test
65  tags:
66    - noether
67    - shell
68  script:
69    - rm -f .SUCCESS
70    # Environment
71    - export CC=gcc HIPCC=hipcc
72    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
73    - echo "-------------- CC ------------------" && $CC --version
74    - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
75    # Libraries
76    # -- libCEED
77    - echo "-------------- libCEED -------------"
78    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
79    # -- PETSc
80    - echo "-------------- PETSc ---------------"
81    - export PETSC_DIR=/projects/honee/petsc
82    - export PETSC_ARCH=arch-serial-hip && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
83    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
84    - export LD_LIBRARY_PATH=$PETSC_DIR/lib PATH="$PATH:$PETSC_DIR/bin" # cgnsdiff
85    # make with Werror, Wall, supress loop vectorization warnings
86    - echo "-------------- make Werror ---------"
87    - PEDANTIC=1 PEDANTICFLAGS="-Werror -Wall -Wno-pass-failed" make -j$NPROC_CPU
88    # Clang-tidy
89    - echo "-------------- clang-tidy ----------" && export CLANG_TIDY=clang-tidy-15 && $CLANG_TIDY --version
90    - PETSC_ARCH=arch-serial-hip make -j$NPROC_CPU tidy
91    # Report status
92    - touch .SUCCESS
93
94
95# ----------------------------------------------------------------------------------------
96# Test memory access assumptions
97# ----------------------------------------------------------------------------------------
98noether-memcheck:
99  stage: test:stage-lint
100  extends: .test
101  tags:
102    - noether
103    - shell
104  script:
105    - rm -f .SUCCESS
106    # Environment
107    # -- NOTE: Coverage disabled because it doesn't play nice with the ASAN options
108    - export CC=clang-15
109    - export NPROC_POOL=8
110    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
111    - echo "-------------- CC ------------------" && $CC --version
112    # Libraries
113    # -- libCEED
114    - echo "-------------- libCEED -------------"
115    - export CEED_DIR=/projects/honee/libCEED-cpu && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
116    # -- PETSc
117    - echo "-------------- PETSc ---------------"
118    - export PETSC_DIR=/projects/honee/petsc
119    - export PETSC_ARCH=arch-serial-cpu-clang && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
120    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
121    - export LD_LIBRARY_PATH=$PETSC_DIR/lib PATH="$PATH:$PETSC_DIR/bin" # cgnsdiff
122    # ASAN
123    - echo "-------------- ASAN ----------------"
124    - export ASAN=1 AFLAGS="-fsanitize=address -fsanitize=leak"
125    - echo $AFLAGS
126    # HONEE
127    - echo "-------------- HONEE ---------------" && make info
128    - make clean
129    - make -j$NPROC_CPU
130    # Test suite
131    - echo "-------------- HONEE tests ---------"
132    - 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
133    # -- Memcheck libCEED CPU backend, serial
134    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL)) CEED_BACKENDS="/cpu/self/memcheck" JUNIT_BATCH="cpu-serial-memcheck" junit search=navierstokes
135    # Report status
136    - touch .SUCCESS
137  artifacts:
138    paths:
139      - build/*.junit
140    reports:
141      junit: build/*.junit
142      performance: performance.json
143    expire_in: 28 days
144
145
146# ----------------------------------------------------------------------------------------
147# CPU testing on Noether
148# ----------------------------------------------------------------------------------------
149noether-cpu:
150  stage: test:stage-full
151  extends: .test
152  tags:
153    - noether
154    - shell
155  script:
156    - rm -f .SUCCESS
157    # Environment
158    - export COVERAGE=1 CC=gcc
159    - export NPROC_POOL=4
160    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
161    - echo "-------------- CC ------------------" && $CC --version
162    - echo "-------------- GCOV ----------------" && gcov --version
163    # Libraries
164    # -- libCEED
165    - echo "-------------- libCEED -------------"
166    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
167    # -- PETSc
168    - echo "-------------- PETSc ---------------"
169    - export PETSC_DIR=/projects/honee/petsc
170    - export PETSC_ARCH=arch-parallel-hip && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
171    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
172    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
173    # HONEE
174    - echo "-------------- HONEE ---------------" && make info
175    - make clean
176    - make -j$NPROC_CPU
177    # Test suite
178    - echo "-------------- HONEE tests ---------"
179    - 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
180    # -- Fastest libCEED CPU backend, parallel
181    - echo "Parallel tests skipped for now"
182    - source /home/phypid/spack/share/spack/setup-env.sh && spack load py-torch@2.3+cuda && export USE_TORCH=1
183    - export SMARTREDIS_DIR=/home/phypid/SmartSimTestingSoftware/smartredis/install
184    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial" junit search=navierstokes
185    - spack unload py-torch@2.3+cuda && export USE_TORCH=0
186    - source /home/phypid/SmartSimTestingSoftware/bin/activate
187    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial" junit search="test-smartsim"
188    # Report status
189    - touch .SUCCESS
190  after_script:
191    - |
192      if [ -f .SUCCESS ]; then
193        gcovr --xml-pretty --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-unreachable-branches --print-summary -o coverage.xml;
194      fi
195  coverage: '/^lines:\s+(\d+.\d\%)/'
196  artifacts:
197    paths:
198      - coverage.xml
199      - build/*.junit
200    reports:
201      coverage_report:
202        coverage_format: cobertura
203        path: coverage.xml
204      junit: build/*.junit
205      performance: performance.json
206    expire_in: 28 days
207
208
209# ----------------------------------------------------------------------------------------
210# CPU Int64 testing on Noether
211# ----------------------------------------------------------------------------------------
212noether-cpu-int64:
213  stage: test:stage-full
214  extends: .test
215  tags:
216    - noether
217    - shell
218  script:
219    - rm -f .SUCCESS
220    # Environment
221    - export COVERAGE=1 CC=gcc
222    - export NPROC_POOL=4
223    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
224    - echo "-------------- CC ------------------" && $CC --version
225    - echo "-------------- GCOV ----------------" && gcov --version
226    # Libraries
227    # -- libCEED
228    - echo "-------------- libCEED -------------"
229    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
230    # -- PETSc
231    - echo "-------------- PETSc ---------------"
232    - export PETSC_DIR=/projects/honee/petsc
233    - export PETSC_ARCH=arch-serial-cpu-int64 && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
234    - export PETSC_OPTIONS='-malloc_debug no' # faster tests
235    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
236    # HONEE
237    - echo "-------------- HONEE ---------------" && make info
238    - make clean
239    - make -j$NPROC_CPU
240    # Test suite
241    - echo "-------------- HONEE tests ---------"
242    - 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
243    # -- Fastest libCEED CPU backend, serial
244    - source /home/phypid/spack/share/spack/setup-env.sh && spack load py-torch@2.3+cuda && export USE_TORCH=1
245    - export SMARTREDIS_DIR=/home/phypid/SmartSimTestingSoftware/smartredis/install
246    - NPROC_TEST=1 make -k -j$((NPROC_CPU / NPROC_POOL / 1)) CEED_BACKENDS="/cpu/self" JUNIT_BATCH="cpu-serial-int64" junit search=navierstokes
247    - spack unload py-torch@2.3+cuda && export USE_TORCH=0
248    - source /home/phypid/SmartSimTestingSoftware/bin/activate
249    - 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"
250    # Report status
251    - touch .SUCCESS
252  after_script:
253    - |
254      if [ -f .SUCCESS ]; then
255        gcovr --xml-pretty --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-unreachable-branches --print-summary -o coverage.xml;
256      fi
257  coverage: '/^lines:\s+(\d+.\d\%)/'
258  artifacts:
259    paths:
260      - coverage.xml
261      - build/*.junit
262    reports:
263      coverage_report:
264        coverage_format: cobertura
265        path: coverage.xml
266      junit: build/*.junit
267      performance: performance.json
268    expire_in: 28 days
269
270
271#### Disable HIP temporarily
272
273# # ----------------------------------------------------------------------------------------
274# # GPU testing on Noether
275# # ----------------------------------------------------------------------------------------
276# noether-hip:
277#   stage: test:stage-full
278#   extends: .test
279#   tags:
280#     - noether
281#     - shell
282#   script:
283#     - rm -f .SUCCESS
284#     # Environment
285#     - export COVERAGE=1 CC=gcc HIPCC=hipcc
286#     - export NPROC_POOL=4
287#     - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
288#     - echo "-------------- CC ------------------" && $CC --version
289#     - echo "-------------- HIPCC ---------------" && $HIPCC --version && export HIP_DIR=/opt/rocm
290#     - echo "-------------- GCOV ----------------" && gcov --version
291#     # Libraries
292#     # -- libCEED
293#     - echo "-------------- libCEED -------------"
294#     - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
295#     # -- PETSc
296#     - echo "-------------- PETSc ---------------"
297#     - export PETSC_DIR=/projects/honee/petsc
298#     - export PETSC_ARCH=arch-parallel-hip && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
299#     - export PETSC_OPTIONS='-malloc_debug no' # faster tests
300#     - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
301#     # HONEE
302#     - echo "-------------- HONEE ---------------" && make info
303#     - make clean
304#     - make -j$NPROC_CPU
305#     # Test suite
306#     - echo "-------------- HONEE tests ---------"
307#     - 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
308#     # -- Fastest libCEED HIP backend, serial
309#     # Note: /shared is faster due to /gen JiT time for CeedOperators overwhelming runtime improvements at these problem sizes
310#     - NPROC_TEST=1 make -k -j$((NPROC_GPU / NPROC_POOL / 1)) CEED_BACKENDS="/gpu/hip/shared" JUNIT_BATCH="hip-serial" junit search=navierstokes
311#     # Report status
312#     - touch .SUCCESS
313#   after_script:
314#     - |
315#       if [ -f .SUCCESS ]; then
316#         gcovr --xml-pretty --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-unreachable-branches --print-summary -o coverage.xml;
317#       fi
318#   coverage: '/^lines:\s+(\d+.\d\%)/'
319#   artifacts:
320#     paths:
321#       - coverage.xml
322#       - build/*.junit
323#     reports:
324#       coverage_report:
325#         coverage_format: cobertura
326#         path: coverage.xml
327#       junit: build/*.junit
328#       performance: performance.json
329#     expire_in: 28 days
330
331
332noether-cuda:
333  stage: test:stage-full
334  extends: .test
335  tags:
336    - noether
337    - shell
338  script:
339    - rm -f .SUCCESS
340    # Environment
341    - export COVERAGE=1 CC=gcc NVCC=nvcc
342    - export NPROC_POOL=4
343    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
344    - echo "-------------- CC ------------------" && $CC --version
345    - echo "-------------- NVCC ----------------" && $NVCC --version
346    - echo "-------------- GCOV ----------------" && gcov --version
347    # Libraries
348    # -- libCEED
349    - echo "-------------- libCEED -------------"
350    - export CEED_DIR=/projects/honee/libCEED && git -C $CEED_DIR -c safe.directory=$CEED_DIR describe && make -C $CEED_DIR info
351    # -- PETSc
352    - echo "-------------- PETSc ---------------"
353    - export PETSC_DIR=/projects/honee/petsc
354    - export PETSC_ARCH=arch-parallel-cuda && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe && make -C $PETSC_DIR info
355    - export PETSC_OPTIONS='-malloc_debug no -use_gpu_aware_mpi 0' # faster tests
356    - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib PATH="$PATH:$PETSC_DIR/$PETSC_ARCH/bin" # cgnsdiff
357    # HONEE
358    - echo "-------------- HONEE ---------------" && make info
359    - make clean
360    - make -j$NPROC_CPU
361    # Test suite
362    - echo "-------------- HONEE tests ---------"
363    - 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
364    # -- Fastest libCEED CUDA backend, serial
365    # Note: /shared is faster due to /gen JiT time for CeedOperators overwhelming runtime improvements at these problem sizes
366    - source /home/phypid/spack/share/spack/setup-env.sh && spack load py-torch@2.3+cuda && export USE_TORCH=1
367    - NPROC_TEST=1 make -k -j$((NPROC_GPU / NPROC_POOL / 1)) CEED_BACKENDS="/gpu/cuda/shared" JUNIT_BATCH="cuda-serial" junit search=navierstokes
368    # Report status
369    - touch .SUCCESS
370  after_script:
371    - |
372      if [ -f .SUCCESS ]; then
373        gcovr --xml-pretty --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-unreachable-branches --print-summary -o coverage.xml;
374      fi
375  coverage: '/^lines:\s+(\d+.\d\%)/'
376  artifacts:
377    paths:
378      - coverage.xml
379      - build/*.junit
380    reports:
381      coverage_report:
382        coverage_format: cobertura
383        path: coverage.xml
384      junit: build/*.junit
385      performance: performance.json
386    expire_in: 28 days
387
388
389# ----------------------------------------------------------------------------------------
390# Build documentation
391# ----------------------------------------------------------------------------------------
392docs-review:
393  stage: test:docs
394  tags:
395    - noether
396    - docker
397  extends:
398    - .docs
399    - .test-basic
400  interruptible: true
401  script:
402    - export PETSC_DIR=/projects/honee/petsc PETSC_ARCH=arch-parallel-hip CEED_DIR=/projects/honee/libCEED
403    - git -c safe.directory=/builds/phypid/honee submodule update --init
404    - make doc-html pkgconf=true DOXYGENOPTS= SPHINXOPTS=-W
405    - mv doc/build/html public
406  artifacts:
407    paths:
408      - public
409    expire_in: 28 days
410  environment:
411    name: review/$CI_COMMIT_REF_NAME
412    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html
413
414
415# ----------------------------------------------------------------------------------------
416# Deploy documentation using GitLab pages
417# ----------------------------------------------------------------------------------------
418pages:  # this job name has special meaning to GitLab
419  stage: deploy
420  tags:
421    - noether
422    - docker
423  extends: .docs
424  interruptible: false
425  script:
426    - git -c safe.directory=/builds/phypid/honee submodule update --init
427    - make doc-dirhtml pkgconf=true DOXYGENOPTS=
428    - mv doc/build/dirhtml public
429  only:
430    - main
431  artifacts:
432    paths:
433      - public
434