Skip to content

Commit

Permalink
Merge branch 'hybrid_eta_deltaJ' into dsmc_simpler_charge_exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
roelof-groenewald committed Dec 12, 2023
2 parents 7bc406a + c4e1e8e commit d97a0d3
Show file tree
Hide file tree
Showing 346 changed files with 6,411 additions and 3,964 deletions.
19 changes: 3 additions & 16 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,10 @@ Checks: '
misc-*,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-nullptr,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
mpi-*,
performance-faster-string-find,
performance-for-range-copy,
Expand Down
59 changes: 39 additions & 20 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,26 @@ jobs:
- name: install dependencies
run: |
.github/workflows/dependencies/clang14.sh
- name: build WarpX using clang-tidy
- name: set up cache
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: build WarpX & run clang-tidy
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=300M
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z
export CXX=$(which clang++)
export CC=$(which clang)
# The following wrapper ensures that only source files
# in WarpX/Source/* are actually processed by clang-tidy
#_______________________________
cat > clang_tidy_wrapper << EOF
#!/bin/bash
REGEX="[a-z_A-Z0-9\/]*WarpX\/Source[a-z_A-Z0-9\/]+.cpp"
if [[ \$4 =~ \$REGEX ]];then
clang-tidy \$@
fi
EOF
chmod +x clang_tidy_wrapper
#_____________________________________
cmake -S . -B build_clang_tidy \
-DCMAKE_CXX_CLANG_TIDY="$PWD/clang_tidy_wrapper;--system-headers=0;--config-file=$PWD/.clang-tidy" \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DWarpX_DIMS="1;2;3;RZ" \
-DWarpX_MPI=ON \
Expand All @@ -46,9 +44,30 @@ jobs:
-DWarpX_QED=ON \
-DWarpX_QED_TABLE_GEN=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_PRECISION=SINGLE
-DWarpX_PRECISION=SINGLE \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build_clang_tidy -j 2
cmake --build build_clang_tidy -j 2 2> build_clang_tidy/clang-tidy.log
${{github.workspace}}/.github/workflows/source/makeMakefileForClangTidy.py --input ${{github.workspace}}/ccache.log.txt
make -j2 -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
cat build_clang_tidy/clang-tidy.log
if [[ $(wc -m <build_clang_tidy/clang-tidy.log) -gt 1 ]]; then exit 1; fi
ccache -s
du -hs ~/.cache/ccache
save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr_number.txt
retention-days: 1
40 changes: 40 additions & 0 deletions .github/workflows/cleanup-cache-postpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CleanUpCachePostPR

on:
workflow_run:
workflows: [PostPR]
types:
- completed

jobs:
CleanUpCcacheCachePostPR:
name: Clean Up Ccache Cache Post PR
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Clean up ccache
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
gh run download ${{ github.event.workflow_run.id }} -n pr_number
pr_number=`cat pr_number.txt`
BRANCH=refs/pull/${pr_number}/merge
# Setting this to not fail the workflow while deleting cache keys.
set +e
keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH | cut -f 1)
# $keys might contain spaces. Thus we set IFS to \n.
IFS=$'\n'
for k in $keys
do
gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm
done
unset IFS
63 changes: 63 additions & 0 deletions .github/workflows/cleanup-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CleanUpCache

on:
workflow_run:
workflows: [🧹 clang-tidy, 🔍 CodeQL, 🐧 CUDA, 🐧 HIP, 🐧 Intel, 🍏 macOS, 🐧 OpenMP]
types:
- completed

jobs:
CleanUpCcacheCache:
name: Clean Up Ccache Cache for ${{ github.event.workflow_run.name }}
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Clean up ccache
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
# push or pull_request or schedule or ...
EVENT=${{ github.event.workflow_run.event }}
# Triggering workflow run name (e.g., LinuxClang)
WORKFLOW_NAME="${{ github.event.workflow_run.name }}"
if [[ $EVENT == "pull_request" ]]; then
gh run download ${{ github.event.workflow_run.id }} -n pr_number
pr_number=`cat pr_number.txt`
BRANCH=refs/pull/${pr_number}/merge
else
BRANCH=refs/heads/${{ github.event.workflow_run.head_branch }}
fi
# Setting this to not fail the workflow while deleting cache keys.
set +e
# In our cache keys, substring after `-git-` is git hash, substring
# before that is a unique id for jobs (e.g., `ccache-LinuxClang-configure-2d`).
# The goal is to keep the last used key of each job and delete all others.
# something like ccache-LinuxClang-
keyprefix="ccache-${WORKFLOW_NAME}-"
cached_jobs=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "$keyprefix" | awk -F '-git-' '{print $1}' | sort | uniq)
# cached_jobs is something like "ccache-LinuxClang-configure-1d ccache-LinuxClang-configure-2d".
# It might also contain spaces. Thus we set IFS to \n.
IFS=$'\n'
for j in $cached_jobs
do
old_keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "${j}-git-" --sort last-used | cut -f 1 | tail -n +2)
for k in $old_keys
do
gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm
done
done
unset IFS
39 changes: 38 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@ jobs:
if: ${{ matrix.language == 'cpp' }}
run: |
sudo apt-get update
sudo apt-get install --yes cmake openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libadios-openmpi-dev
sudo apt-get install --yes cmake openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libadios-openmpi-dev ccache
python -m pip install --upgrade pip
python -m pip install --upgrade wheel
python -m pip install --upgrade cmake
export CMAKE="$HOME/.local/bin/cmake" && echo "CMAKE=$CMAKE" >> $GITHUB_ENV
- name: Set Up Cache
if: ${{ matrix.language == 'cpp' }}
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Configure (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
Expand All @@ -61,6 +70,19 @@ jobs:
- name: Build (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=100M
ccache -z
$CMAKE --build build -j 2
ccache -s
du -hs ~/.cache/ccache
# Make sure CodeQL has something to do
touch Source/Utils/WarpXVersion.cpp
export CCACHE_DISABLE=1
$CMAKE --build build -j 2
- name: Perform CodeQL Analysis
Expand Down Expand Up @@ -88,3 +110,18 @@ jobs:
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr_number.txt
retention-days: 1
Loading

0 comments on commit d97a0d3

Please sign in to comment.