Skip to content

Commit d39abbc

Browse files
authored
Add Bittree CI (#3577)
Also fix some clang-tidy warnings. Note that the 3D test does not actually work as expected. It has zero cells. We will try to fix in the future, because it's out of the scope of this PR adding CI.
1 parent f817d77 commit d39abbc

File tree

4 files changed

+226
-89
lines changed

4 files changed

+226
-89
lines changed

.github/workflows/bittree.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: bittree
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.ref }}-${{ github.head_ref }}-bittree
7+
cancel-in-progress: true
8+
9+
jobs:
10+
bittree-2d:
11+
name: Bittree 2D
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Dependencies
16+
run: |
17+
.github/workflows/dependencies/dependencies.sh
18+
.github/workflows/dependencies/dependencies_clang-tidy.sh 15
19+
.github/workflows/dependencies/dependencies_ccache.sh
20+
- name: Set Up Cache
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.cache/ccache
24+
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
25+
restore-keys: |
26+
ccache-${{ github.workflow }}-${{ github.job }}-git-
27+
- name: Check out Bittree
28+
uses: actions/checkout@v4
29+
with:
30+
repository: Flash-X/Bittree
31+
path: bittree
32+
- name: Build Bittree
33+
run: |
34+
cd ${{ github.workspace }}/bittree
35+
python setup.py library --dim 2 --prefix ${{ github.workspace }}/libbittree
36+
cd build
37+
make -j2
38+
make install
39+
- name: Build and Run Test
40+
run: |
41+
export CCACHE_COMPRESS=1
42+
export CCACHE_COMPRESSLEVEL=10
43+
export CCACHE_MAXSIZE=80M
44+
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
45+
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
46+
ccache -z
47+
48+
export AMREX_BITTREE_HOME=${{ github.workspace }}/libbittree
49+
cd ${{ github.workspace }}/Tests/Amr/Advection_AmrCore/Exec
50+
make -j2 USE_MPI=TRUE USE_BITTREE=TRUE DIM=2 TEST=TRUE \
51+
CCACHE=ccache
52+
mpiexec -n 2 ./main2d.gnu.TEST.MPI.ex inputs_bittree amr.plot_int=1000
53+
54+
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
55+
make -j2 -f clang-tidy-ccache-misses.mak \
56+
CLANG_TIDY=clang-tidy-15 \
57+
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
58+
59+
ccache -s
60+
du -hs ~/.cache/ccache
61+
62+
bittree-3d:
63+
name: Bittree 3D
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: Dependencies
68+
run: |
69+
.github/workflows/dependencies/dependencies.sh
70+
.github/workflows/dependencies/dependencies_clang-tidy.sh 15
71+
.github/workflows/dependencies/dependencies_ccache.sh
72+
- name: Set Up Cache
73+
uses: actions/cache@v3
74+
with:
75+
path: ~/.cache/ccache
76+
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
77+
restore-keys: |
78+
ccache-${{ github.workflow }}-${{ github.job }}-git-
79+
- name: Check out Bittree
80+
uses: actions/checkout@v4
81+
with:
82+
repository: Flash-X/Bittree
83+
path: bittree
84+
- name: Build Bittree
85+
run: |
86+
cd ${{ github.workspace }}/bittree
87+
python setup.py library --dim 3 --prefix ${{ github.workspace }}/libbittree
88+
cd build
89+
make -j2
90+
make install
91+
- name: Build and Run Test
92+
run: |
93+
export CCACHE_COMPRESS=1
94+
export CCACHE_COMPRESSLEVEL=10
95+
export CCACHE_MAXSIZE=80M
96+
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
97+
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
98+
ccache -z
99+
100+
export AMREX_BITTREE_HOME=${{ github.workspace }}/libbittree
101+
cd ${{ github.workspace }}/Tests/Amr/Advection_AmrCore/Exec
102+
make -j2 USE_MPI=TRUE USE_BITTREE=TRUE DIM=3 TEST=TRUE BL_NO_FORT=TRUE\
103+
CCACHE=ccache
104+
mpiexec -n 2 ./main3d.gnu.TEST.MPI.ex inputs_bittree max_step=10
105+
106+
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
107+
make -j2 -f clang-tidy-ccache-misses.mak \
108+
CLANG_TIDY=clang-tidy-15 \
109+
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
110+
111+
ccache -s
112+
du -hs ~/.cache/ccache
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

.github/workflows/cleanup-cache.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CleanUpCache
22

