Skip to content

Commit

Permalink
Update DDC
Browse files Browse the repository at this point in the history
Update DDC and make aesthetic changes to remove deprecated syntax
  • Loading branch information
EmilyBourne committed Feb 12, 2024
1 parent 9ecda87 commit 0cb59ee
Show file tree
Hide file tree
Showing 56 changed files with 1,676 additions and 1,202 deletions.
9 changes: 5 additions & 4 deletions simulations/geometryXVx/sheath/sheath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <vector>

#include <ddc/ddc.hpp>
#include <ddc/kernels/splines/periodic_extrapolation_rule.hpp>

#include <sll/constant_extrapolation_boundary_value.hpp>
#include <sll/spline_evaluator.hpp>
Expand Down Expand Up @@ -200,14 +201,14 @@ int main(int argc, char** argv)

NullBoundaryValue<BSplinesX> bv_x_min_poisson = g_null_boundary<BSplinesX>;
NullBoundaryValue<BSplinesX> bv_x_max_poisson = g_null_boundary<BSplinesX>;
ddc::NullBoundaryValue<ddcBSplinesX> bv_x_min = ddc::g_null_boundary<ddcBSplinesX>;
ddc::NullBoundaryValue<ddcBSplinesX> bv_x_max = ddc::g_null_boundary<ddcBSplinesX>;

// Creating batched operators
SplineXEvaluator const spline_x_evaluator(bv_x_min_poisson, bv_x_max_poisson);
#ifdef PERIODIC_RDIMX
SplineXEvaluatorBatched const
spline_x_evaluator_batched(builder_x_batched.spline_domain(), bv_x_min, bv_x_max);
SplineXEvaluatorBatched const spline_x_evaluator_batched(
builder_x_batched.spline_domain(),
ddc::PeriodicExtrapolationRule<RDimX>(),
ddc::PeriodicExtrapolationRule<RDimX>());
PreallocatableSplineInterpolatorBatched const
spline_x_interpolator(builder_x_batched, spline_x_evaluator_batched);
#else
Expand Down
29 changes: 15 additions & 14 deletions src/geometryXVx/geometry/geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,23 @@ using SplineXBuilder = SplineBuilder<BSplinesX, IDimX, SplineXBoundary, SplineXB
using SplineXEvaluator = SplineEvaluator<BSplinesX>;
using SplineVxEvaluator = SplineEvaluator<BSplinesVx>;
#ifdef PERIODIC_RDIMX
using SplineXBuilderBatched = ddc::SplineBuilderBatched<
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
ddcBSplinesX,
IDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC>,
using SplineXBuilderBatched = ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
ddcBSplinesX,
IDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC,
ddc::SplineSolver::GINKGO,
IDimX,
IDimVx>;
using SplineXEvaluatorBatched = ddc::SplineEvaluatorBatched<
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
ddcBSplinesX,
IDimX>,
using SplineXEvaluatorBatched = ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
ddcBSplinesX,
IDimX,
ddc::PeriodicExtrapolationRule<RDimX>,
ddc::PeriodicExtrapolationRule<RDimX>,
IDimX,
IDimVx>;
#endif
Expand Down
76 changes: 44 additions & 32 deletions src/interpolation/spline_interpolator_batched.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

// TODO: create splines.hpp
#include <ddc/kernels/splines/spline_builder.hpp>
#include <ddc/kernels/splines/spline_builder_batched.hpp>
#include <ddc/kernels/splines/spline_evaluator.hpp>
#include <ddc/kernels/splines/spline_evaluator_batched.hpp>

