Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main #9

Merged
merged 96 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
26ce55c
CI: Update to AMReX 24.09
eschnett Sep 1, 2024
e20789f
Merge pull request #306 from EinsteinToolkit/eschnett/ci-amrex-24.09
eschnett Sep 1, 2024
f26576f
Arith: Implement efficient SIMD trigonometic functions
eschnett Sep 12, 2024
ed4293d
Arith: Correct SIMD tests
eschnett Sep 12, 2024
d412c15
Arith: Correct SIMD tests
eschnett Sep 12, 2024
1cb3459
Arith: Remove `constexpr` that some compilers don't like
eschnett Sep 12, 2024
351b248
Arith: Remove `constexpr` that some compilers don't like
eschnett Sep 12, 2024
bdd9e46
TestDerivs: Correct C++ calls to trigonometic functions
eschnett Sep 12, 2024
4dfd658
CI: Disable SIMD the new way
eschnett Sep 12, 2024
c3174ee
CI: Update Docker images
eschnett Oct 2, 2024
0199035
CI: Correct Docker image names
eschnett Oct 2, 2024
8bce92a
CarpetX: Update to nvtx3
eschnett Oct 2, 2024
cad1c67
CI: Reduce optimization level for OneAPI
eschnett Oct 7, 2024
6e14210
CI: Switch to production images
eschnett Oct 7, 2024
0c7e6fc
Merge pull request #309 from EinsteinToolkit/eschnett/ci-docker-update
eschnett Oct 7, 2024
8ebc67b
Merge branch 'main' into eschnett/simd-cbrt
eschnett Oct 7, 2024
e7f6844
Merge pull request #308 from EinsteinToolkit/eschnett/simd-cbrt
eschnett Oct 7, 2024
b13c4c6
CarpetXRegrid: Move regrid_error to a new thorn.
stevenrbrandt Jul 30, 2024
c1f021b
CI: Add CarpetXRegrid to thorn list
rhaas80 Sep 3, 2024
d878cf6
CarpetX: Change the implementation to Driver
stevenrbrandt Jul 29, 2024
09ee62c
Algo: remove parameter file and changing data from test output
rhaas80 Sep 3, 2024
d7c1cbb
BenchX: sort thorns alphabetically
rhaas80 Sep 10, 2024
bd63ea5
BenchX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
4948647
BoxInBox: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
79503b6
ErrorEstimator: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
cdccda8
FluxWaveToyX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
c04ce5e
MovingBoxToy: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
5396122
PoissonX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
b9a17b8
SiMDWaveToyX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
2f0b8c8
SpacetimeWaveToyX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
feaffd8
StaggeredWaveToyX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
bbcef51
TestArrayGroup: remove parameter file and changing data from test output
rhaas80 Sep 3, 2024
d24b024
TestBoundaries: adapt to moving regrid error into its own thorn
rhaas80 Aug 29, 2024
23db0c6
TestBoxInBox: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
7f5a2af
TestDerivs: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
7477faf
TestInterpolate: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
9d2cdf9
TestLoopX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
4d58fe9
TestNorms: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
1097b02
TestODESolvers: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
11127f6
TestODESolvers2: remove parameter file and changing data from test ou…
rhaas80 Sep 3, 2024
b61257a
TestOutput: adapt to moving regrid error into its own thorn
rhaas80 Aug 29, 2024
5e4768b
TestProlongate: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
c1a6a47
TestSymmetries: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
a941c33
WaveToyX: adapt to CarpetX implementation change
rhaas80 Aug 29, 2024
a5981a6
ODESolvers: Schedule `ODESolvers_PostStep` after recovering
eschnett Oct 23, 2024
e729afd
Loop: Update AMReX include files
eschnett Oct 23, 2024
8dd8aec
ADMBaseX: Clean up schedule
eschnett Oct 23, 2024
fccbea7
HydroBaseX: Clean up schedule
eschnett Oct 23, 2024
485b9ea
CarpetX: Correct ENO operators
eschnett Oct 25, 2024
40be639
CarpetX: Correct ENO operators
eschnett Oct 25, 2024
1380ea6
CarpetX: Correct poison check on HIP systems
eschnett Oct 25, 2024
901bc9e
CarpetX: Implement `minmod` prolongation operator
eschnett Oct 25, 2024
1368f94
CarpetX: Support openPMD_api 0.16.0
eschnett Oct 30, 2024
6ace6e2
CarpetX: Use Blosc compression by default for openPMD output
eschnett Oct 30, 2024
a8ee002
CarpetX: Reformat code
eschnett Oct 30, 2024
2df98d9
CarpetX: ADIOS2: Avoid too much screen output
eschnett Oct 30, 2024
51e0572
CarpetX: ADIOS2: Use Blosc compression by default
eschnett Oct 30, 2024
7b25fac
Arith: Clean up code
eschnett Oct 30, 2024
72614a2
BoxInBox: Don't allow zero radius
eschnett Oct 30, 2024
9744b92
Loop: Inline more aggressively
eschnett Oct 30, 2024
8e80691
MovingBoxToy: Code cleanup
eschnett Oct 30, 2024
4735fab
TestSymmetries: Beautify code
eschnett Oct 30, 2024
6d37335
Loop: New macro CCTK_KERNEL
eschnett Oct 30, 2024
3173c89
CI: Update Docker images
eschnett Oct 30, 2024
ecf3fcc
FluxWaveToyX: Correct RHS handling after ODESolver update
eschnett Nov 1, 2024
7fcb4b8
SIMDWaveToyX: Correct RHS handling after ODESolver update
eschnett Nov 1, 2024
7f1f5c7
WaveToyX: Correct RHS handling after ODESolver update
eschnett Nov 1, 2024
5ae5949
StaggeredWaveToyX: Correct RHS handling after ODESolver update
eschnett Nov 1, 2024
c8792a0
CI: Update Docker images to AMReX 24.11
eschnett Nov 1, 2024
472ac7d
FluxWaveToyX: Correct schedule and test output
eschnett Nov 1, 2024
88ef4ee
TestODESolvers: Correct schedule
eschnett Nov 1, 2024
397ba23
TestProlongate: Remove unsupporte 1st-order ENO operators
eschnett Nov 1, 2024
9dafbff
Merge pull request #312 from EinsteinToolkit/gramx
eschnett Nov 1, 2024
1b83a21
CarpetX: only use BLOSC2 if compiled into ADIOS2 (#314)
rhaas80 Nov 2, 2024
26d4d11
CarpetX: Reduce termination condition
eschnett Nov 4, 2024
9ebe597
CarpetX: Correct error check in interpolator
eschnett Nov 4, 2024
974e895
CarpetX: Simplify error output in interpolator
eschnett Nov 4, 2024
84f8e22
CarpetX: Slight performance improvement in interpolator
eschnett Nov 4, 2024
e2bb1fd
CarpetX: Improve safety/reduce warnings in interpolator
eschnett Nov 4, 2024
d56c7d4
TestInterpolate: Test cell-centred interpolation
eschnett Nov 4, 2024
81e426f
Loop: explicitly create function args to avoid compiler issue
rhaas80 Nov 7, 2024
a5ef84c
CarpetX: remove blosc compression from OpenPMD string options
rhaas80 Nov 11, 2024
7c28c8b
CarpetX: disable BLOSC in runtime options if ADIOS2 does not support it
eschnett Nov 15, 2024
4844efa
Revert "CarpetX: remove blosc compression from OpenPMD string options…
rhaas80 Nov 26, 2024
c73b2b2
CI: Update Docker images
eschnett Dec 23, 2024
90d0c66
Arith: Correct rten::fmap_
eschnett Dec 23, 2024
c55f50d
CI: Update Dockerfiles
eschnett Dec 23, 2024
1dd6806
CI: Update oneapi compiler paths
eschnett Dec 23, 2024
9f0af9a
CI: Use production Docker images
eschnett Dec 23, 2024
145a8ad
Merge pull request #327 from EinsteinToolkit/eschnett/docker-amrex-up…
eschnett Dec 23, 2024
cda60ba
Derivs: add support for 6th and 8th order accurate finite difference
lwJi Sep 8, 2024
2d169e8
TestDerivs: add unit test for finite difference, dissipation, upwind …
lwJi Sep 8, 2024
8791c63
TestDerivs: remove usage of funciton pointer
lwJi Oct 28, 2024
457a4ea
TestDerivs: beautify interface.ccl and test.cxx
lwJi Oct 28, 2024
ad15372
Merge pull request #307 from EinsteinToolkit/lwji/derivs
lwJi Dec 25, 2024
0fc9d27
Merge branch 'main' into merge_main
lwJi Dec 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Arith/src/rten.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public:
template <typename F, typename... Args>
friend constexpr ARITH_INLINE ARITH_DEVICE ARITH_HOST void
fmap_(const F &f, const rten &x, const rten<Args, D> &...args) {
fmap_(f, x.args, args.elts...);
fmap_(f, x.elts, args.elts...);
}

template <
Expand Down
41 changes: 17 additions & 24 deletions Derivs/src/derivs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ calc_derivs(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 2 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<2>(gf0, mask1, p.I, dx);
Expand All @@ -98,9 +97,8 @@ calc_derivs(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 4 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<4>(gf0, mask1, p.I, dx);
Expand All @@ -114,9 +112,8 @@ calc_derivs(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 6 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<6>(gf0, mask1, p.I, dx);
Expand All @@ -130,9 +127,8 @@ calc_derivs(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 8 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<8>(gf0, mask1, p.I, dx);
Expand Down Expand Up @@ -214,9 +210,8 @@ calc_derivs2(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 2 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<2>(gf0, mask1, p.I, dx);
Expand All @@ -232,9 +227,8 @@ calc_derivs2(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 4 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<4>(gf0, mask1, p.I, dx);
Expand All @@ -250,9 +244,8 @@ calc_derivs2(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 6 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<6>(gf0, mask1, p.I, dx);
Expand All @@ -268,9 +261,8 @@ calc_derivs2(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
grid.nghostzones,
[=] CCTK_DEVICE(const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
// Take account of ghost points
const vbool mask1 =
mask_for_loop_tail<vbool>(p.i, p.imax + deriv_order / 2);
// Take ghost points into account
const vbool mask1 = mask_for_loop_tail<vbool>(p.i, p.imax + 8 / 2);
const GF3D5index index(layout, p.I);
const auto val = gf0(mask, p.I);
const auto dval = calc_deriv<8>(gf0, mask1, p.I, dx);
Expand Down Expand Up @@ -328,6 +320,7 @@ template void calc_copy<0, 0, 0>(const smat<GF3D5<T>, dim> &gf,
const GF3D5layout layout,
const GridDescBaseDevice &grid,
const smat<GF3D2<const T>, dim> &gf0);

template void calc_copy<0, 0, 0>(const vec<vec<GF3D5<T>, dim>, dim> &gf,
const GF3D5layout layout,
const GridDescBaseDevice &grid,
Expand Down
2 changes: 1 addition & 1 deletion TestDerivs/interface.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CCTK_REAL chi_diss TYPE=gf CENTERING={VVV} TAGS='checkpoint="no"' "dissipation t
CCTK_REAL beta TYPE=gf CENTERING={VVV}
{
betax, betay, betaz
}"velocity function used for calculating upwind term"
} "velocity function used for calculating upwind term"

CCTK_REAL chi_upwind TYPE=gf CENTERING={VVV} TAGS='checkpoint="no"' "upwind term"

Expand Down
125 changes: 76 additions & 49 deletions TestDerivs/src/test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ template <typename T>
constexpr void poly_derivs(const T kxx, const T kxy, const T kyz, const T x,
const T y, const T z, Arith::vec<T, dim> &du,
Arith::smat<T, dim> &ddu) {
const T sinx = std::sin(x);
const T siny = std::sin(y);
const T sinz = std::sin(z);
const T cosx = std::cos(x);
const T cosy = std::cos(y);
const T cosz = std::cos(z);
using std::sin, std::cos, std::sqrt;
const T sinx = sin(x);
const T siny = sin(y);
const T sinz = sin(z);
const T cosx = cos(x);
const T cosy = cos(y);
const T cosz = cos(z);
du(0) = -2 * kxx * cosx * sinx - kxy * sinx * siny;
du(1) = kxy * cosx * cosy + kyz * cosy * sinz;
du(2) = kyz * cosz * siny;
Expand All @@ -43,21 +44,22 @@ constexpr void poly_derivs(const T kxx, const T kxy, const T kyz, const T x,

template <typename T>
constexpr Arith::vec<T, dim> beta_profile(const T x, const T y, const T z) {
const T vx = 1 * std::sin(x);
const T vy = 2 * std::sin(y);
const T vz = 3 * std::sin(z);
const T norm = std::sqrt(vx * vx + vy * vy + vz * vz);
const T vx = 1 * sin(x);
const T vy = 2 * sin(y);
const T vz = 3 * sin(z);
const T norm = sqrt(vx * vx + vy * vy + vz * vz);
return Arith::vec<T, dim>({vx / norm, vy / norm, vy / norm});
}

template <typename T>
constexpr T poly_diss(const T kxx, const T kxy, const T kyz, const T x,
const T y, const T z, const int diss_order,
const Arith::vect<T, dim> &dx) {
const T sinx = std::sin(x);
const T siny = std::sin(y);
const T sinz = std::sin(z);
const T cosx = std::cos(x);
using std::sin, std::cos, std::fabs;
const T sinx = sin(x);
const T siny = sin(y);
const T sinz = sin(z);
const T cosx = cos(x);
int coeff = 0;

switch (diss_order) {
Expand All @@ -77,7 +79,7 @@ constexpr T poly_diss(const T kxx, const T kxy, const T kyz, const T x,
assert(0);
}

const int abc = std::abs(coeff);
const int abc = fabs(coeff);
const int sig = (abc == coeff) ? 1 : -1;
return sig * ((abc * kxx * cosx * cosx - abc * kxx * sinx * sinx +
kxy * cosx * siny) /
Expand All @@ -104,6 +106,7 @@ extern "C" void TestDerivs_Set(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTSX_TestDerivs_Set;
DECLARE_CCTK_PARAMETERS;

using std::sin;
using vreal = Arith::simd<CCTK_REAL>;
using vbool = Arith::simdl<CCTK_REAL>;
constexpr std::size_t vsize = std::tuple_size_v<vreal>;
Expand All @@ -115,9 +118,7 @@ extern "C" void TestDerivs_Set(CCTK_ARGUMENTS) {
const vreal x0 = p.x + Arith::iota<vreal>() * p.dx;
const CCTK_REAL y0 = p.y;
const CCTK_REAL z0 = p.z;
chi.store(
mask, p.I,
poly(kxx, kxy, kyz, cos(x0), std::sin(y0), std::sin(z0)));
chi.store(mask, p.I, poly(kxx, kxy, kyz, cos(x0), sin(y0), sin(z0)));
});

grid.loop_int_device<0, 0, 0>(
Expand Down Expand Up @@ -200,52 +201,79 @@ extern "C" void TestDerivs_CalcDerivs(CCTK_ARGUMENTS) {
typedef Arith::simdl<CCTK_REAL> vbool;
constexpr size_t vsize = std::tuple_size_v<vreal>;

vreal (*calc_deriv_upwind)(const GF3D2<const CCTK_REAL> &, const vbool &,
const Arith::vect<int, dim> &,
const Arith::vect<CCTK_REAL, dim> &,
const Arith::vec<vreal, dim> &);
vreal (*calc_diss)(const GF3D2<const CCTK_REAL> &, const vbool &,
const Arith::vect<int, dim> &,
const Arith::vect<CCTK_REAL, dim> &);

switch (deriv_order) {
case 2: {
calc_deriv_upwind = &Derivs::calc_deriv_upwind<2>;
calc_diss = &Derivs::calc_diss<2>;
grid.loop_int_device<0, 0, 0, vsize>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
const vbool mask = Arith::mask_for_loop_tail<vbool>(p.i, p.imax);
const GF3D2index index2(layout2, p.I);
const GF3D5index index5(layout5, p.I);
gf_dchi.store(mask, index2, t5_dchi(mask, index5));
gf_ddchi.store(mask, index2, t5_ddchi(mask, index5));
gf_chi_diss.store(mask, index2,
Derivs::calc_diss<2>(gf2_chi, mask, p.I, dx));
gf_chi_upwind.store(
mask, index2,
Derivs::calc_deriv_upwind<2>(gf2_chi, mask, p.I, dx,
gf_beta(mask, index2)));
});
break;
}
case 4: {
calc_deriv_upwind = &Derivs::calc_deriv_upwind<4>;
calc_diss = &Derivs::calc_diss<4>;
grid.loop_int_device<0, 0, 0, vsize>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
const vbool mask = Arith::mask_for_loop_tail<vbool>(p.i, p.imax);
const GF3D2index index2(layout2, p.I);
const GF3D5index index5(layout5, p.I);
gf_dchi.store(mask, index2, t5_dchi(mask, index5));
gf_ddchi.store(mask, index2, t5_ddchi(mask, index5));
gf_chi_diss.store(mask, index2,
Derivs::calc_diss<4>(gf2_chi, mask, p.I, dx));
gf_chi_upwind.store(
mask, index2,
Derivs::calc_deriv_upwind<4>(gf2_chi, mask, p.I, dx,
gf_beta(mask, index2)));
});
break;
}
case 6: {
calc_deriv_upwind = &Derivs::calc_deriv_upwind<6>;
calc_diss = &Derivs::calc_diss<6>;
grid.loop_int_device<0, 0, 0, vsize>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
const vbool mask = Arith::mask_for_loop_tail<vbool>(p.i, p.imax);
const GF3D2index index2(layout2, p.I);
const GF3D5index index5(layout5, p.I);
gf_dchi.store(mask, index2, t5_dchi(mask, index5));
gf_ddchi.store(mask, index2, t5_ddchi(mask, index5));
gf_chi_diss.store(mask, index2,
Derivs::calc_diss<6>(gf2_chi, mask, p.I, dx));
gf_chi_upwind.store(
mask, index2,
Derivs::calc_deriv_upwind<6>(gf2_chi, mask, p.I, dx,
gf_beta(mask, index2)));
});
break;
}
case 8: {
calc_deriv_upwind = &Derivs::calc_deriv_upwind<8>;
calc_diss = &Derivs::calc_diss<8>;
grid.loop_int_device<0, 0, 0, vsize>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
const vbool mask = Arith::mask_for_loop_tail<vbool>(p.i, p.imax);
const GF3D2index index2(layout2, p.I);
const GF3D5index index5(layout5, p.I);
gf_dchi.store(mask, index2, t5_dchi(mask, index5));
gf_ddchi.store(mask, index2, t5_ddchi(mask, index5));
gf_chi_diss.store(mask, index2,
Derivs::calc_diss<8>(gf2_chi, mask, p.I, dx));
gf_chi_upwind.store(
mask, index2,
Derivs::calc_deriv_upwind<8>(gf2_chi, mask, p.I, dx,
gf_beta(mask, index2)));
});
break;
}
default:
assert(0);
}

grid.loop_int_device<0, 0, 0, vsize>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
const vbool mask = Arith::mask_for_loop_tail<vbool>(p.i, p.imax);
const GF3D2index index2(layout2, p.I);
const GF3D5index index5(layout5, p.I);
gf_dchi.store(mask, index2, t5_dchi(mask, index5));
gf_ddchi.store(mask, index2, t5_ddchi(mask, index5));
gf_chi_diss.store(mask, index2, calc_diss(gf2_chi, mask, p.I, dx));
gf_chi_upwind.store(
mask, index2,
calc_deriv_upwind(gf2_chi, mask, p.I, dx, gf_beta(mask, index2)));
});

#if CCTK_DEBUG
grid.loop_int_device<0, 0, 0>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
Expand Down Expand Up @@ -308,8 +336,7 @@ extern "C" void TestDerivs_CalcError(CCTK_ARGUMENTS) {

const int diss_order = deriv_order + 2;
const CCTK_REAL diss =
Arith::pown(-1, diss_order / 2.0 - 1.0) /
Arith::pown(2, diss_order) *
Arith::pown(-1, diss_order / 2 - 1) / Arith::pown(2, diss_order) *
poly_diss(kxx, kxy, kyz, p.x, p.y, p.z, diss_order, dx);
chi_diss_error(p.I) = diss - chi_diss(p.I);

Expand Down
Loading
Loading