xref: /libCEED/.gitlab-ci.yml (revision ca94c3ddc8f82b7d93a79f9e4812e99b8be840ff)
1stages:
2  - test:cpu-and-tidy
3  - test:gpu-and-float
4
5noether-cpu:
6  stage: test:cpu-and-tidy
7  tags:
8    - cpu
9    - rocm
10  interruptible: true
11  before_script:
12# Environment
13    - export COVERAGE=1 CC=gcc CXX=g++ FC=gfortran HIPCC=hipcc
14    - export NPROC_POOL=8
15    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
16    - echo "-------------- CC ------------------" && $CC --version
17    - echo "-------------- CXX -----------------" && $CXX --version
18    - echo "-------------- FC ------------------" && $FC --version
19    - echo "-------------- HIPCC ---------------" && $HIPCC --version
20    - echo "-------------- GCOV ----------------" && gcov --version
21# Libraries for backends
22# -- LIBXSMM 2c145a109b5a8ad4e15f60ea42a86b9056bdc8b8
23    - cd .. && export XSMM_HASH=2c145a109b5a8ad4e15f60ea42a86b9056bdc8b8 && { [[ -d libxsmm-$XSMM_HASH ]] || { curl -L https://github.com/libxsmm/libxsmm/archive/$XSMM_HASH.tar.gz -o xsmm.tar.gz && tar zvxf xsmm.tar.gz && rm xsmm.tar.gz && make -C libxsmm-$XSMM_HASH -j$(nproc); }; } && export XSMM_DIR=$PWD/libxsmm-$XSMM_HASH && cd libCEED
24    - echo "-------------- LIBXSMM -------------" && basename $XSMM_DIR
25# -- OCCA v1.1.0
26    - cd .. && export OCCA_VERSION=occa-1.4.0 && { [[ -d $OCCA_VERSION ]] || { git clone --depth 1 --branch v1.4.0 https://github.com/libocca/occa.git $OCCA_VERSION && cd $OCCA_VERSION && export ENABLE_OPENCL="OFF" ENABLE_DPCPP="OFF" ENABLE_HIP="OFF" ENABLE_CUDA="OFF" && ./configure-cmake.sh && cmake --build build --parallel $NPROC_CPU && cmake --install build && cd ..; }; } && export OCCA_DIR=$PWD/$OCCA_VERSION/install && cd libCEED
27    - echo "-------------- OCCA ----------------" && git -C $OCCA_DIR describe --tags && LD_LIBRARY_PATH=$OCCA_DIR/lib $OCCA_DIR/bin/occa info
28  script:
29    - rm -f .SUCCESS
30# libCEED
31    - make configure OPT='-O -march=native -ffp-contract=fast'
32    - BACKENDS_CPU=$(make info-backends-all | grep -o '/cpu[^ ]*' | tr '\n' ' ')
33    - echo "-------------- libCEED -------------" && make info
34    - echo "-------------- BACKENDS_CPU --------" && echo $BACKENDS_CPU
35    - OCCA_DIR= PEDANTIC=1 make -j$NPROC_CPU
36    - make -j$NPROC_CPU
37# -- libCEED only tests
38    - echo "-------------- core tests ----------"
39    - 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
40#    Note: PETSC_DIR is set by default in GitLab runner env, unsetting to isolate core tests
41    - export PETSC_DIR= PETSC_ARCH=
42    - make -k -j$((NPROC_CPU / NPROC_POOL)) BACKENDS="$BACKENDS_CPU" JUNIT_BATCH="cpu" junit realsearch=%
43# Libraries for examples
44# -- PETSc with HIP (minimal)
45    - export PETSC_DIR=/projects/petsc PETSC_ARCH=mpich-hip && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe
46    - source /home/jawr8143/SmartSimTestingSoftware/bin/activate && export SMARTREDIS_DIR=/home/jawr8143/SmartSimTestingSoftware/smartredis/install
47    - echo "-------------- PETSc ---------------" && make -C $PETSC_DIR info
48    - make -k -j$((NPROC_CPU / NPROC_POOL)) BACKENDS="$BACKENDS_CPU" JUNIT_BATCH="cpu" junit search="petsc fluids solids"
49# -- MFEM v4.2
50    - cd .. && export MFEM_VERSION=mfem-4.2 && { [[ -d $MFEM_VERSION ]] || { git clone --depth 1 --branch v4.2 https://github.com/mfem/mfem.git $MFEM_VERSION && make -C $MFEM_VERSION -j$(nproc) serial CXXFLAGS="-O -std=c++11"; }; } && export MFEM_DIR=$PWD/$MFEM_VERSION && cd libCEED
51    - echo "-------------- MFEM ----------------" && make -C $MFEM_DIR info
52    - make -k -j$((NPROC_CPU / NPROC_POOL)) BACKENDS="$BACKENDS_CPU" JUNIT_BATCH="cpu" junit search=mfem
53# -- Nek5000 v19.0
54    - export COVERAGE=0
55    - cd .. && export NEK5K_VERSION=Nek5000-19.0 && { [[ -d $NEK5K_VERSION ]] || { git clone --depth 1 --branch v19.0 https://github.com/Nek5000/Nek5000.git $NEK5K_VERSION && cd $NEK5K_VERSION/tools && ./maketools genbox genmap reatore2 && cd ../..; }; } && export NEK5K_DIR=$PWD/$NEK5K_VERSION && export PATH=$NEK5K_DIR/bin:$PATH MPI=0 && cd libCEED
56    - echo "-------------- Nek5000 -------------" && git -C $NEK5K_DIR describe --tags
57    - export NPROC_POOL=1
58    - make -k -j$NPROC_CPU BACKENDS="$BACKENDS_CPU" JUNIT_BATCH="cpu" junit search=nek NEK5K_DIR=$NEK5K_DIR
59# Clang-tidy
60    - echo "-------------- clang-tidy ----------" && clang-tidy --version
61    - export OCCA_DIR= && make lib -j$NPROC_CPU
62    - make -j$NPROC_CPU tidy
63# Report status
64    - touch .SUCCESS
65  after_script:
66    - |
67      if [ -f .SUCCESS ]; then
68        lcov --directory . --capture --output-file coverage.info;
69        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F interface;
70        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F gallery;
71        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F backends;
72        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F tests;
73        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F examples;
74      fi
75  artifacts:
76    paths:
77      - build/*.junit
78    reports:
79      junit: build/*.junit
80      performance: performance.json
81
82noether-rocm:
83  stage: test:gpu-and-float
84  tags:
85    - rocm
86  interruptible: true
87  before_script:
88# Environment
89    - export COVERAGE=1 CC=gcc CXX=g++ FC=gfortran HIPCC=hipcc
90    - export NPROC_POOL=4
91    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
92    - echo "-------------- CC ------------------" && $CC --version
93    - echo "-------------- CXX -----------------" && $CXX --version
94    - echo "-------------- FC ------------------" && $FC --version
95    - echo "-------------- HIPCC ---------------" && $HIPCC --version
96    - echo "-------------- GCOV ----------------" && gcov --version
97# Libraries for backends
98# -- MAGMA from dev branch
99    - echo "-------------- MAGMA ---------------"
100    - export MAGMA_DIR=/projects/hipMAGMA && git -C $MAGMA_DIR -c safe.directory=$MAGMA_DIR describe
101  script:
102    - rm -f .SUCCESS
103# libCEED
104    - make configure ROCM_DIR=/opt/rocm-5.6.0 OPT='-O -march=native -ffp-contract=fast'
105    - BACKENDS_CPU=$(make info-backends-all | grep -o '/cpu[^ ]*' | tr '\n' ' ') && BACKENDS_GPU=$(make info-backends | grep -o '/gpu[^ ]*' | tr '\n' ' ')
106    - echo "-------------- libCEED -------------" && make info
107    - echo "-------------- BACKENDS_GPU --------" && echo $BACKENDS_GPU
108    - make -j$NPROC_CPU
109# -- libCEED only tests
110    - echo "-------------- core tests ----------"
111    - 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
112#    Note: PETSC_DIR is set by default in GitLab runner env, unsetting to isolate core tests
113    - export PETSC_DIR= PETSC_ARCH=
114    - make -k -j$((NPROC_GPU / NPROC_POOL)) BACKENDS="$BACKENDS_GPU" JUNIT_BATCH="hip" junit realsearch=%
115# Libraries for examples
116# -- PETSc with HIP (minimal)
117    - export PETSC_DIR=/projects/petsc PETSC_ARCH=mpich-hip && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe
118    - source /home/jawr8143/SmartSimTestingSoftware/bin/activate && export SMARTREDIS_DIR=/home/jawr8143/SmartSimTestingSoftware/smartredis/install
119    - echo "-------------- PETSc ---------------" && make -C $PETSC_DIR info
120    - make -k -j$((NPROC_GPU / NPROC_POOL)) BACKENDS="$BACKENDS_GPU" JUNIT_BATCH="hip" junit search="petsc fluids solids"
121# -- MFEM v4.2
122    - cd .. && export MFEM_VERSION=mfem-4.2 && { [[ -d $MFEM_VERSION ]] || { git clone --depth 1 --branch v4.2 https://github.com/mfem/mfem.git $MFEM_VERSION && make -C $MFEM_VERSION -j$(nproc) serial CXXFLAGS="-O -std=c++11"; }; } && export MFEM_DIR=$PWD/$MFEM_VERSION && cd libCEED
123    - echo "-------------- MFEM ----------------" && make -C $MFEM_DIR info
124    - make -k -j$((NPROC_GPU / NPROC_POOL)) BACKENDS="$BACKENDS_GPU" JUNIT_BATCH="hip" junit search=mfem
125# -- Nek5000 v19.0
126    - export COVERAGE=0
127    - cd .. && export NEK5K_VERSION=Nek5000-19.0 && { [[ -d $NEK5K_VERSION ]] || { git clone --depth 1 --branch v19.0 https://github.com/Nek5000/Nek5000.git $NEK5K_VERSION && cd $NEK5K_VERSION/tools && ./maketools genbox genmap reatore2 && cd ../..; }; } && export NEK5K_DIR=$PWD/$NEK5K_VERSION && export PATH=$NEK5K_DIR/bin:$PATH MPI=0 && cd libCEED
128    - echo "-------------- Nek5000 -------------" && git -C $NEK5K_DIR describe --tags
129    - export NPROC_POOL=1
130    - make -k -j$NPROC_GPU BACKENDS="$BACKENDS_GPU" JUNIT_BATCH="hip" junit search=nek NEK5K_DIR=$NEK5K_DIR
131# Clang-tidy
132    - echo "-------------- clang-tidy ----------" && clang-tidy --version
133    - TIDY_OPTS="-fix-errors" make -j$NPROC_CPU tidy && git diff --color=always --exit-code
134# Report status
135    - touch .SUCCESS
136  after_script:
137    - |
138      if [ -f .SUCCESS ]; then
139        lcov --directory . --capture --output-file coverage.info;
140        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F interface;
141        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F gallery;
142        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F backends;
143        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F tests;
144        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F examples;
145      fi
146  artifacts:
147    paths:
148      - build/*.junit
149    reports:
150      junit: build/*.junit
151      performance: performance.json
152
153noether-float:
154  stage: test:gpu-and-float
155  tags:
156    - cpu
157    - rocm
158  interruptible: true
159  before_script:
160# Environment
161    - export COVERAGE=1 CC=gcc CXX=g++ FC= HIPCC=hipcc
162    - export NPROC_POOL=8
163    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
164    - echo "-------------- CC ------------------" && $CC --version
165    - echo "-------------- CXX -----------------" && $CXX --version
166    - echo "-------------- HIPCC ---------------" && $HIPCC --version
167    - echo "-------------- GCOV ----------------" && gcov --version
168# Libraries for backends
169# -- MAGMA from dev branch
170    - echo "-------------- MAGMA ---------------"
171    - export MAGMA_DIR=/projects/hipMAGMA && git -C $MAGMA_DIR -c safe.directory=$MAGMA_DIR describe
172# -- LIBXSMM 2c145a109b5a8ad4e15f60ea42a86b9056bdc8b8
173    - cd .. && export XSMM_HASH=2c145a109b5a8ad4e15f60ea42a86b9056bdc8b8 && { [[ -d libxsmm-$XSMM_HASH ]] || { curl -L https://github.com/libxsmm/libxsmm/archive/$XSMM_HASH.tar.gz -o xsmm.tar.gz && tar zvxf xsmm.tar.gz && rm xsmm.tar.gz && make -C libxsmm-$XSMM_HASH -j$(nproc); }; } && export XSMM_DIR=$PWD/libxsmm-$XSMM_HASH && cd libCEED
174    - echo "-------------- LIBXSMM -------------" && basename $XSMM_DIR
175  script:
176    - rm -f .SUCCESS
177# libCEED
178# Change to single precision
179    - sed -i 's/ceed-f64/ceed-f32/1' include/ceed/types.h
180# Build libCEED
181    - make configure ROCM_DIR=/opt/rocm-5.6.0 OPT='-O -march=native -ffp-contract=fast'
182    - BACKENDS_CPU=$(make info-backends-all | grep -o '/cpu[^ ]*' | tr '\n' ' ') && BACKENDS_GPU=$(make info-backends | grep -o '/gpu[^ ]*' | tr '\n' ' ')
183    - echo "-------------- libCEED -------------" && make info
184    - echo "-------------- BACKENDS_CPU --------" && echo $BACKENDS_CPU
185    - echo "-------------- BACKENDS_GPU --------" && echo $BACKENDS_GPU
186    - make -j$NPROC_CPU
187# -- libCEED only tests
188    - echo "-------------- core tests ----------"
189    - 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
190#    Note: PETSC_DIR is set by default in GitLab runner env, unsetting to isolate core tests
191    - export PETSC_DIR= PETSC_ARCH=
192    - make -k -j$((NPROC_CPU / NPROC_POOL)) BACKENDS="$BACKENDS_CPU" JUNIT_BATCH="float-cpu" junit realsearch=%
193    - export NPROC_POOL=4
194    - make -k -j$((NPROC_GPU / NPROC_POOL)) BACKENDS="$BACKENDS_GPU" JUNIT_BATCH="float-hip" junit realsearch=%
195# Report status
196    - echo "SUCCESS" > .job_status
197  after_script:
198    - |
199      if [ $(cat .job_status) == "SUCCESS" ]; then
200        lcov --directory . --capture --output-file coverage.info;
201        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F interface;
202        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F gallery;
203        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F backends;
204        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F tests;
205        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F examples;
206      fi
207    - sed -i 's/ceed-f32/ceed-f64/1' include/ceed/types.h
208  artifacts:
209    paths:
210      - build/*.junit
211    reports:
212      junit: build/*.junit
213      performance: performance.json
214
215noether-cuda:
216  stage: test:gpu-and-float
217  tags:
218    - cuda
219  interruptible: true
220  before_script:
221# Environment
222    - export COVERAGE=1 CC=gcc CXX=g++ FC=gfortran NVCC=nvcc
223    - export NPROC_POOL=4
224    - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
225    - echo "-------------- CC ------------------" && $CC --version
226    - echo "-------------- CXX -----------------" && $CXX --version
227    - echo "-------------- FC ------------------" && $FC --version
228    - echo "-------------- NVCC ----------------" && $NVCC --version
229    - echo "-------------- GCOV ----------------" && gcov --version
230  script:
231    - rm -f .SUCCESS
232# libCEED
233    - make configure OPT='-O -march=native -ffp-contract=fast' CUDA_DIR=/usr
234    - echo "-------------- libCEED -------------" && make info
235    - BACKENDS_GPU=$(make info-backends | grep -o '/gpu[^ ]*' | tr '\n' ' ')
236    - echo "-------------- BACKENDS_GPU --------" && echo $BACKENDS_GPU
237    - PEDANTIC=1 make -k -j$NPROC_CPU -l$NPROC_CPU
238# -- libCEED only tests
239    - echo "-------------- core tests ----------"
240#    Note: PETSC_DIR is set by default in GitLab runner env, unsetting to isolate core tests
241    - export PETSC_DIR= PETSC_ARCH=
242    - make -k -j$((NPROC_GPU / NPROC_POOL)) BACKENDS="$BACKENDS_GPU" JUNIT_BATCH="cuda" junit realsearch=%
243# Libraries for examples
244# -- PETSc with CUDA (minimal)
245    - export PETSC_DIR=/projects/petsc PETSC_ARCH=mpich-cuda-O PETSC_OPTIONS='-use_gpu_aware_mpi 0' && git -C $PETSC_DIR -c safe.directory=$PETSC_DIR describe
246    - source /home/jawr8143/SmartSimTestingSoftware/bin/activate && export SMARTREDIS_DIR=/home/jawr8143/SmartSimTestingSoftware/smartredis/install
247    - echo "-------------- PETSc ---------------" && make -C $PETSC_DIR info
248    - make -k -j$((NPROC_GPU / NPROC_POOL)) JUNIT_BATCH="cuda" junit BACKENDS="$BACKENDS_GPU" search="petsc fluids solids"
249# Report status
250    - touch .SUCCESS
251  after_script:
252    - |
253      if [ -f .SUCCESS ]; then
254        lcov --directory . --capture --output-file coverage.info;
255        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F interface;
256        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F gallery;
257        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F backends;
258        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F tests;
259        bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F examples;
260      fi
261  artifacts:
262    paths:
263      - build/*.junit
264    reports:
265      junit: build/*.junit
266