-
Notifications
You must be signed in to change notification settings - Fork 82
366 lines (364 loc) · 13.6 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
name: AMR-Wind-CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
Formatting:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Check formatting
uses: DoozyX/[email protected]
with:
source: './amr-wind ./unit_tests ./tools/utilities'
exclude: '.'
extensions: 'H,h,cpp'
clangFormatVersion: 14
CPU:
needs: Formatting
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [RelWithDebInfo, Debug]
include:
- os: macos-latest
install_deps: brew install mpich ninja
comp: llvm
procs: $(sysctl -n hw.ncpu)
- os: ubuntu-latest
install_deps: sudo apt-get install -y --no-install-recommends mpich libmpich-dev ninja-build
comp: gnu
procs: $(nproc)
- build_type: RelWithDebInfo
ctest_args: -LE no_ci
- build_type: Debug
ctest_args: -L unit
exclude:
- os: macos-latest
build_type: Debug
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Dependencies
run: ${{matrix.install_deps}}
- name: Setup
run: |
echo "NUM_PROCS=${{matrix.procs}}" >> $GITHUB_ENV
- name: Configure
run: |
cmake -G Ninja \
-B ${{runner.workspace}}/build-ci-${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${{matrix.build_type}} \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
-DAMR_WIND_ENABLE_MPI:BOOL=ON \
-DAMR_WIND_ENABLE_TESTS:BOOL=ON \
-DAMR_WIND_TEST_WITH_FCOMPARE:BOOL=OFF \
${{github.workspace}}
- name: Build
working-directory: ${{runner.workspace}}/build-ci-${{matrix.build_type}}
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
cmake --build . -- -j ${{env.NUM_PROCS}} 2>&1 | tee -a build-output.txt
- name: Report
working-directory: ${{runner.workspace}}/build-ci-${{matrix.build_type}}
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
egrep "warning:|error:" build-output.txt | egrep -v "submods" | sort | uniq | \
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > build-output-warnings.txt
cat build-output-warnings.txt
exit $(tail -n 1 build-output-warnings.txt | awk '{print $2}')
- name: Test
working-directory: ${{runner.workspace}}/build-ci-${{matrix.build_type}}
run: |
ctest ${{matrix.ctest_args}} --output-on-failure
GPU-Nvidia:
name: GPU-CUDA
needs: Formatting
runs-on: ubuntu-20.04
strategy:
matrix:
cuda_ver: [11.4]
include:
- cuda_ver: "11.4"
cuda_pkg: 11-4
cuda_extra: libcurand-dev-11-4 cuda-cupti-dev-11-4
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Prepare CUDA environment
run: |
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build \
cuda-command-line-tools-${{matrix.cuda_pkg}} cuda-compiler-${{matrix.cuda_pkg}} cuda-minimal-build-${{matrix.cuda_pkg}} cuda-nvml-dev-${{matrix.cuda_pkg}} cuda-nvtx-${{matrix.cuda_pkg}} ${{matrix.cuda_extra}}
- name: Configure and build
run: |
export PATH=/usr/local/nvidia/bin:/usr/local/cuda-${{matrix.cuda_ver}}/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda-${{matrix.cuda_ver}}/lib:${LD_LIBRARY_PATH}
cmake -G Ninja -B build-${{matrix.cuda_pkg}} \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_CUDA:BOOL=ON \
-DAMReX_CUDA_ERROR_CAPTURE_THIS:BOOL=ON \
-DCMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION:BOOL=ON \
-DCMAKE_CUDA_ARCHITECTURES=70 \
${{github.workspace}}
cmake --build build-${{matrix.cuda_pkg}} -- -j $(nproc)
GPU-AMD:
name: GPU-HIP
needs: Formatting
runs-on: ubuntu-20.04
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Prepare HIP environment
run: |
wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list
echo 'export PATH=/opt/rocm/llvm/bin:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin:$PATH' | sudo tee -a /etc/profile.d/rocm.sh
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build \
build-essential rocm-dev roctracer-dev rocprofiler-dev rocrand-dev rocprim-dev rocm-libs
- name: Configure and build
run: |
source /etc/profile.d/rocm.sh
which clang
which clang++
cmake -G Ninja -B build \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_ROCM:BOOL=ON \
-DCMAKE_CXX_COMPILER:STRING=$(which clang++) \
-DCMAKE_C_COMPILER:STRING=$(which clang) \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DAMReX_AMD_ARCH:STRING=gfx908 \
-DCMAKE_HIP_ARCHITECTURES:STRING=gfx908 \
-DAMDGPU_TARGETS:STRING=gfx908 \
-DGPU_TARGETS:STRING=gfx908 \
${{github.workspace}}
cmake --build build -- -j $(nproc)
GPU-Intel:
name: GPU-SYCL
needs: Formatting
runs-on: ubuntu-20.04
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Prepare SyCL environment
run: |
export DEBIAN_FRONTEND=noninteractive
sudo wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mkl-devel
- name: Configure and build
run: |
set +e
source /opt/intel/oneapi/setvars.sh
set -e
cmake -G Ninja -B build-SYCL \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_CXX_COMPILER:STRING=$(which icpx) \
-DCMAKE_C_COMPILER:STRING=$(which icx) \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_SYCL:BOOL=ON \
${{github.workspace}}
cmake --build build-SYCL -- -j $(nproc)
Lint-cppcheck:
needs: Formatting
runs-on: macos-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Dependencies
run: brew install cppcheck
- name: Configure
run: |
echo "NPROCS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
cmake \
-B ${{runner.workspace}}/build-cppcheck \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_TESTS:BOOL=ON \
-DAMR_WIND_TEST_WITH_FCOMPARE:BOOL=OFF \
-DAMR_WIND_ENABLE_MASA:BOOL=OFF \
-DAMR_WIND_ENABLE_CPPCHECK:BOOL=ON \
${{github.workspace}}
- name: Check
working-directory: ${{runner.workspace}}/build-cppcheck
run: make cppcheck-ci
- name: Full report
working-directory: ${{runner.workspace}}/build-cppcheck
run: cat cppcheck/cppcheck-full-report.txt
- name: Short report
working-directory: ${{runner.workspace}}/build-cppcheck
run: |
echo "::add-matcher::.github/problem-matchers/cppcheck.json"
cat cppcheck-ci-report.txt
exit $(tail -n 1 cppcheck-ci-report.txt | awk '{print $2}')
Lint-clang-tidy:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Dependencies
run: |
sudo apt-get install -y ninja-build
- name: Configure
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
cmake -G Ninja \
-B ${{runner.workspace}}/build-clang-tidy \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER:STRING=clang++ \
-DCMAKE_C_COMPILER:STRING=clang \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_TESTS:BOOL=ON \
-DAMR_WIND_TEST_WITH_FCOMPARE:BOOL=OFF \
-DAMR_WIND_ENABLE_MASA:BOOL=OFF \
-DAMR_WIND_ENABLE_ALL_WARNINGS:BOOL=ON \
-DAMR_WIND_ENABLE_CLANG_TIDY:BOOL=ON \
${{github.workspace}}
- name: Check
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
cmake --build . --parallel ${{env.NPROCS}} 2>&1 | tee -a clang-tidy-full-report.txt
cat clang-tidy-full-report.txt | grep "warning:" | grep -v "submods" | sort | uniq | \
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > clang-tidy-ci-report.txt
- name: Full report
working-directory: ${{runner.workspace}}/build-clang-tidy
run: cat clang-tidy-full-report.txt
- name: Short report
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
cat clang-tidy-ci-report.txt
exit $(tail -n 1 clang-tidy-ci-report.txt | awk '{print $2}')
Lint-codeql:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
queries: +security-and-quality
config-file: ./.github/codeql/codeql-config.yml
- name: Configure
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
cmake -G Ninja \
-B ${{runner.workspace}}/build-ci-codeql \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-codeql \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER:STRING=clang++ \
-DCMAKE_C_COMPILER:STRING=clang \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_TESTS:BOOL=ON \
-DAMR_WIND_TEST_WITH_FCOMPARE:BOOL=OFF \
-DAMR_WIND_ENABLE_MASA:BOOL=OFF \
${{github.workspace}}
- name: Build
working-directory: ${{runner.workspace}}/build-ci-codeql
run: |
cmake --build . --parallel ${{env.NPROCS}}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"
upload: False
output: sarif-results
- name: Filter CodeQL sarif
uses: advanced-security/filter-sarif@v1
with:
patterns: |
-**/submods/**
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif
- name: Upload CodeQL sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: sarif-results/cpp.sarif
Docker:
needs: Formatting
runs-on: ubuntu-latest
container:
image: ecpe4s/exawind-snapshot
env:
SPACK_MANAGER: /spack-manager
E4S_MACHINE: true
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- name: Clone
uses: actions/checkout@v3
with:
submodules: true
- name: Test
working-directory: /spack-manager/environments/exawind
run: |
/bin/bash -c " \
source ${SPACK_MANAGER}/start.sh && \
ln -s ${GITHUB_WORKSPACE} amr-wind && \
source ${SPACK_MANAGER}/start.sh && \
quick-develop -s amr-wind+ascent+hdf5+hypre+masa+netcdf~shared@main && \
spack install && \
spack cd -b amr-wind && \
spack build-env amr-wind ctest -j $(nproc) -L unit --output-on-failure \
"