Skip to content

Commit eb66368

Browse files
authored
Merge branch 'development' into update_adastra_instructions
2 parents b9b3041 + 56e4a2a commit eb66368

File tree

812 files changed

+35644
-20142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

812 files changed

+35644
-20142
lines changed

.clang-tidy

+50-54
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,57 @@
1-
Checks: '-*,
2-
bugprone-*
3-
-bugprone-easily-swappable-parameters,
4-
-bugprone-implicit-widening-of-multiplication-result,
5-
-bugprone-misplaced-widening-cast,
6-
cert-*
7-
-cert-err58-cpp,
8-
cppcoreguidelines-avoid-goto,
9-
cppcoreguidelines-interfaces-global-init,
10-
-cppcoreguidelines-avoid-non-const-global-variables,
11-
-cppcoreguidelines-init-variables,
12-
-cppcoreguidelines-macro-usage,
13-
-cppcoreguidelines-narrowing-conversions,
14-
-cppcoreguidelines-no-malloc,
15-
-cppcoreguidelines-owning-memory,
16-
misc-const-correctness,
17-
misc-misleading-bidirectional,
18-
modernize-avoid-bind,
19-
modernize-concat-nested-namespaces,
20-
modernize-deprecated-headers,
21-
modernize-deprecated-ios-base-aliases,
22-
modernize-loop-convert,
23-
modernize-make-shared,
24-
modernize-make-unique,
25-
modernize-pass-by-value,
26-
modernize-raw-string-literal,
27-
modernize-redundant-void-arg,
28-
modernize-replace-auto-ptr,
29-
modernize-replace-disallow-copy-and-assign-macro,
30-
modernize-replace-random-shuffle,
31-
modernize-return-braced-init-list,
32-
modernize-shrink-to-fit,
33-
modernize-unary-static-assert,
34-
modernize-use-nullptr,
1+
Checks: '
2+
-*,
3+
bugprone-*,
4+
-bugprone-easily-swappable-parameters,
5+
-bugprone-implicit-widening-of-multiplication-result,
6+
-bugprone-misplaced-widening-cast,
7+
-bugprone-unchecked-optional-access,
8+
cert-*,
9+
-cert-err58-cpp,
10+
clang-diagnostic-*,
11+
cppcoreguidelines-*,
12+
-cppcoreguidelines-avoid-c-arrays,
13+
-cppcoreguidelines-avoid-magic-numbers,
14+
-cppcoreguidelines-avoid-non-const-global-variables,
15+
-cppcoreguidelines-init-variables,
16+
-cppcoreguidelines-macro-usage,
17+
-cppcoreguidelines-narrowing-conversions,
18+
-cppcoreguidelines-non-private-member-variables-in-classes,
19+
-cppcoreguidelines-owning-memory,
20+
-cppcoreguidelines-pro-*,
21+
google-build-explicit-make-pair,
22+
google-build-namespaces,
23+
google-global-names-in-headers,
24+
misc-*,
25+
-misc-no-recursion,
26+
-misc-non-private-member-variables-in-classes,
27+
modernize-*,
28+
-modernize-avoid-c-arrays,
29+
-modernize-return-braced-init-list,
30+
-modernize-use-trailing-return-type,
3531
mpi-*,
36-
performance-faster-string-find,
37-
performance-for-range-copy,
38-
performance-implicit-conversion-in-loop,
39-
performance-inefficient-algorithm,
40-
performance-inefficient-string-concatenation,
41-
performance-inefficient-vector-operation,
42-
performance-move-const-arg,
43-
performance-move-constructor-init,
44-
readability-non-const-parameter,
45-
readability-simplify-boolean-expr,
46-
readability-simplify-subscript-expr,
47-
readability-static-accessed-through-instance,
48-
readability-static-definition-in-anonymous-namespace,
49-
readability-string-compare,
50-
readability-suspicious-call-argument,
51-
readability-uniqueptr-delete-release,
52-
-readability-uppercase-literal-suffix,
53-
readability-use-anyofallof,
54-
readability-non-const-parameter
32+
performance-*,
33+
-performance-unnecessary-copy-initialization,
34+
-performance-unnecessary-value-param,
35+
portability-*,
36+
readability-*,
37+
-readability-convert-member-functions-to-static,
38+
-readability-else-after-return,
39+
-readability-function-cognitive-complexity,
40+
-readability-identifier-length,
41+
-readability-implicit-bool-conversion,
42+
-readability-isolate-declaration,
43+
-readability-magic-numbers,
44+
-readability-named-parameter,
45+
-readability-uppercase-literal-suffix
5546
'
5647

5748
CheckOptions:
49+
- key: bugprone-narrowing-conversions.WarnOnIntegerToFloatingPointNarrowingConversion
50+
value: "false"
51+
- key: misc-definitions-in-headers.HeaderFileExtensions
52+
value: "H,"
5853
- key: modernize-pass-by-value.ValuesOnly
59-
value: 'true'
54+
value: "true"
55+
6056

