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