-
Notifications
You must be signed in to change notification settings - Fork 8
314 lines (259 loc) · 11.5 KB
/
ci-checks.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
---
name: Compile and lint
on:
push:
branches-ignore:
- classic*
workflow_dispatch:
# pull_request:
# branches-ignore:
# - classic*
jobs:
cppcheck:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
brew update
brew install gsl openmpi cppcheck || true
cp artisoptions_nltenebular.h artisoptions.h
- name: run cppcheck and check for errors
run: |
cppcheck --version
cppcheck --force --error-exitcode=1 --language=c++ --std=c++20 --enable=warning,performance,portability --suppress=memleak --check-level=exhaustive .
- name: show cppcheck style suggestions
run: |
cppcheck --version
cppcheck --force --language=c++ --std=c++20 --enable=style --suppress=knownConditionTrueFalse --check-level=exhaustive .
clang-format:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check
uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: '18'
check-path: .
clang-tidy:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest-stable'
- name: install dependencies
run: |
brew update
brew install openmpi gsl || true
- name: install llvm
run: |
brew install llvm || true
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=/opt/homebrew/opt/lib" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/lib" >> $GITHUB_ENV
echo "CPATH=/opt/homebrew/opt/include" >> $GITHUB_ENV
echo "compiledb" > requirements.txt
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: '3.12'
- name: Generate compile_commands.json
run: |
python3 -m pip install compiledb
cp artisoptions_nltenebular.h artisoptions.h
make version.h
python3 -m compiledb -n --full-path make
- name: cat compile_commands.json
run: cat compile_commands.json
- name: run-clang-tidy
run: |
clang-tidy --version
run-clang-tidy
compile:
env:
CXX: g++
strategy:
matrix:
compiler:
[
{name: gcc, ver: 11},
{name: gcc, ver: 12},
{name: gcc, ver: 13},
{name: gcc, ver: 14},
{name: nvc++, ver: '24.7'},
]
mpi: [ON, OFF]
fail-fast: false
runs-on: ubuntu-24.04
name: ${{ matrix.compiler.name }} ${{ matrix.compiler.ver }}${{ matrix.mpi == 'ON' && ' MPI' || ''}}
steps:
- uses: actions/checkout@v4
- name: CPU type and core count
id: cpu-count
run: |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3
#python3 -m pip install psutil
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")'
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")'
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT
- name: Install gcc
if: matrix.compiler.name == 'gcc'
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: ${{ matrix.compiler.ver }}
- name: Install nvc++
if: matrix.compiler.name == 'nvc++'
uses: fortran-lang/setup-fortran@v1
with:
compiler: nvidia-hpc
version: ${{ matrix.compiler.ver }}
# - name: Install CUDA Toolkit
# uses: Jimver/cuda-toolkit@master
# if: matrix.compiler.name == 'nvc++'
# with:
# log-file-suffix: '${{matrix.compiler.ver}}.txt'
# method: 'network'
# sub-packages: '"nvcc", "cudart"'
- name: Set nvc++ as compiler
if: matrix.compiler.name == 'nvc++'
run: |
echo "CXX=nvc++" >> $GITHUB_ENV
echo "OMPI_CXX=nvc++" >> $GITHUB_ENV
- name: install gsl
run: |
sudo apt install libgsl-dev
- name: install tbb
if: matrix.compiler.name == 'gcc'
run: |
sudo apt install libtbb-dev
- name: install openmpi
if: matrix.mpi == 'ON'
run: |
sudo apt install -y openmpi-bin libopenmpi-dev
- name: install OpenMP
run: |
sudo apt-get install -y libomp5 libomp-dev
- name: Compile classic mode
run: |
$CXX -v
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile classic mode OPENMP=ON
run: |
make clean
make MPI=${{matrix.mpi}} OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile classic mode STDPAR=ON
run: |
$CXX -v
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile classic mode STDPAR=ON GPU=ON
if: matrix.compiler.name == 'nvc++'
run: |
$CXX -v
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} STDPAR=ON GPU=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile nebular mode
run: |
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile nebular mode OPENMP=ON
run: |
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile nebular mode STDPAR=ON
if: matrix.compiler.name != 'nvc++'
run: |
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile nebular mode STDPAR=ON GPU=ON
if: matrix.compiler.name == 'nvc++'
run: |
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} STDPAR=ON GPU=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
mac-llvm:
runs-on: macos-14
env:
CXX: clang++
strategy:
matrix:
mpi: [ON, OFF]
openmp: [ON, OFF]
fail-fast: false
name: macOS llvm clang ${{ matrix.mpi == 'ON' && ' MPI' || ''}}${{ matrix.openmp == 'ON' && ' OpenMP' || ''}}
steps:
- uses: actions/checkout@v4
- name: CPU core count
id: cpu-count
run: |
#python3 -m pip install psutil
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")'
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")'
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest-stable'
- name: install dependencies
run: |
brew update
brew install gsl || true
- name: install llvm
run: |
brew install llvm || true
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ $LDFLAGS" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: install OpenMP
if: matrix.openmp == 'ON'
run: |
brew install libomp || true
brew link --force libomp
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib $LDFLAGS" >> $GITHUB_ENV
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include $CXXFLAGS" >> $GITHUB_ENV
- name: install OpenMPI
if: matrix.mpi == 'ON'
run: |
brew install openmpi || true
- name: install onedpl and tbb
run: |
brew install onedpl tbb
echo "LIBRARY_PATH=$HOMEBREW_PREFIX/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOMEBREW_PREFIX/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "CPATH=$HOMEBREW_PREFIX/include:$CPATH" >> $GITHUB_ENV
- name: Compile classic mode
run: |
$CXX -v
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} OPENMP=${{matrix.openmp}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile classic mode STDPAR=ON
if: matrix.openmp != 'ON'
run: |
$CXX -v
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile nebular mode
run: |
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} OPENMP=${{matrix.openmp}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec
- name: Compile nebular mode STDPAR=ON
if: matrix.openmp != 'ON'
run: |
cp -v -p artisoptions_classic.h artisoptions.h
make clean
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec