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

Remove batch information from class templates of SplineBuilder #668

Open
EmilyBourne opened this issue Oct 28, 2024 · 1 comment
Open

Remove batch information from class templates of SplineBuilder #668

EmilyBourne opened this issue Oct 28, 2024 · 1 comment
Labels

Comments

@EmilyBourne
Copy link
Collaborator

In the SplineBuilder the batch information is only used in the operator()
https://github.com/CExA-project/ddc/blob/main/include/ddc/kernels/splines/spline_builder.hpp#L401-L413

A SplineBuilder is a costly object to store and initialise as it contains a matrix. It seems unnecessary to have one instance of the (same) matrix for each different batch pattern that we want to use. Further it is very verbose. We often write the following:

using SplineXBuilder = ddc::SplineBuilder<
        Kokkos::DefaultExecutionSpace,
        Kokkos::DefaultExecutionSpace::memory_space,
        BSplinesX,
        GridX,
        SplineXBoundary,
        SplineXBoundary,
        ddc::SplineSolver::LAPACK,
        GridX,
        GridVx>;
using SplineXBuilder_1d = ddc::SplineBuilder<
        Kokkos::DefaultExecutionSpace,
        Kokkos::DefaultExecutionSpace::memory_space,
        BSplinesX,
        GridX,
        SplineXBoundary,
        SplineXBoundary,
        ddc::SplineSolver::LAPACK,
        GridX>;


...
    ddc::DiscreteDomain<GridX, GridVx> meshXVx(mesh_x, mesh_vx);
    SplineXBuilder const builder_x(meshXVx);
    SplineXBuilder_1d const builder_x_poisson(mesh_x);

the code duplication and memory duplication that this involves seems unnecessary.

Wouldn't it be simpler to template operator() on the batch domain?

@tpadioleau
Copy link
Member

tpadioleau commented Oct 29, 2024

I need to think of it a bit. We had a similar situation with Kokkos-fft. Some backends in Kokkos-fft require to pass arrays at the construction of the plan so that they can find the best fft algorithm. We could think of the same strategy for splines.

The plan in Kokkos-fft https://github.com/kokkos/kokkos-fft/blob/ab3221a0e03f9c8bb157ba2bff6808bc317f683d/fft/src/KokkosFFT_Plans.hpp#L67-L68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants