Skip to content

Commit

Permalink
Synchronize DDC
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Jan 18, 2024
1 parent fd97369 commit 31cac54
Show file tree
Hide file tree
Showing 23 changed files with 2,187 additions and 118 deletions.
2 changes: 1 addition & 1 deletion src/interpolation/spline_interpolator_batched.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SplineInterpolatorBatched : public IInterpolatorBatched<DDimI, DDim...>
derivs_max = ddc::CDSpan1D(m_derivs_max_alloc.data(), m_derivs_max_alloc.size());
}
// m_builder(m_coefs.span_view(), inout_data, derivs_min, derivs_max);
m_builder(m_coefs.span_view(), inout_data);
m_builder(m_coefs.span_view(), inout_data.span_cview());
m_evaluator(inout_data, coordinates, m_coefs.span_cview());
return inout_data;
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/benchmarks/splines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static void characteristics_advection(benchmark::State& state)
});
Kokkos::Profiling::popRegion();
Kokkos::Profiling::pushRegion("SplineBuilder");
spline_builder(coef, density);
spline_builder(coef, density.span_cview());
Kokkos::Profiling::popRegion();
Kokkos::Profiling::pushRegion("SplineEvaluator");
spline_evaluator(density, feet_coords.span_cview(), coef.span_cview());
Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/examples/characteristics_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int main(int argc, char** argv)
vx * ddc::step<DDimT>());
});
// Interpolate the values at feets on the grid
spline_builder(coef, last_density);
spline_builder(coef, last_density.span_cview());
spline_evaluator(
next_density,
feet_coords.span_cview(),
Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/include/ddc/chunk_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inline constexpr bool is_writable_chunk_v
* @return the domain of view in the queried dimensions
*/
template <class... QueryDDims, class ChunkType>
auto get_domain(ChunkType const& chunk) noexcept
KOKKOS_FUNCTION auto get_domain(ChunkType const& chunk) noexcept
{
static_assert(is_chunk_v<ChunkType>, "Not a chunk span type");
return chunk.template domain<QueryDDims...>();
Expand Down
3 changes: 3 additions & 0 deletions vendor/ddc/include/ddc/kernels/splines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "splines/bspline.hpp"
#include "splines/bsplines_non_uniform.hpp"
#include "splines/bsplines_uniform.hpp"
#include "splines/deriv.hpp"
#include "splines/greville_interpolation_points.hpp"
#include "splines/knots_as_interpolation_points.hpp"
#include "splines/math_tools.hpp"
Expand All @@ -13,7 +14,9 @@
#include "splines/spline_boundary_conditions.hpp"
#include "splines/spline_boundary_value.hpp"
#include "splines/spline_builder.hpp"
#include "splines/spline_builder_2d_batched.hpp"
#include "splines/spline_builder_batched.hpp"
#include "splines/spline_evaluator.hpp"
#include "splines/spline_evaluator_2d_batched.hpp"
#include "splines/spline_evaluator_batched.hpp"
#include "splines/view.hpp"
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,10 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<NonUniformBSplines<Tag, D>> NonUnifo
d += a(k, s2) * ndu(pk, r);
}
derivs(r, k) = d;
std::swap(s1, s2);
// swap s1 <-> s2;
auto tmp = s1;
s1 = s2;
s2 = tmp;
}
}

Expand Down
5 changes: 4 additions & 1 deletion vendor/ddc/include/ddc/kernels/splines/bsplines_uniform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<UniformBSplines<Tag, D>> UniformBSpl
d += a(k, s2) * ndu(pk, r);
}
derivs(r, k) = d;
std::swap(s1, s2);
// swap s1 <-> s2
auto tmp = s1;
s1 = s2;
s2 = tmp;
}
}

Expand Down
10 changes: 10 additions & 0 deletions vendor/ddc/include/ddc/kernels/splines/deriv.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

namespace ddc {

template <class Tag>
struct Deriv
{
};

} // namespace ddc
2 changes: 1 addition & 1 deletion vendor/ddc/include/ddc/kernels/splines/matrix_sparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Matrix_Sparse : public Matrix
std::shared_ptr const gko_exec = m_matrix_sparse->get_executor();
// Create the solver factory
std::shared_ptr const residual_criterion
= gko::stop::ResidualNorm<double>::build().with_reduction_factor(1e-20).on(
= gko::stop::ResidualNorm<double>::build().with_reduction_factor(1e-19).on(
gko_exec);

std::shared_ptr const iterations_criterion
Expand Down
9 changes: 7 additions & 2 deletions vendor/ddc/include/ddc/kernels/splines/spline_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class SplineBuilder
template <class Layout>
void operator()(
ddc::ChunkSpan<double, ddc::DiscreteDomain<bsplines_type>, Layout, MemorySpace> spline,
ddc::ChunkSpan<double, interpolation_domain_type, Layout, MemorySpace> vals,
ddc::ChunkSpan<double const, interpolation_domain_type, Layout, MemorySpace> vals,
std::optional<ddc::CDSpan1D> const derivs_xmin = std::nullopt,
std::optional<ddc::CDSpan1D> const derivs_xmax = std::nullopt) const;

Expand All @@ -137,6 +137,11 @@ class SplineBuilder
return m_interpolation_domain;
}

double dx() const noexcept
{
return m_dx;
}

int offset() const noexcept
{
return m_offset;
Expand Down Expand Up @@ -271,7 +276,7 @@ void SplineBuilder<
Solver>::
operator()(
ddc::ChunkSpan<double, ddc::DiscreteDomain<bsplines_type>, Layout, MemorySpace> spline,
ddc::ChunkSpan<double, interpolation_domain_type, Layout, MemorySpace> vals,
ddc::ChunkSpan<double const, interpolation_domain_type, Layout, MemorySpace> vals,
[[maybe_unused]] std::optional<ddc::CDSpan1D> const derivs_xmin,
[[maybe_unused]] std::optional<ddc::CDSpan1D> const derivs_xmax) const
{
Expand Down
Loading

0 comments on commit 31cac54

Please sign in to comment.