Skip to content

Commit

Permalink
Merge branch 'lapack-backend' of github.com:Maison-de-la-Simulation/d…
Browse files Browse the repository at this point in the history
…dc into lapack-backend
  • Loading branch information
blegouix committed Jun 28, 2024
2 parents 72fc3d6 + 26225f3 commit 5b56d56
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/ddc/kernels/fft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ void core(
}

Kokkos::parallel_for(
"ddc_fft_normalization",
Kokkos::RangePolicy<ExecSpace>(
execSpace,
0,
Expand Down
12 changes: 9 additions & 3 deletions include/ddc/kernels/splines/spline_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ operator()(
auto derivs_xmin_values = *derivs_xmin;
auto const dx_proxy = m_dx;
ddc::parallel_for_each(
"ddc_splines_hermite_compute_lower_coefficients",
exec_space(),
batch_domain(),
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type j) {
Expand All @@ -810,6 +811,7 @@ operator()(
auto const& interp_size_proxy = interpolation_domain().extents();
auto const& nbasis_proxy = ddc::discrete_space<bsplines_type>().nbasis();
ddc::parallel_for_each(
"ddc_splines_fill_rhs",
exec_space(),
batch_domain(),
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type j) {
Expand All @@ -830,6 +832,7 @@ operator()(
auto derivs_xmax_values = *derivs_xmax;
auto const dx_proxy = m_dx;
ddc::parallel_for_each(
"ddc_splines_hermite_compute_upper_coefficients",
exec_space(),
batch_domain(),
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type j) {
Expand All @@ -843,12 +846,13 @@ 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)
// Allocate and fill a transposed version of spline in order to get dimension of interest as last dimension (optimal for GPU, necessary for Ginkgo). Also select only relevant rows in case of periodic boundaries
ddc::Chunk spline_tr_alloc(
batched_spline_tr_domain(),
ddc::KokkosAllocator<double, memory_space>());
ddc::ChunkSpan spline_tr = spline_tr_alloc.span_view();
ddc::parallel_for_each(
"ddc_splines_transpose_rhs",
exec_space(),
batch_domain(),
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand All @@ -864,8 +868,9 @@ operator()(
batch_domain().size());
// Compute spline coef
matrix->solve(bcoef_section);
// Transpose back spline_tr in spline
// Transpose back spline_tr into spline.
ddc::parallel_for_each(
"ddc_splines_transpose_back_rhs",
exec_space(),
batch_domain(),
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand All @@ -875,9 +880,10 @@ operator()(
}
});

// Not sure yet of what this part do
// Duplicate the lower spline coefficients to the upper side in case of periodic boundaries
if (bsplines_type::is_periodic()) {
ddc::parallel_for_each(
"ddc_splines_periodic_rows_duplicate_rhs",
exec_space(),
batch_domain(),
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down
4 changes: 4 additions & 0 deletions include/ddc/kernels/splines/spline_evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class SplineEvaluator
batch_domain_type const batch_domain(spline_eval.domain());

ddc::parallel_for_each(
"ddc_splines_evaluate",
exec_space(),
batch_domain,
KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down Expand Up @@ -341,6 +342,7 @@ class SplineEvaluator
batch_domain_type const batch_domain(spline_eval.domain());

ddc::parallel_for_each(
"ddc_splines_differentiate",
exec_space(),
batch_domain,
KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down Expand Up @@ -379,10 +381,12 @@ class SplineEvaluator
ddc::KokkosAllocator<double, memory_space>());
ddc::ChunkSpan values = values_alloc.span_view();
Kokkos::parallel_for(
"ddc_splines_integrate_bsplines",
Kokkos::RangePolicy<exec_space>(0, 1),
KOKKOS_LAMBDA(int) { ddc::discrete_space<bsplines_type>().integrals(values); });

ddc::parallel_for_each(
"ddc_splines_integrate",
exec_space(),
batch_domain,
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down
6 changes: 6 additions & 0 deletions include/ddc/kernels/splines/spline_evaluator_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ class SplineEvaluator2D
evaluation_domain_type1 const evaluation_domain1(spline_eval.domain());
evaluation_domain_type2 const evaluation_domain2(spline_eval.domain());
ddc::parallel_for_each(
"ddc_splines_evaluate_2d",
exec_space(),
batch_domain,
KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down Expand Up @@ -559,6 +560,7 @@ class SplineEvaluator2D
evaluation_domain_type1 const evaluation_domain1(spline_eval.domain());
evaluation_domain_type2 const evaluation_domain2(spline_eval.domain());
ddc::parallel_for_each(
"ddc_splines_differentiate_2d_dim_1",
exec_space(),
batch_domain,
KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down Expand Up @@ -609,6 +611,7 @@ class SplineEvaluator2D
evaluation_domain_type1 const evaluation_domain1(spline_eval.domain());
evaluation_domain_type2 const evaluation_domain2(spline_eval.domain());
ddc::parallel_for_each(
"ddc_splines_differentiate_2d_dim_2",
exec_space(),
batch_domain,
KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down Expand Up @@ -659,6 +662,7 @@ class SplineEvaluator2D
evaluation_domain_type1 const evaluation_domain1(spline_eval.domain());
evaluation_domain_type2 const evaluation_domain2(spline_eval.domain());
ddc::parallel_for_each(
"ddc_splines_cross_differentiate",
exec_space(),
batch_domain,
KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down Expand Up @@ -804,13 +808,15 @@ class SplineEvaluator2D
ddc::KokkosAllocator<double, memory_space>());
ddc::ChunkSpan values2 = values2_alloc.span_view();
Kokkos::parallel_for(
"ddc_splines_integrate_bsplines_2d",
Kokkos::RangePolicy<exec_space>(0, 1),
KOKKOS_LAMBDA(int) {
ddc::discrete_space<bsplines_type1>().integrals(values1);
ddc::discrete_space<bsplines_type2>().integrals(values2);
});

ddc::parallel_for_each(
"ddc_splines_integrate_bsplines",
exec_space(),
batch_domain,
KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
Expand Down

0 comments on commit 5b56d56

Please sign in to comment.