Skip to content

Commit

Permalink
Merge branch 'AMReX-Codes:development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
ruohai0925 authored Jul 6, 2024
2 parents 1e0dceb + 85ae84e commit 8acc58c
Show file tree
Hide file tree
Showing 29 changed files with 517 additions and 178 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,53 @@ jobs:
ccache -s
du -hs ~/.cache/ccache
tests_cxx20:
name: Clang C++20 [tests]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang.sh 15
.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: Build & Install
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor"}
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=100M
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z
mkdir build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_EB=ON \
-DAMReX_ENABLE_TESTS=ON \
-DAMReX_FORTRAN=OFF \
-DAMReX_MPI=ON \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_C_COMPILER=$(which clang-15) \
-DCMAKE_CXX_COMPILER=$(which clang++-15) \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
make -j 4
ctest --output-on-failure
ccache -s
du -hs ~/.cache/ccache
# Build 2D libamrex with configure
configure-2d:
name: Clang NOMPI Release [configure 2D]
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@ jobs:
cmake -S . -B build `
-DCMAKE_VERBOSE_MAKEFILE=ON `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_CXX_FLAGS=" /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" `
-DAMReX_EB=ON `
-DAMReX_ENABLE_TESTS=ON `
-DAMReX_FORTRAN=OFF `
-DAMReX_MPI=OFF
#-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build --config RelWithDebInfo -j 4
cmake --build build -j 4
cmake --build build --config RelWithDebInfo --target install
cmake --build build --config RelWithDebInfo --target test_install
cmake --build build --target install
cmake --build build --target test_install
#ccache -s
Expand Down
6 changes: 3 additions & 3 deletions Src/AmrCore/AMReX_AmrMesh.H
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public:
void SetGeometry (int lev, const Geometry& geom_in) noexcept;

//! Given domain box, return AMR level. Return -1 if there is no match.
int GetLevel (Box const& domain) noexcept;
[[nodiscard]] int GetLevel (Box const& domain) const noexcept;

void ClearDistributionMap (int lev) noexcept;
void ClearBoxArray (int lev) noexcept;
Expand All @@ -201,7 +201,7 @@ public:
//! Return the largest allowable grid.
[[nodiscard]] const IntVect& maxGridSize (int lev) const noexcept { return max_grid_size[lev]; }

[[nodiscard]] bool LevelDefined (int lev) noexcept;
[[nodiscard]] bool LevelDefined (int lev) const noexcept;

//! Should we keep the coarser grids fixed (and not regrid those levels) at all?
[[nodiscard]] bool useFixedCoarseGrids () const noexcept { return use_fixed_coarse_grids; }
Expand Down Expand Up @@ -255,7 +255,7 @@ public:

[[nodiscard]] virtual BoxArray GetAreaNotToTag (int /*lev*/) { return BoxArray(); }

[[nodiscard]] long CountCells (int lev) noexcept;
[[nodiscard]] Long CountCells (int lev) const noexcept;

[[nodiscard]] virtual DistributionMapping MakeDistributionMap (int lev, BoxArray const& ba);

Expand Down
10 changes: 5 additions & 5 deletions Src/AmrCore/AMReX_AmrMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ AmrMesh::SetGeometry (int lev, const Geometry& geom_in) noexcept
}

int
AmrMesh::GetLevel (Box const& domain) noexcept
AmrMesh::GetLevel (Box const& domain) const noexcept
{
Box ccdomain = amrex::enclosedCells(domain);
Box const& ccdomain = amrex::enclosedCells(domain);
for (int lev = 0; lev < geom.size(); ++lev) {
if (geom[lev].Domain() == ccdomain) { return lev; }
}
Expand All @@ -443,7 +443,7 @@ AmrMesh::ClearBoxArray (int lev) noexcept
}

bool
AmrMesh::LevelDefined (int lev) noexcept
AmrMesh::LevelDefined (int lev) const noexcept
{
return lev <= max_level && !grids[lev].empty() && !dmap[lev].empty();
}
Expand Down Expand Up @@ -1216,8 +1216,8 @@ AmrMesh::checkInput ()
}
}

long
AmrMesh::CountCells (int lev) noexcept
Long
AmrMesh::CountCells (int lev) const noexcept
{
return grids[lev].numPts();
}
Expand Down
8 changes: 4 additions & 4 deletions Src/AmrCore/AMReX_ErrorList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ AMRErrorTag::operator() (TagBoxArray& tba,
auto const& tagma = tba.arrays();
if (m_test == BOX)
{
const auto plo = geom.ProbLoArray();
const auto dx = geom.CellSizeArray();
const auto tag_rb = m_info.m_realbox;
const auto& plo = geom.ProbLoArray();
const auto& dx = geom.CellSizeArray();
const auto& tag_rb = m_info.m_realbox;
ParallelFor(tba, [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k) noexcept
{
GpuArray<Real,AMREX_SPACEDIM> pt
Expand All @@ -277,7 +277,7 @@ AMRErrorTag::operator() (TagBoxArray& tba,
auto const& datma = mf->const_arrays();
auto threshold = m_value[level];
auto const volume_weighting = m_info.m_volume_weighting;
auto geomdata = geom.data();
auto const& geomdata = geom.data();
auto tag_update = tagval;
if (m_info.m_derefine) {
tag_update = clearval;
Expand Down
5 changes: 4 additions & 1 deletion Src/Base/AMReX_BaseFwd.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef AMREX_BASE_FWD_H_
#define AMREX_BASE_FWD_H_
#include <AMReX_Config.H>

namespace amrex {

Expand All @@ -25,7 +26,9 @@ class Box;
template<int dim>
class IntVectND;
using IntVect = IntVectND<AMREX_SPACEDIM>;
class IndexType;
template<int dim>
class IndexTypeND;
using IndexType = IndexTypeND<AMREX_SPACEDIM>;
struct Dim3;
struct XDim3;
class RealBox;
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_GpuRange.H
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ AMREX_FORCE_INLINE Box at (Box const& b, Long offset) noexcept
static_cast<int>(j),
static_cast<int>(k))};
iv += b.smallEnd();
return Box(iv,iv,b.type());
return Box(iv,iv,b.ixType());
))
AMREX_IF_ON_HOST((
amrex::ignore_unused(offset);
Expand Down
Loading

0 comments on commit 8acc58c

Please sign in to comment.