/**
* @brief A class for interpolating a function using splines.
Expand All @@ -25,21 +23,28 @@
template <class DDimI, class BSplines, ddc::BoundCond BcMin, ddc::BoundCond BcMax, class... DDim>
class SplineInterpolatorBatched : public IInterpolatorBatched<DDimI, DDim...>
{
using BuilderType = ddc::SplineBuilderBatched<
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI,
BcMin,
BcMax>,
using BuilderType = ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI,
BcMin,
BcMax,
ddc::SplineSolver::GINKGO,
DDim...>;
using EvaluatorType = ddc::SplineEvaluatorBatched<
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI>,
using EvaluatorType = ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI,
std::conditional_t<
DDimI::continuous_dimension_type::PERIODIC,
ddc::PeriodicExtrapolationRule<typename DDimI::continuous_dimension_type>,
ddc::ConstantExtrapolationRule<typename DDimI::continuous_dimension_type>>,
std::conditional_t<
DDimI::continuous_dimension_type::PERIODIC,
ddc::PeriodicExtrapolationRule<typename DDimI::continuous_dimension_type>,
ddc::ConstantExtrapolationRule<typename DDimI::continuous_dimension_type>>,
DDim...>;

private:
Expand All @@ -65,8 +70,8 @@ class SplineInterpolatorBatched : public IInterpolatorBatched<DDimI, DDim...>
: m_builder(builder)
, m_evaluator(evaluator)
, m_coefs(builder.spline_domain())
, m_derivs_min_alloc(BuilderType::builder_type::s_nbe_xmin, 0.)
, m_derivs_max_alloc(BuilderType::builder_type::s_nbe_xmax, 0.)
, m_derivs_min_alloc(BuilderType::s_nbe_xmin, 0.)
, m_derivs_max_alloc(BuilderType::s_nbe_xmax, 0.)
{
}

Expand Down Expand Up @@ -104,21 +109,28 @@ template <class DDimI, class BSplines, ddc::BoundCond BcMin, ddc::BoundCond BcMa
class PreallocatableSplineInterpolatorBatched
: public IPreallocatableInterpolatorBatched<DDimI, DDim...>
{
using BuilderType = ddc::SplineBuilderBatched<
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI,
BcMin,
BcMax>,
using BuilderType = ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI,
BcMin,
BcMax,
ddc::SplineSolver::GINKGO,
DDim...>;
using EvaluatorType = ddc::SplineEvaluatorBatched<
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI>,
using EvaluatorType = ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplines,
DDimI,
std::conditional_t<
DDimI::continuous_dimension_type::PERIODIC,
ddc::PeriodicExtrapolationRule<typename DDimI::continuous_dimension_type>,
ddc::ConstantExtrapolationRule<typename DDimI::continuous_dimension_type>>,
std::conditional_t<
DDimI::continuous_dimension_type::PERIODIC,
ddc::PeriodicExtrapolationRule<typename DDimI::continuous_dimension_type>,
ddc::ConstantExtrapolationRule<typename DDimI::continuous_dimension_type>>,
DDim...>;

BuilderType const& m_builder;
Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/.github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin || true
docker pull ghcr.io/cexa-project/ddc/doxygen || true
docker build \
DOCKER_BUILDKIT=1 docker build \
--cache-from ghcr.io/cexa-project/ddc/doxygen \
-t ghcr.io/cexa-project/ddc/doxygen \
-t ghcr.io/cexa-project/ddc/doxygen:${GITHUB_SHA:0:7} \
Expand Down
3 changes: 2 additions & 1 deletion vendor/ddc/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ jobs:
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin || true
docker pull ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} || true
docker build \
DOCKER_BUILDKIT=1 docker build \
--build-arg BACKEND=${{matrix.backend}} \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} \
-t ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} \
-t ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}}:${GITHUB_SHA:0:7} \
Expand Down
33 changes: 17 additions & 16 deletions vendor/ddc/benchmarks/splines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,29 +101,30 @@ static void characteristics_advection(benchmark::State& state)
density(ixy) = 9.999 * Kokkos::exp(-(x * x + y * y) / 0.1 / 2);
// initial_density(ixy) = 9.999 * ((x * x + y * y) < 0.25);
});
ddc::SplineBuilderBatched<
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC>,
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC,
ddc::SplineSolver::GINKGO,
DDimX,
DDimY>
spline_builder(x_mesh, state.range(2), state.range(3));
ddc::SplineEvaluatorBatched<
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX>,
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::PeriodicExtrapolationRule<X>,
ddc::PeriodicExtrapolationRule<X>,
DDimX,
DDimY>
spline_evaluator(
spline_builder.spline_domain(),
ddc::g_null_boundary<BSplinesX>,
ddc::g_null_boundary<BSplinesX>);
ddc::PeriodicExtrapolationRule<X>(),
ddc::PeriodicExtrapolationRule<X>());
ddc::Chunk coef_alloc(
spline_builder.spline_domain(),
ddc::KokkosAllocator<double, Kokkos::DefaultExecutionSpace::memory_space>());
Expand Down
33 changes: 17 additions & 16 deletions vendor/ddc/examples/characteristics_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,29 +202,30 @@ int main(int argc, char** argv)
//! [initial output]

//! [instantiate solver]
ddc::SplineBuilderBatched<
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC>,
ddc::SplineBuilder<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::BoundCond::PERIODIC,
ddc::BoundCond::PERIODIC,
ddc::SplineSolver::GINKGO,
DDimX,
DDimY>
spline_builder(x_mesh);
ddc::SplineEvaluatorBatched<
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX>,
ddc::SplineEvaluator<
Kokkos::DefaultExecutionSpace,
Kokkos::DefaultExecutionSpace::memory_space,
BSplinesX,
DDimX,
ddc::PeriodicExtrapolationRule<X>,
ddc::PeriodicExtrapolationRule<X>,
DDimX,
DDimY>
spline_evaluator(
spline_builder.spline_domain(),
ddc::g_null_boundary<BSplinesX>,
ddc::g_null_boundary<BSplinesX>);
ddc::PeriodicExtrapolationRule<X>(),
ddc::PeriodicExtrapolationRule<X>());
//! [instantiate solver]

//! [instantiate intermediate chunks]
Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/include/ddc/aligned_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#pragma once

#include <cstdint>
#include <cstddef>
#include <new>
#include <type_traits>

Expand Down
3 changes: 3 additions & 0 deletions vendor/ddc/include/ddc/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#pragma once

#include <string>
#include <utility>

#include <experimental/mdspan>

#include "ddc/chunk_common.hpp"
#include "ddc/chunk_span.hpp"
Expand Down
5 changes: 2 additions & 3 deletions vendor/ddc/include/ddc/chunk_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

#pragma once

#include <array>
#include <cassert>
#include <memory>
#include <type_traits>
#include <vector>
#include <utility>

#include <experimental/mdspan>

#include <Kokkos_Core.hpp>

#include "ddc/detail/kokkos.hpp"
#include "ddc/detail/macros.hpp"
#include "ddc/discrete_domain.hpp"

Expand Down
6 changes: 4 additions & 2 deletions vendor/ddc/include/ddc/chunk_span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

#pragma once

#include <array>
#include <cassert>
#include <memory>
#include <cstddef>
#include <type_traits>
#include <vector>
#include <utility>

#include <experimental/mdspan>

#include "ddc/chunk_common.hpp"
#include "ddc/detail/kokkos.hpp"
#include "ddc/discrete_domain.hpp"
#include "ddc/discrete_element.hpp"

Expand Down
3 changes: 2 additions & 1 deletion vendor/ddc/include/ddc/coordinate_md.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

#pragma once

#include <type_traits>

#include "ddc/coordinate.hpp"
#include "ddc/discrete_element.hpp"
#include "ddc/discrete_space.hpp"

namespace ddc {

Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/include/ddc/deepcopy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <Kokkos_Core.hpp>

#include "ddc/chunk_span.hpp"
#include "ddc/chunk_common.hpp"

namespace ddc {

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

#include <array>
#include <cstddef>
#include <type_traits>
#include <utility>

#include <experimental/mdspan>

#include <Kokkos_Core.hpp>
Expand Down
1 change: 1 addition & 0 deletions vendor/ddc/include/ddc/detail/tagged_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <array>
#include <cstddef>
#include <ostream>
#include <type_traits>
#include <utility>

#include "ddc/detail/macros.hpp"
Expand Down
1 change: 1 addition & 0 deletions vendor/ddc/include/ddc/detail/type_seq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <cstddef>
#include <limits>
#include <tuple>
#include <type_traits>
#include <utility>

Expand Down
Loading

0 comments on commit 0cb59ee

Please sign in to comment.