33
on:
44
workflow_run:
5-
workflows: [LinuxClang, cuda, LinuxGcc, hip, Hypre, intel, macos, PETSc, SUNDIALS, CodeQL, smoke, apps]
5+
workflows: [bittree, LinuxClang, cuda, LinuxGcc, hip, Hypre, intel, macos, PETSc, SUNDIALS, CodeQL, smoke, apps]
66
types:
77
- completed
88

Src/Extern/Bittree/AMReX_Bittree.H

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,46 @@ amr.use_bittree = true
2222
class btUnit {
2323
// Functions used in AmrMesh
2424
public:
25-
static int btRefine(bittree::BittreeAmr* const mesh,
26-
std::vector<int>& btTags,
27-
int max_crse, int lbase,
28-
Vector<BoxArray>& grids, Vector<DistributionMapping>& dmap,
29-
MPI_Comm comm);
30-
static void btCalculateGrids(bittree::BittreeAmr* const mesh,
31-
int lbase,
32-
int& new_finest,
33-
Vector<BoxArray>& new_grids,
34-
Vector<IntVect> const& max_grid_size);
35-
static void btCalculateLevel(bittree::BittreeAmr* const mesh,
36-
int lev,
37-
BoxArray& ba,
38-
IntVect const& max_grid_size);
25+
static int btRefine (bittree::BittreeAmr* mesh,
26+
std::vector<int>& btTags,
27+
int max_crse, int lbase,
28+
Vector<BoxArray>& grids, Vector<DistributionMapping>& dmap,
29+
MPI_Comm comm);
30+
static void btCalculateGrids (bittree::BittreeAmr* mesh,
31+
int lbase,
32+
int& new_finest,
33+
Vector<BoxArray>& new_grids,
34+
Vector<IntVect> const& max_grid_size);
35+
static void btCalculateLevel (bittree::BittreeAmr* mesh,
36+
int lev,
37+
BoxArray& ba,
38+
IntVect const& max_grid_size);
3939
// Utils
40-
public:
41-
static int getBitid(bittree::BittreeAmr* const mesh, bool updated,
42-
int lev, int idx_on_lev);
43-
static int getIndex(bittree::BittreeAmr* const mesh, bool updated,
44-
int lev, int bitid);
40+
static int getBitid (bittree::BittreeAmr* mesh, bool updated,
41+
int lev, int idx_on_lev);
42+
static int getIndex (bittree::BittreeAmr* mesh, bool updated,
43+
int lev, int bitid);
4544

4645
// Functions to implement strict octree logic
4746
private:
48-
static void btCheckRefine(bittree::BittreeAmr* const mesh,
49-
std::vector<int>& btTags,
50-
int max_crse, int lbase,
51-
Vector<BoxArray>& grids, Vector<DistributionMapping>& dmap,
52-
MPI_Comm comm);
47+
static void btCheckRefine (bittree::BittreeAmr* mesh,
48+
std::vector<int>& btTags,
49+
int max_crse, int lbase,
50+
Vector<BoxArray>& grids, Vector<DistributionMapping>& dmap,
51+
MPI_Comm comm);
5352

54-
static void btCheckDerefine(bittree::BittreeAmr* const mesh,
55-
std::vector<int>& btTags,
56-
int max_crse, int lbase,
57-
Vector<BoxArray>& grids, Vector<DistributionMapping>& dmap,
58-
MPI_Comm comm);
53+
static void btCheckDerefine (bittree::BittreeAmr* mesh,
54+
std::vector<int>& btTags,
55+
int max_crse, int lbase,
56+
Vector<BoxArray>& grids, Vector<DistributionMapping>& dmap,
57+
MPI_Comm comm);
5958

6059
// Utility Functions
61-
static bool checkNeighborsRefine(bittree::BittreeAmr* const mesh,
62-
bittree::MortonTree::Block b);
63-
static std::vector<int> neighIntCoords(bittree::BittreeAmr* const mesh,
64-
unsigned lev, unsigned* lcoord,
65-
int* gCell);
60+
static bool checkNeighborsRefine (bittree::BittreeAmr* mesh,
61+
bittree::MortonTree::Block b);
62+
static std::vector<int> neighIntCoords (bittree::BittreeAmr* mesh,
63+
unsigned lev, unsigned const* lcoord,
64+
int const* gCell);
6665

6766
public:
6867
// Represents whether domain has periodic BC in each direction

0 commit comments

Comments
 (0)