6157
HeaderFilterRegex: 'Source[a-z_A-Z0-9\/]+\.H$'

.github/workflows/clang_tidy.yml

+39-20
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,26 @@ jobs:
1616
- name: install dependencies
1717
run: |
1818
.github/workflows/dependencies/clang14.sh
19-
- name: build WarpX using clang-tidy
19+
- name: set up cache
20+
uses: actions/cache@v3
21+
with:
22+
path: ~/.cache/ccache
23+
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
24+
restore-keys: |
25+
ccache-${{ github.workflow }}-${{ github.job }}-git-
26+
- name: build WarpX & run clang-tidy
2027
run: |
21-
28+
export CCACHE_COMPRESS=1
29+
export CCACHE_COMPRESSLEVEL=10
30+
export CCACHE_MAXSIZE=300M
31+
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
32+
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
33+
ccache -z
2234
2335
export CXX=$(which clang++)
2436
export CC=$(which clang)
2537
26-
# The following wrapper ensures that only source files
27-
# in WarpX/Source/* are actually processed by clang-tidy
28-
#_______________________________
29-
cat > clang_tidy_wrapper << EOF
30-
#!/bin/bash
31-
REGEX="[a-z_A-Z0-9\/]*WarpX\/Source[a-z_A-Z0-9\/]+.cpp"
32-
if [[ \$4 =~ \$REGEX ]];then
33-
clang-tidy \$@
34-
fi
35-
EOF
36-
chmod +x clang_tidy_wrapper
37-
#_____________________________________
38-
3938
cmake -S . -B build_clang_tidy \
40-
-DCMAKE_CXX_CLANG_TIDY="$PWD/clang_tidy_wrapper;--system-headers=0;--config-file=$PWD/.clang-tidy" \
4139
-DCMAKE_VERBOSE_MAKEFILE=ON \
4240
-DWarpX_DIMS="1;2;3;RZ" \
4341
-DWarpX_MPI=ON \
@@ -46,9 +44,30 @@ jobs:
4644
-DWarpX_QED=ON \
4745
-DWarpX_QED_TABLE_GEN=ON \
4846
-DWarpX_OPENPMD=ON \
49-
-DWarpX_PRECISION=SINGLE
47+
-DWarpX_PRECISION=SINGLE \
48+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
49+
50+
cmake --build build_clang_tidy -j 2
5051
51-
cmake --build build_clang_tidy -j 2 2> build_clang_tidy/clang-tidy.log
52+
${{github.workspace}}/.github/workflows/source/makeMakefileForClangTidy.py --input ${{github.workspace}}/ccache.log.txt
53+
make -j2 --keep-going -f clang-tidy-ccache-misses.mak \
54+
CLANG_TIDY=clang-tidy \
55+
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
5256
53-
cat build_clang_tidy/clang-tidy.log
54-
if [[ $(wc -m <build_clang_tidy/clang-tidy.log) -gt 1 ]]; then exit 1; fi
57+
ccache -s
58+
du -hs ~/.cache/ccache
59+
60+
save_pr_number:
61+
if: github.event_name == 'pull_request'
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Save PR number
65+
env:
66+
PR_NUMBER: ${{ github.event.number }}
67+
run: |
68+
echo $PR_NUMBER > pr_number.txt
69+
- uses: actions/upload-artifact@v3
70+
with:
71+
name: pr_number
72+
path: pr_number.txt
73+
retention-days: 1
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CleanUpCachePostPR
2+
3+
on:
4+
workflow_run:
5+
workflows: [PostPR]
6+
types:
7+
- completed
8+
9+
jobs:
10+
CleanUpCcacheCachePostPR:
11+
name: Clean Up Ccache Cache Post PR
12+
runs-on: ubuntu-latest
13+
permissions:
14+
actions: write
15+
contents: read
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Clean up ccache
21+
run: |
22+
gh extension install actions/gh-actions-cache
23+
24+
REPO=${{ github.repository }}
25+
26+
gh run download ${{ github.event.workflow_run.id }} -n pr_number
27+
pr_number=`cat pr_number.txt`
28+
BRANCH=refs/pull/${pr_number}/merge
29+
30+
# Setting this to not fail the workflow while deleting cache keys.
31+
set +e
32+
33+
keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH | cut -f 1)
34+
# $keys might contain spaces. Thus we set IFS to \n.
35+
IFS=$'\n'
36+
for k in $keys
37+
do
38+
gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm
39+
done
40+
unset IFS

