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

New Loop Defaults #188

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions Arith/src/simd.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1361,4 +1361,9 @@ template <typename T> struct one<simdl<T> > {
};
} // namespace Arith

// Put these three things into the fake Cactus namespace
using CCTK_BOOLVEC = Arith::simdl<CCTK_REAL>;
using CCTK_REALVEC = Arith::simd<CCTK_REAL>;
constexpr std::size_t CCTK_VECSIZE = std::tuple_size_v<CCTK_REALVEC>;

#endif // #ifndef CARPETX_ARITH_SIMD_HXX
15 changes: 9 additions & 6 deletions Loop/src/loop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ struct PointDesc {
int i, j, k; // grid point
CCTK_REAL x, y, z; // grid point coordinates
CCTK_REAL dx, dy, dz; // grid spacing
CCTK_BOOLVEC mask; // mask for grid loop

PointDesc() = delete;
PointDesc(const PointDesc &) = default;
Expand All @@ -100,7 +101,9 @@ struct PointDesc {
: I(I), iter(iter), NI(NI), I0(I0), BI(BI), bnd_min(bnd_min),
bnd_max(bnd_max), loop_min(loop_min), loop_max(loop_max), X(X), DX(DX),
imin(loop_min[0]), imax(loop_max[0]), i(I[0]), j(I[1]), k(I[2]),
x(X[0]), y(X[1]), z(X[2]), dx(DX[0]), dy(DX[1]), dz(DX[2]) {}
x(X[0]), y(X[1]), z(X[2]), dx(DX[0]), dy(DX[1]), dz(DX[2]), mask() {
mask = Arith::mask_for_loop_tail<CCTK_BOOLVEC>(I[0], loop_max[0]);
}

friend std::ostream &operator<<(std::ostream &os, const PointDesc &p);
};
Expand Down Expand Up @@ -131,7 +134,7 @@ public:

GridDescBase(const cGH *cctkGH);

constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE CCTK_DEVICE CCTK_HOST PointDesc
CCTK_ATTRIBUTE_ALWAYS_INLINE CCTK_DEVICE CCTK_HOST PointDesc
point_desc(const vect<bool, dim> &CI, const vect<int, dim> &I, const int iter,
const vect<int, dim> &NI, const vect<int, dim> &I0,
const vect<int, dim> &BI, const vect<int, dim> &bnd_min,
Expand Down Expand Up @@ -1385,17 +1388,17 @@ public:

#define CCTK_CENTERING_LAYOUT(L, V) \
constexpr Arith::vect<int, Loop::dim> L##_centered V; \
const Loop::GF3D5layout L##gf_layout(cctkGH, L##_centered)
const Loop::GF3D5layout cctk_layout_##L(cctkGH, L##_centered)
#define CCTK_CENTERING_GF(C, L, N) \
const Loop::GF3D5<C CCTK_REAL> N(L##gf_layout, cctk_ptr_##N)
const Loop::GF3D5<C CCTK_REAL> N(cctk_layout_##L, cctk_ptr_##N)

#else

#define CCTK_CENTERING_LAYOUT(L, V) \
constexpr Arith::vect<int, Loop::dim> L##_centered V; \
const Loop::GF3D2layout L##gf_layout(cctkGH, L##_centered)
const Loop::GF3D2layout cctk_layout_##L(cctkGH, L##_centered)
#define CCTK_CENTERING_GF(C, L, N) \
const Loop::GF3D2<C CCTK_REAL> N(L##gf_layout, cctk_ptr_##N)
const Loop::GF3D2<C CCTK_REAL> N(cctk_layout_##L, cctk_ptr_##N)

#endif

Expand Down