From f60b990ce6d962b6bef64b1a3f00f04a2a0b666a Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 2 Apr 2024 19:58:08 +0200 Subject: [PATCH 1/7] init --- examples/characteristics_advection.cpp | 4 +- .../ddc/kernels/splines/spline_builder.hpp | 79 ++++---- .../ddc/kernels/splines/spline_builder_2d.hpp | 172 +++++++++++------- .../ddc/kernels/splines/spline_evaluator.hpp | 51 ++++-- .../kernels/splines/spline_evaluator_2d.hpp | 117 +++++++----- tests/splines/batched_2d_spline_builder.cpp | 2 +- tests/splines/batched_spline_builder.cpp | 2 +- tests/splines/extrapolation_rule.cpp | 2 +- tests/splines/periodicity_spline_builder.cpp | 2 +- 9 files changed, 262 insertions(+), 169 deletions(-) diff --git a/examples/characteristics_advection.cpp b/examples/characteristics_advection.cpp index e9a45d1f5..4e94b04fd 100644 --- a/examples/characteristics_advection.cpp +++ b/examples/characteristics_advection.cpp @@ -232,13 +232,13 @@ int main(int argc, char** argv) //! [instantiate intermediate chunks] // Instantiate chunk of spline coefs to receive output of spline_builder ddc::Chunk coef_alloc( - spline_builder.spline_domain(), + spline_builder.batched_spline_domain(), ddc::DeviceAllocator()); ddc::ChunkSpan coef = coef_alloc.span_view(); // Instantiate chunk to receive feet coords ddc::Chunk feet_coords_alloc( - spline_builder.vals_domain(), + spline_builder.batched_interpolation_domain(), ddc::DeviceAllocator>()); ddc::ChunkSpan feet_coords = feet_coords_alloc.span_view(); //! [instantiate intermediate chunks] diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 2d2b33a04..0d841d492 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -78,7 +78,7 @@ class SplineBuilder */ using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type, Tag>; - using spline_domain_type = + using batched_batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using spline_tr_domain_type = + using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::type_seq_remove_t< ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; - using derivs_domain_type = + using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -152,7 +152,7 @@ class SplineBuilder static constexpr ddc::BoundCond s_bc_xmax = BcXmax; private: - vals_domain_type m_vals_domain; + batched_interpolation_domain_type m_batched_interpolation_domain; int m_offset; @@ -165,10 +165,10 @@ class SplineBuilder int compute_offset(interpolation_domain_type const& interpolation_domain); explicit SplineBuilder( - vals_domain_type const& vals_domain, + batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_vals_domain(vals_domain) + : m_batched_interpolation_domain(batched_interpolation_domain) , m_offset(compute_offset(interpolation_domain())) , m_dx((ddc::discrete_space().rmax() - ddc::discrete_space().rmin()) / ddc::discrete_space().ncells()) @@ -212,9 +212,9 @@ class SplineBuilder */ SplineBuilder& operator=(SplineBuilder&& x) = default; - vals_domain_type vals_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return m_vals_domain; + return m_batched_interpolation_domain; } /** @@ -227,15 +227,15 @@ class SplineBuilder */ interpolation_domain_type interpolation_domain() const noexcept { - return interpolation_domain_type(vals_domain()); + return interpolation_domain_type(batched_interpolation_domain()); } batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(vals_domain(), interpolation_domain()); + return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } - ddc::DiscreteDomain bsplines_domain() const noexcept // TODO : clarify name + ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name { return ddc::discrete_space().full_domain(); } @@ -248,31 +248,31 @@ class SplineBuilder * * @return The domain for the splines. */ - spline_domain_type spline_domain() const noexcept + batched_batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of< interpolation_mesh_type, - bsplines_type>(vals_domain(), bsplines_domain()); + bsplines_type>(batched_interpolation_domain(), spline_domain()); } - spline_tr_domain_type spline_tr_domain() const noexcept + batched_spline_tr_domain_type spline_tr_domain() const noexcept { - return spline_tr_domain_type(bsplines_domain(), batch_domain()); + return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } - derivs_domain_type derivs_xmin_domain() const noexcept + batched_derivs_domain_type derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( - vals_domain(), + batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmin))); } - derivs_domain_type derivs_xmax_domain() const noexcept + batched_derivs_domain_type derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( - vals_domain(), + batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmax))); @@ -309,15 +309,20 @@ class SplineBuilder */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional< - ddc::ChunkSpan> const - derivs_xmin + ddc::ChunkSpan spline, + ddc::ChunkSpan + vals, + std::optional> const derivs_xmin = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_xmax + std::optional> const derivs_xmax = std::nullopt) const; private: @@ -629,12 +634,18 @@ void SplineBuilder< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const - derivs_xmin, - std::optional> const - derivs_xmax) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const derivs_xmin, + std::optional> const derivs_xmax) const { assert(vals.template extent() == ddc::discrete_space().nbasis() - s_nbe_xmin - s_nbe_xmax); diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 5d815527e..d4c9691e1 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -113,26 +113,26 @@ class SplineBuilder2D using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - using spline_domain_type + using batched_batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using derivs_domain_type1 = typename builder_type1::derivs_domain_type; - using derivs_domain_type2 + using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; + using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using derivs_domain_type + using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -147,24 +147,27 @@ class SplineBuilder2D /** * @brief Create a new SplineBuilder2D. * - * @param vals_domain + * @param batched_interpolation_domain * The 2D domain on which points will be provided in order to * create the 2D spline approximation. * @param cols_per_chunk The number of columns in the rhs passed to the underlying linear solver. * @param preconditionner_max_block_size The block size of in the block Jacobi preconditioner. */ explicit SplineBuilder2D( - vals_domain_type const& vals_domain, + batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_spline_builder1(vals_domain, cols_per_chunk, preconditionner_max_block_size) + : m_spline_builder1( + batched_interpolation_domain, + cols_per_chunk, + preconditionner_max_block_size) , m_spline_builder_deriv1(ddc::replace_dim_of( - m_spline_builder1.vals_domain(), + m_spline_builder1.batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(bsplines_type2::degree() / 2)))) , m_spline_builder2( - m_spline_builder1.spline_domain(), + m_spline_builder1.batched_spline_domain(), cols_per_chunk, preconditionner_max_block_size) { @@ -200,9 +203,9 @@ class SplineBuilder2D */ SplineBuilder2D& operator=(SplineBuilder2D&& x) = default; - vals_domain_type vals_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return m_spline_builder1.vals_domain(); + return m_spline_builder1.batched_interpolation_domain(); } /** @@ -222,7 +225,7 @@ class SplineBuilder2D batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(vals_domain(), interpolation_domain()); + return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } /** @@ -233,7 +236,7 @@ class SplineBuilder2D * * @return The 2D domain for the splines. */ - ddc::DiscreteDomain bsplines_domain() + ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name { return ddc::DiscreteDomain( @@ -241,13 +244,13 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } - spline_domain_type spline_domain() const noexcept + batched_batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of( ddc::replace_dim_of< interpolation_mesh_type2, - bsplines_type2>(vals_domain(), bsplines_domain()), - bsplines_domain()); + bsplines_type2>(batched_interpolation_domain(), spline_domain()), + spline_domain()); } /** @@ -288,39 +291,56 @@ class SplineBuilder2D */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional< - ddc::ChunkSpan> const - derivs_min1 + ddc::ChunkSpan spline, + ddc::ChunkSpan + vals, + std::optional> const derivs_min1 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_max1 + std::optional> const derivs_max1 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_min2 + std::optional> const derivs_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_max2 + std::optional> const derivs_max2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_min1_min2 + std::optional> const mixed_derivs_min1_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_max1_min2 + std::optional> const mixed_derivs_max1_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_min1_max2 + std::optional> const mixed_derivs_min1_max2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_max1_max2 + std::optional> const mixed_derivs_max1_max2 = std::nullopt) const; }; @@ -353,29 +373,53 @@ void SplineBuilder2D< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const - derivs_min1, - std::optional> const - derivs_max1, - std::optional> const - derivs_min2, - std::optional> const - derivs_max2, - std::optional> const - mixed_derivs_min1_min2, - std::optional> const - mixed_derivs_max1_min2, - std::optional> const - mixed_derivs_min1_max2, - std::optional> const - mixed_derivs_max1_max2) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const derivs_min1, + std::optional> const derivs_max1, + std::optional> const derivs_min2, + std::optional> const derivs_max2, + std::optional> const mixed_derivs_min1_min2, + std::optional> const mixed_derivs_max1_min2, + std::optional> const mixed_derivs_min1_max2, + std::optional> const mixed_derivs_max1_max2) const { // TODO: perform computations along dimension 1 on different streams ? // Spline1-transform derivs_min2 (to spline1_deriv_min) ddc::Chunk spline1_deriv_min_alloc( - m_spline_builder_deriv1.spline_domain(), + m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_min = spline1_deriv_min_alloc.span_view(); auto spline1_deriv_min_opt = std::optional(spline1_deriv_min.span_cview()); @@ -391,7 +435,7 @@ operator()( // Spline1-transform vals (to spline1) ddc::Chunk spline1_alloc( - m_spline_builder1.spline_domain(), + m_spline_builder1.batched_spline_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan spline1 = spline1_alloc.span_view(); @@ -399,7 +443,7 @@ operator()( // Spline1-transform derivs_max2 (to spline1_deriv_max) ddc::Chunk spline1_deriv_max_alloc( - m_spline_builder_deriv1.spline_domain(), + m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_max = spline1_deriv_max_alloc.span_view(); auto spline1_deriv_max_opt = std::optional(spline1_deriv_max.span_cview()); diff --git a/include/ddc/kernels/splines/spline_evaluator.hpp b/include/ddc/kernels/splines/spline_evaluator.hpp index fc5295c2d..dff77f8e7 100644 --- a/include/ddc/kernels/splines/spline_evaluator.hpp +++ b/include/ddc/kernels/splines/spline_evaluator.hpp @@ -49,9 +49,9 @@ class SplineEvaluator using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; - using bsplines_domain_type = ddc::DiscreteDomain; + using batched_spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type, Tag>; - using spline_domain_type = + using batched_batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -91,7 +91,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule::operator() has to be callable with usual arguments."); @@ -102,7 +102,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule::operator() has to be callable with usual arguments."); @@ -138,7 +138,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -146,14 +146,18 @@ class SplineEvaluator template void operator()( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -174,7 +178,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -182,14 +186,18 @@ class SplineEvaluator template void deriv( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -211,8 +219,11 @@ class SplineEvaluator template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout2, + memory_space> const spline_coef) const { batch_domain_type const batch_domain(integrals.domain()); ddc::Chunk values_alloc( @@ -228,7 +239,7 @@ class SplineEvaluator batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename bsplines_domain_type::discrete_element_type const i : + for (typename batched_spline_domain_type::discrete_element_type const i : values.domain()) { integrals(j) += spline_coef(i, j) * values(i); } @@ -239,7 +250,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { ddc::Coordinate @@ -269,7 +280,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( diff --git a/include/ddc/kernels/splines/spline_evaluator_2d.hpp b/include/ddc/kernels/splines/spline_evaluator_2d.hpp index 168ab7b08..30a3c3732 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -66,11 +66,11 @@ class SplineEvaluator2D using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; - using bsplines_domain_type1 = ddc::DiscreteDomain; - using bsplines_domain_type2 = ddc::DiscreteDomain; - using bsplines_domain_type = ddc::DiscreteDomain; + using batched_spline_domain_type1 = ddc::DiscreteDomain; + using batched_spline_domain_type2 = ddc::DiscreteDomain; + using batched_spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type2, Tag>>; - using spline_domain_type = + using batched_batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -124,7 +124,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule1::operator() has to be callable " @@ -136,7 +136,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule1::operator() has to be callable " @@ -148,7 +148,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule2::operator() has to be callable " @@ -160,7 +160,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule2::operator() has to be callable " @@ -271,7 +271,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -279,14 +279,18 @@ class SplineEvaluator2D template void operator()( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -319,7 +323,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_1( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -338,7 +342,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -357,7 +361,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_1_and_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -366,7 +370,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -389,7 +393,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -416,14 +420,18 @@ class SplineEvaluator2D */ template void deriv_dim_1( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -457,14 +465,18 @@ class SplineEvaluator2D */ template void deriv_dim_2( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -498,14 +510,18 @@ class SplineEvaluator2D */ template void deriv_1_and_2( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -529,14 +545,18 @@ class SplineEvaluator2D template void deriv( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { static_assert( std::is_same_v< @@ -563,14 +583,18 @@ class SplineEvaluator2D class Layout3, class... CoordsDims> void deriv2( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { static_assert( (std::is_same_v< @@ -594,8 +618,11 @@ class SplineEvaluator2D template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout2, + memory_space> const spline_coef) const { batch_domain_type batch_domain(integrals.domain()); ddc::Chunk values1_alloc( @@ -618,9 +645,9 @@ class SplineEvaluator2D batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename bsplines_domain_type1::discrete_element_type const i1 : + for (typename batched_spline_domain_type1::discrete_element_type const i1 : values1.domain()) { - for (typename bsplines_domain_type2::discrete_element_type const i2 : + for (typename batched_spline_domain_type2::discrete_element_type const i2 : values2.domain()) { integrals(j) += spline_coef(i1, i2, j) * values1(i1) * values2(i2); } @@ -651,7 +678,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { using Dim1 = typename interpolation_mesh_type1::continuous_dimension_type; @@ -720,7 +747,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( diff --git a/tests/splines/batched_2d_spline_builder.cpp b/tests/splines/batched_2d_spline_builder.cpp index 0f5de6cc8..17137e3b1 100644 --- a/tests/splines/batched_2d_spline_builder.cpp +++ b/tests/splines/batched_2d_spline_builder.cpp @@ -275,7 +275,7 @@ static void Batched2dSplineTest() // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) ddc::DiscreteDomain, IDim> const dom_interpolation = spline_builder.interpolation_domain(); - auto const dom_spline = spline_builder.spline_domain(); + auto const dom_spline = spline_builder.batched_spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( diff --git a/tests/splines/batched_spline_builder.cpp b/tests/splines/batched_spline_builder.cpp index 8eeb433b3..4070e263a 100644 --- a/tests/splines/batched_spline_builder.cpp +++ b/tests/splines/batched_spline_builder.cpp @@ -224,7 +224,7 @@ static void BatchedSplineTest() // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) ddc::DiscreteDomain> const dom_interpolation = spline_builder.interpolation_domain(); auto const dom_batch = spline_builder.batch_domain(); - auto const dom_spline = spline_builder.spline_domain(); + auto const dom_spline = spline_builder.batched_spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( diff --git a/tests/splines/extrapolation_rule.cpp b/tests/splines/extrapolation_rule.cpp index 864b51f76..fae128159 100644 --- a/tests/splines/extrapolation_rule.cpp +++ b/tests/splines/extrapolation_rule.cpp @@ -234,7 +234,7 @@ static void ExtrapolationRuleSplineTest() // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) ddc::DiscreteDomain, IDim> const dom_interpolation = spline_builder.interpolation_domain(); - auto const dom_spline = spline_builder.spline_domain(); + auto const dom_spline = spline_builder.batched_spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( diff --git a/tests/splines/periodicity_spline_builder.cpp b/tests/splines/periodicity_spline_builder.cpp index bed04565c..18c7b2b7c 100644 --- a/tests/splines/periodicity_spline_builder.cpp +++ b/tests/splines/periodicity_spline_builder.cpp @@ -139,7 +139,7 @@ static void PeriodicitySplineBuilderTest() spline_builder(dom_vals); // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) - ddc::DiscreteDomain> const dom_bsplines = spline_builder.bsplines_domain(); + ddc::DiscreteDomain> const dom_bsplines = spline_builder.spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( From 84a5ca710fc2cf863c247a66746ae4882b5d0bdd Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 3 Apr 2024 10:36:52 +0200 Subject: [PATCH 2/7] missing sed in benchmark --- benchmarks/splines.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/splines.cpp b/benchmarks/splines.cpp index f9f5b8cab..750c7425b 100644 --- a/benchmarks/splines.cpp +++ b/benchmarks/splines.cpp @@ -127,11 +127,11 @@ static void characteristics_advection(benchmark::State& state) DDimY> spline_evaluator(periodic_extrapolation, periodic_extrapolation); ddc::Chunk coef_alloc( - spline_builder.spline_domain(), + spline_builder.batched_spline_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan coef = coef_alloc.span_view(); ddc::Chunk feet_coords_alloc( - spline_builder.vals_domain(), + spline_builder.batched_interpolation_domain(), ddc::KokkosAllocator< ddc::Coordinate, Kokkos::DefaultExecutionSpace::memory_space>()); From 96d4fdb7e7e8082b9c5ad4d7954a5394c558e864 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 15 Apr 2024 17:41:53 +0200 Subject: [PATCH 3/7] fix --- .../ddc/kernels/splines/spline_builder.hpp | 8 +-- .../ddc/kernels/splines/spline_builder_2d.hpp | 8 +-- .../ddc/kernels/splines/spline_evaluator.hpp | 24 ++++----- .../kernels/splines/spline_evaluator_2d.hpp | 50 +++++++++---------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 0d841d492..72dcdda78 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -89,7 +89,7 @@ class SplineBuilder using spline_dim_type = std::conditional_t, bsplines_type, Tag>; - using batched_batched_spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -248,7 +248,7 @@ class SplineBuilder * * @return The domain for the splines. */ - batched_batched_spline_domain_type batched_spline_domain() const noexcept + batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of< interpolation_mesh_type, @@ -309,7 +309,7 @@ class SplineBuilder */ template void operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional:: operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional, ddc::detail::TypeSeq>>; - using batched_batched_spline_domain_type + using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -244,7 +244,7 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } - batched_batched_spline_domain_type batched_spline_domain() const noexcept + batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of( ddc::replace_dim_of< @@ -291,7 +291,7 @@ class SplineBuilder2D */ template void operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional:: operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional; - using batched_spline_domain_type = ddc::DiscreteDomain; + using spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type, Tag>; - using batched_batched_spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -91,7 +91,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule::operator() has to be callable with usual arguments."); @@ -102,7 +102,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule::operator() has to be callable with usual arguments."); @@ -138,7 +138,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -155,7 +155,7 @@ class SplineEvaluator memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -178,7 +178,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -195,7 +195,7 @@ class SplineEvaluator memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -221,7 +221,7 @@ class SplineEvaluator ddc::ChunkSpan const integrals, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout2, memory_space> const spline_coef) const { @@ -239,7 +239,7 @@ class SplineEvaluator batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename batched_spline_domain_type::discrete_element_type const i : + for (typename spline_domain_type::discrete_element_type const i : values.domain()) { integrals(j) += spline_coef(i, j) * values(i); } @@ -250,7 +250,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { ddc::Coordinate @@ -280,7 +280,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( diff --git a/include/ddc/kernels/splines/spline_evaluator_2d.hpp b/include/ddc/kernels/splines/spline_evaluator_2d.hpp index 30a3c3732..69457e190 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -68,9 +68,9 @@ class SplineEvaluator2D using batched_interpolation_domain_type = ddc::DiscreteDomain; - using batched_spline_domain_type1 = ddc::DiscreteDomain; - using batched_spline_domain_type2 = ddc::DiscreteDomain; - using batched_spline_domain_type = ddc::DiscreteDomain; + using spline_domain_type1 = ddc::DiscreteDomain; + using spline_domain_type2 = ddc::DiscreteDomain; + using spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type2, Tag>>; - using batched_batched_spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -124,7 +124,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule1::operator() has to be callable " @@ -136,7 +136,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule1::operator() has to be callable " @@ -148,7 +148,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule2::operator() has to be callable " @@ -160,7 +160,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule2::operator() has to be callable " @@ -271,7 +271,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -288,7 +288,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -323,7 +323,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_1( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -342,7 +342,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -361,7 +361,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_1_and_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -370,7 +370,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -393,7 +393,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -429,7 +429,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -474,7 +474,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -519,7 +519,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -554,7 +554,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -592,7 +592,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -620,7 +620,7 @@ class SplineEvaluator2D ddc::ChunkSpan const integrals, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout2, memory_space> const spline_coef) const { @@ -645,9 +645,9 @@ class SplineEvaluator2D batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename batched_spline_domain_type1::discrete_element_type const i1 : + for (typename spline_domain_type1::discrete_element_type const i1 : values1.domain()) { - for (typename batched_spline_domain_type2::discrete_element_type const i2 : + for (typename spline_domain_type2::discrete_element_type const i2 : values2.domain()) { integrals(j) += spline_coef(i1, i2, j) * values1(i1) * values2(i2); } @@ -678,7 +678,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { using Dim1 = typename interpolation_mesh_type1::continuous_dimension_type; @@ -747,7 +747,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( From 077807aa9b00ecf1f57c8fcdb38a1c713acab599 Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Mon, 15 Apr 2024 17:44:09 +0200 Subject: [PATCH 4/7] Update include/ddc/kernels/splines/spline_builder.hpp --- include/ddc/kernels/splines/spline_builder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 72dcdda78..d5cdc6593 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -235,7 +235,7 @@ class SplineBuilder return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } - ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name + ddc::DiscreteDomain spline_domain() const noexcept { return ddc::discrete_space().full_domain(); } From 653bab4d9e7e81a8f2e05eef18d7b10e8c78a6e9 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 15 Apr 2024 17:49:47 +0200 Subject: [PATCH 5/7] clang-format --- .../ddc/kernels/splines/spline_evaluator.hpp | 21 +++----- .../kernels/splines/spline_evaluator_2d.hpp | 49 ++++++------------- vendor/kokkos | 2 +- 3 files changed, 21 insertions(+), 51 deletions(-) diff --git a/include/ddc/kernels/splines/spline_evaluator.hpp b/include/ddc/kernels/splines/spline_evaluator.hpp index 8c56accee..70c578583 100644 --- a/include/ddc/kernels/splines/spline_evaluator.hpp +++ b/include/ddc/kernels/splines/spline_evaluator.hpp @@ -153,11 +153,8 @@ class SplineEvaluator batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -193,11 +190,8 @@ class SplineEvaluator batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -219,11 +213,8 @@ class SplineEvaluator template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout2, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type const batch_domain(integrals.domain()); ddc::Chunk values_alloc( diff --git a/include/ddc/kernels/splines/spline_evaluator_2d.hpp b/include/ddc/kernels/splines/spline_evaluator_2d.hpp index 69457e190..a8aac5c35 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -286,11 +286,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -427,11 +424,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -472,11 +466,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -517,11 +508,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -552,11 +540,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { static_assert( std::is_same_v< @@ -590,11 +575,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { static_assert( (std::is_same_v< @@ -618,11 +600,8 @@ class SplineEvaluator2D template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout2, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(integrals.domain()); ddc::Chunk values1_alloc( diff --git a/vendor/kokkos b/vendor/kokkos index 486cc745c..71a9bcae5 160000 --- a/vendor/kokkos +++ b/vendor/kokkos @@ -1 +1 @@ -Subproject commit 486cc745cb9a287f3915061455105a3ee588c616 +Subproject commit 71a9bcae52543bd065522bf3e41b5bfa467d8015 From 889b9f94f366433ac12bf73fcdaa90ea3bbb1905 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 16 Apr 2024 09:24:32 +0200 Subject: [PATCH 6/7] fix kokkos version change --- vendor/kokkos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/kokkos b/vendor/kokkos index 71a9bcae5..486cc745c 160000 --- a/vendor/kokkos +++ b/vendor/kokkos @@ -1 +1 @@ -Subproject commit 71a9bcae52543bd065522bf3e41b5bfa467d8015 +Subproject commit 486cc745cb9a287f3915061455105a3ee588c616 From 6ab4a97a4908a03909a5a1b42a58d6608d885ab8 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 16 Apr 2024 16:13:50 +0200 Subject: [PATCH 7/7] improve consistency --- include/ddc/kernels/splines/spline_builder.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 69717fb52..acb6a5a81 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -255,12 +255,12 @@ class SplineBuilder bsplines_type>(batched_interpolation_domain(), spline_domain()); } - batched_spline_tr_domain_type spline_tr_domain() const noexcept + batched_spline_tr_domain_type batched_spline_tr_domain() const noexcept { return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } - batched_derivs_domain_type derivs_xmin_domain() const noexcept + batched_derivs_domain_type batched_derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( batched_interpolation_domain(), @@ -269,7 +269,7 @@ class SplineBuilder ddc::DiscreteVector(s_nbc_xmin))); } - batched_derivs_domain_type derivs_xmax_domain() const noexcept + batched_derivs_domain_type batched_derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( batched_interpolation_domain(), @@ -729,7 +729,9 @@ operator()( // TODO : Consider optimizing // Allocate and fill a transposed version of spline in order to get dimension of interest as last dimension (optimal for GPU, necessary for Ginkgo) - ddc::Chunk spline_tr_alloc(spline_tr_domain(), ddc::KokkosAllocator()); + ddc::Chunk spline_tr_alloc( + batched_spline_tr_domain(), + ddc::KokkosAllocator()); ddc::ChunkSpan spline_tr = spline_tr_alloc.span_view(); ddc::parallel_for_each( exec_space(),