Skip to content

Commit

Permalink
Merge branch 'development' into WindModels_GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Jul 2, 2024
2 parents 188821a + e7365e1 commit 757c24e
Show file tree
Hide file tree
Showing 61 changed files with 2,216 additions and 617 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
cpp-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down
41 changes: 38 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -46,12 +46,24 @@ jobs:
# Install MPI
${{matrix.install_deps}}
- name: Install CCache
run: Submodules/AMReX/.github/workflows/dependencies/dependencies_ccache.sh

- name: Set Up Cache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Configure CMake
run: |
cmake \
-B${{runner.workspace}}/ERF/build-${{matrix.os}} \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/ERF/install \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DERF_DIM:STRING=3 \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_TESTS:BOOL=ON \
Expand All @@ -63,8 +75,16 @@ jobs:
- name: Build
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=600M
ccache -z
cmake --build ${{runner.workspace}}/ERF/build-${{matrix.os}} --parallel ${{env.NPROCS}};
ccache -s
du -hs ~/.cache/ccache
- name: Regression Tests
run: |
ctest -L regression -VV
Expand All @@ -81,16 +101,31 @@ jobs:
# cd ..
# gcovr -g -k -r . --xml regressioncov.html # -v
# - name: Success artifacts
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# if: success()
# with:
# name: build-and-test
# path: |
# ${{runner.workspace}}/ERF/regressioncov.html
# - name: Failing test artifacts
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: build-and-test
# path: |
# ${{runner.workspace}}/ERF/regressioncov.html

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@v4
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@v4
- 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: [ERF CI, ERF CUDA CI, ERF CI (hip), ERF CI (sycl), Linux GCC, MacOS]
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@v4
- 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
36 changes: 35 additions & 1 deletion .github/workflows/cuda-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,56 @@ jobs:
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare CUDA environment
run: Submodules/AMReX/.github/workflows/dependencies/dependencies_nvcc.sh ${{matrix.cuda_ver}}
- name: Install CCache
run: Submodules/AMReX/.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Configure and build
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=600M
ccache -z
export PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
which nvcc || echo "nvcc not in PATH!"
cmake -Bbuild-${{matrix.cuda_pkg}} \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON \
-DERF_DIM:STRING=3 \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_CUDA:BOOL=ON \
-DERF_ENABLE_REGRESSION_TESTS_ONLY:BOOL=ON .
cmake --build build-${{matrix.cuda_pkg}} -- -j $(nproc)
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@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
Expand Down
39 changes: 37 additions & 2 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,31 @@ jobs:
runs-on: ubuntu-20.04
# env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual"}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Install Dependencies
run: Submodules/AMReX/.github/workflows/dependencies/dependencies.sh

- name: Install CCache
run: Submodules/AMReX/.github/workflows/dependencies/dependencies_ccache.sh

- name: Set Up Cache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Configure Project and Generate Build System
run: |
cmake \
-B${{runner.workspace}}/ERF/build \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/ERF/install \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DERF_DIM:STRING=3 \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_TESTS:BOOL=ON \
Expand All @@ -34,9 +46,32 @@ jobs:
- name: Compile and Link
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=300M
ccache -z
cmake --build ${{runner.workspace}}/ERF/build --parallel 2 --verbose
ccache -s
du -hs ~/.cache/ccache
- name: CMake Tests # see file ERF/Tests/CTestList.cmake
run: |
ctest -L regression -VV
working-directory: ${{runner.workspace}}/ERF/build
working-directory: ${{runner.workspace}}/ERF/build

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@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
Loading

0 comments on commit 757c24e

Please sign in to comment.