.github/workflows/cleanup-cache.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CleanUpCache
2+
3+
on:
4+
workflow_run:
5+
workflows: [🧹 clang-tidy, 🔍 CodeQL, 🐧 CUDA, 🐧 HIP, 🐧 Intel, 🍏 macOS, 🐧 OpenMP]
6+
types:
7+
- completed
8+
9+
jobs:
10+
CleanUpCcacheCache:
11+
name: Clean Up Ccache Cache for ${{ github.event.workflow_run.name }}
12+
runs-on: ubuntu-latest
13+
permissions:
14+
actions: write
15+
contents: read
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Clean up ccache
21+
run: |
22+
gh extension install actions/gh-actions-cache
23+
24+
REPO=${{ github.repository }}
25+
26+
# push or pull_request or schedule or ...
27+
EVENT=${{ github.event.workflow_run.event }}
28+
29+
# Triggering workflow run name (e.g., LinuxClang)
30+
WORKFLOW_NAME="${{ github.event.workflow_run.name }}"
31+
32+
if [[ $EVENT == "pull_request" ]]; then
33+
gh run download ${{ github.event.workflow_run.id }} -n pr_number
34+
pr_number=`cat pr_number.txt`
35+
BRANCH=refs/pull/${pr_number}/merge
36+
else
37+
BRANCH=refs/heads/${{ github.event.workflow_run.head_branch }}
38+
fi
39+
40+
# Setting this to not fail the workflow while deleting cache keys.
41+
set +e
42+
43+
# In our cache keys, substring after `-git-` is git hash, substring
44+
# before that is a unique id for jobs (e.g., `ccache-LinuxClang-configure-2d`).
45+
# The goal is to keep the last used key of each job and delete all others.
46+
47+
# something like ccache-LinuxClang-
48+
keyprefix="ccache-${WORKFLOW_NAME}-"
49+
50+
cached_jobs=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "$keyprefix" | awk -F '-git-' '{print $1}' | sort | uniq)
51+
52+
# cached_jobs is something like "ccache-LinuxClang-configure-1d ccache-LinuxClang-configure-2d".
53+
# It might also contain spaces. Thus we set IFS to \n.
54+
IFS=$'\n'
55+
for j in $cached_jobs
56+
do
57+
old_keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "${j}-git-" --sort last-used | cut -f 1 | tail -n +2)
58+
for k in $old_keys
59+
do
60+
gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm
61+
done
62+
done
63+
unset IFS

.github/workflows/codeql.yml

+38-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,22 @@ jobs:
3535
if: ${{ matrix.language == 'cpp' }}
3636
run: |
3737
sudo apt-get update
38-
sudo apt-get install --yes cmake openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libadios-openmpi-dev
38+
sudo apt-get install --yes cmake openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libadios-openmpi-dev ccache
3939
4040
python -m pip install --upgrade pip
4141
python -m pip install --upgrade wheel
4242
python -m pip install --upgrade cmake
4343
export CMAKE="$HOME/.local/bin/cmake" && echo "CMAKE=$CMAKE" >> $GITHUB_ENV
4444
45+
- name: Set Up Cache
46+
if: ${{ matrix.language == 'cpp' }}
47+
uses: actions/cache@v3
48+
with:
49+
path: ~/.cache/ccache
50+
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
51+
restore-keys: |
52+
ccache-${{ github.workflow }}-${{ github.job }}-git-
53+
4554
- name: Configure (C++)
4655
if: ${{ matrix.language == 'cpp' }}
4756
run: |
@@ -61,6 +70,19 @@ jobs:
6170
- name: Build (C++)
6271
if: ${{ matrix.language == 'cpp' }}
6372
run: |
73+
export CCACHE_COMPRESS=1
74+
export CCACHE_COMPRESSLEVEL=10
75+
export CCACHE_MAXSIZE=100M
76+
ccache -z
77+
78+
$CMAKE --build build -j 2
79+
80+
ccache -s
81+
du -hs ~/.cache/ccache
82+
83+
# Make sure CodeQL has something to do
84+
touch Source/Utils/WarpXVersion.cpp
85+
export CCACHE_DISABLE=1
6486
$CMAKE --build build -j 2
6587
6688
- name: Perform CodeQL Analysis
@@ -88,3 +110,18 @@ jobs:
88110
uses: github/codeql-action/upload-sarif@v2
89111
with:
90112
sarif_file: sarif-results/${{ matrix.language }}.sarif
113+
114+
save_pr_number:
115+
if: github.event_name == 'pull_request'
116+
runs-on: ubuntu-latest
117+
steps:
118+
- name: Save PR number
119+
env:
120+
PR_NUMBER: ${{ github.event.number }}
121+
run: |
122+
echo $PR_NUMBER > pr_number.txt
123+
- uses: actions/upload-artifact@v3
124+
with:
125+
name: pr_number
126+
path: pr_number.txt
127+
retention-days: 1

0 commit comments

Comments
 (0)