-
Notifications
You must be signed in to change notification settings - Fork 3
executable file
·473 lines (445 loc) · 15.3 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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
name: CI
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 1 * *'
jobs:
Linux:
name: Mlucas Linux
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
cc: [gcc, clang]
fail-fast: false
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update -y
sudo apt-get install -y libhwloc-dev
- name: Before script
run: |
$CC --version
$CC -dM -E -march=native - </dev/null
- name: Script
run: |
set -x
set -o pipefail
lscpu
cat /proc/cpuinfo
for mode in '' NOSIMD SSE2 AVX AVX2 AVX512; do
echo -e "\n$mode\n"
bash -e -o pipefail -- makemake.sh use_hwloc $mode
(cd obj${mode:+_$mode}; make clean)
for word in '' 1word 2word 3word 4word nword; do
echo -e "\nMfactor $word\n"
bash -e -o pipefail -- makemake.sh mfac $word $mode || true
(
cd obj_mfac${mode:+_$mode}
make clean
mv -v build.log build_${word}.log
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h
)
done
done
cd obj
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
for s in tt t s m l; do time ./Mlucas -s $s -cpu "0:$(( $(nproc --all) - 1 ))" |& tee -a test.log; done
bash -- ../config-fermat.sh -cpu "0:$(( $(nproc --all) - 1 ))"
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.os }}_${{ matrix.cc }}_mlucas
path: ${{ github.workspace }}
Singlethread-Linux:
name: Mlucas Singlethreaded Linux
runs-on: ubuntu-latest
strategy:
matrix:
cc: [gcc]
fail-fast: false
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Before script
run: |
sed -i 's/-DUSE_THREADS//' makemake.sh
sed -i 's/^MAX=29/MAX=28/' config-fermat.sh
$CC --version
- name: Script
run: |
set -x
for mode in '' NOSIMD SSE2 AVX AVX2 AVX512; do
echo -e "\n$mode\n"
bash -e -o pipefail -- makemake.sh $mode
(cd obj${mode:+_$mode}; make clean)
for word in '' 1word 2word 3word 4word nword; do
echo -e "\nMfactor $word\n"
bash -e -o pipefail -- makemake.sh mfac $word $mode || true
(
cd obj_mfac${mode:+_$mode}
make clean
mv -v build.log build_${word}.log
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h
)
done
done
cd obj
time ./Mlucas -s m
bash -- ../config-fermat.sh
- uses: actions/upload-artifact@v4
if: always()
with:
name: ubuntu_${{ matrix.cc }}_singlethreaded_mlucas
path: ${{ github.workspace }}
ASan-Linux:
name: AddressSanitizer Linux
runs-on: ubuntu-latest
strategy:
matrix:
cc: [gcc, clang]
fail-fast: false
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update -y
sudo apt-get install -y libhwloc-dev
- name: Before script
run: |
sed -i 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh
$CC --version
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh use_hwloc
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( $(nproc --all) - 1 ))"
bash -- ../config-fermat.sh -cpu "0:$(( $(nproc --all) - 1 ))"
continue-on-error: true
TSan-Linux:
name: ThreadSanitizer Linux
runs-on: ubuntu-latest
strategy:
matrix:
cc: [gcc, clang]
exclude:
- cc: gcc # Too slow
fail-fast: false
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update -y
sudo apt-get install -y libhwloc-dev
- name: Before script
run: |
sed -i 's/-O3/-Og -fsanitize=thread/' makemake.sh
$CC --version
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh use_hwloc
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( $(nproc --all) - 1 ))"
continue-on-error: true
GCC-analyzer:
name: GCC analyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: GCC analyzer
run: |
set -x
set -o pipefail
gcc -c -fdiagnostics-color -g -O3 -march=native -DUSE_THREADS -fanalyzer src/*.c |& tee analyzer.log
rm -- *.o
echo -e '## GCC analyzer\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' analyzer.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
Clang-Tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update -y
sudo apt-get install -y libhwloc-dev
- name: Clang-Tidy
run: |
set -x
set -o pipefail
clang-tidy --use-color -checks='bugprone-*,-bugprone-reserved-identifier,cert-*,clang-analyzer-*,concurrency-*,misc-*,-misc-no-recursion,-misc-confusable-identifiers,performance-*,portability-*,readability-const-return-type,readability-container-*,readability-duplicate-include,readability-else-after-return,readability-make-member-function-cons,readability-non-const-parameter,readability-redundant-*,readability-simplify-*,readability-string-compare,readability-use-*' -header-filter='.*' src/*.c -- -Wall -O3 -march=native -DUSE_THREADS -DINCLUDE_HWLOC=1 |& tee clang-tidy.log
echo -e '## Clang-Tidy\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' clang-tidy.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
Cppcheck:
name: Cppcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update -y
sudo apt-get install -y cppcheck libhwloc-dev
- name: Cppcheck
run: |
mkdir build
cppcheck --enable=all -DUSE_THREADS -DINCLUDE_HWLOC=1 --force --cppcheck-build-dir=build -j "$(nproc)" --clang .
cppcheck --enable=all -DUSE_THREADS -DINCLUDE_HWLOC=1 --force --cppcheck-build-dir=build --clang . &> cppcheck.log
echo -e '## Cppcheck\n```' >> $GITHUB_STEP_SUMMARY
grep '\(error\|warning\|style\|performance\|portability\|information\):' cppcheck.log | awk '{ print $2, $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
ShellCheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ShellCheck
run: shopt -s globstar; shellcheck -o avoid-nullary-conditions,check-extra-masked-returns,check-set-e-suppressed,deprecate-which,quote-safe-variables,require-double-brackets -s bash **/*.sh
continue-on-error: true
macOS:
name: Mlucas macOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, macos-13, macos-14]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install
run: |
brew install hwloc
- name: Before script
run: |
clang --version
clang -dM -E -march=native - </dev/null
- name: Script
run: |
set -x
set -o pipefail
sysctl -a
MODES=( '' NOSIMD )
if (( $(sysctl -n hw.optional.AdvSIMD) )); then
MODES+=( ASIMD )
else
MODES+=( SSE2 AVX AVX2 AVX512 )
fi
for mode in "${MODES[@]}"; do
echo -e "\n$mode\n"
bash -e -o pipefail -- makemake.sh use_hwloc $mode
(cd obj${mode:+_$mode}; make clean)
for word in '' 1word 2word 3word 4word nword; do
echo -e "\nMfactor $word\n"
bash -e -o pipefail -- makemake.sh mfac $word $mode || true
(
cd obj_mfac${mode:+_$mode}
make clean
mv -v build.log build_${word}.log
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h
)
done
done
cd obj
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
for s in tt t s m l; do time ./Mlucas -s $s -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" 2>&1 | tee -a test.log; done
if (( $(sysctl -n hw.optional.AdvSIMD) )); then
cd ../obj_NOSIMD
fi
bash -- ../config-fermat.sh -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))"
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.os }}_mlucas
path: ${{ github.workspace }}
Singlethread-macOS:
name: Mlucas Singlethreaded macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Before script
run: |
sed -i '' 's/-DUSE_THREADS//' makemake.sh
sed -i '' 's/^MAX=29/MAX=28/' config-fermat.sh
clang --version
- name: Script
run: |
set -x
for mode in '' NOSIMD ASIMD; do
echo -e "\n$mode\n"
bash -e -o pipefail -- makemake.sh $mode
(cd obj${mode:+_$mode}; make clean)
for word in '' 1word 2word 3word 4word nword; do
echo -e "\nMfactor $word\n"
bash -e -o pipefail -- makemake.sh mfac $word $mode || true
(
cd obj_mfac${mode:+_$mode}
make clean
mv -v build.log build_${word}.log
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h
)
done
done
cd obj
time ./Mlucas -s m
if (( $(sysctl -n hw.optional.AdvSIMD) )); then
cd ../obj_NOSIMD
fi
bash -- ../config-fermat.sh
- uses: actions/upload-artifact@v4
if: always()
with:
name: macos_singlethreaded_mlucas
path: ${{ github.workspace }}
ASan-macOS:
name: AddressSanitizer macOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install
run: |
brew install hwloc
- name: Before script
run: |
sed -i '' 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh
clang --version
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh use_hwloc
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))"
if ! (( $(sysctl -n hw.optional.AdvSIMD) )); then
bash -- ../config-fermat.sh -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))"
fi
continue-on-error: true
TSan-macOS:
name: ThreadSanitizer macOS
if: false # Too slow
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install
run: |
brew install hwloc
- name: Before script
run: |
sed -i '' 's/-O3/-Og -fsanitize=thread/' makemake.sh
clang --version
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh use_hwloc
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))"
continue-on-error: true
Windows:
name: Windows
runs-on: windows-latest
continue-on-error: true
strategy:
matrix:
cc: [gcc, clang]
fail-fast: false
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Before Install
run: |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "CPPFLAGS=-IC:\msys64\mingw64\include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "LDFLAGS=-LC:\msys64\mingw64\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install
run: |
pacman -S --noconfirm mingw-w64-x86_64-gmp mingw-w64-x86_64-hwloc
& $env:CC --version
- name: Install Clang
if: ${{ matrix.cc == 'clang' }}
run: |
pacman -S --noconfirm mingw-w64-x86_64-clang
- name: Before script
shell: bash
run: |
$CC --version
$CC -dM -E -march=native - </dev/null
- name: Script
shell: bash
run: |
set -x
for mode in '' NOSIMD SSE2 AVX AVX2 AVX512; do
echo -e "\n$mode\n"
bash -e -o pipefail -- makemake.sh use_hwloc $mode
(cd obj${mode:+_$mode}; make clean)
for word in '' 1word 2word 3word 4word nword; do
echo -e "\nMfactor $word\n"
bash -e -o pipefail -- makemake.sh mfac $word $mode || true
(
cd obj_mfac${mode:+_$mode}
make clean
mv -v build.log build_${word}.log
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h
)
done
done
cd obj
for s in tt t s m l; do time ./Mlucas -s $s -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))" |& tee -a test.log; done
bash -- ../config-fermat.sh -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))"
- uses: actions/upload-artifact@v4
if: always()
with:
name: windows_${{ matrix.cc }}_mlucas
path: ${{ github.workspace }}
ASan-Windows:
name: AddressSanitizer Windows
runs-on: windows-latest
continue-on-error: true
env:
CC: clang
steps:
- uses: actions/checkout@v4
- name: Before Install
run: |
echo "C:\msys64\clang64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "CPPFLAGS=-IC:\msys64\clang64\include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "LDFLAGS=-LC:\msys64\clang64\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install
run: |
pacman -S --noconfirm mingw-w64-clang-x86_64-toolchain
pacman -S --noconfirm mingw-w64-clang-x86_64-gmp mingw-w64-clang-x86_64-hwloc
- name: Before script
shell: bash
run: |
sed -i 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh
$CC --version
- name: Script
shell: bash
run: |
set -x
bash -e -o pipefail -- makemake.sh use_hwloc
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))" |& tee -a test.log
bash -- ../config-fermat.sh -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))"