From c62b4fb6e1db3cf9af037d4e88f23fc4526d2399 Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Fri, 1 Dec 2023 07:48:03 +0100 Subject: [PATCH] Add newlines in matrix --- include/ddc/kernels/splines/matrix.hpp | 14 ++++++++++++++ include/ddc/kernels/splines/matrix_maker.hpp | 4 +++- include/ddc/kernels/splines/matrix_sparse.hpp | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/matrix.hpp b/include/ddc/kernels/splines/matrix.hpp index 5d4f87583..f21f2d379 100644 --- a/include/ddc/kernels/splines/matrix.hpp +++ b/include/ddc/kernels/splines/matrix.hpp @@ -1,4 +1,5 @@ #pragma once + #include #include #include @@ -12,14 +13,20 @@ #include "view.hpp" namespace ddc::detail { + class Matrix { public: Matrix(const int mat_size) : n(mat_size) {} + virtual ~Matrix() = default; + int n; + virtual double get_element(int i, int j) const = 0; + virtual void set_element(int i, int j, double aij) = 0; + virtual void factorize() { int const info = factorize_method(); @@ -37,6 +44,7 @@ class Matrix // TODO: Add LOG_FATAL_ERROR } } + virtual ddc::DSpan1D solve_inplace(ddc::DSpan1D const b) const { assert(int(b.extent(0)) == n); @@ -48,6 +56,7 @@ class Matrix } return b; } + virtual ddc::DSpan1D solve_transpose_inplace(ddc::DSpan1D const b) const { assert(int(b.extent(0)) == n); @@ -59,6 +68,7 @@ class Matrix } return b; } + virtual ddc::DSpan2D solve_multiple_inplace(ddc::DSpan2D const bx) const { assert(int(bx.extent(1)) == n); @@ -70,6 +80,7 @@ class Matrix } return bx; } + template Kokkos::View solve_batch_inplace( Kokkos::View const bx) const @@ -83,6 +94,7 @@ class Matrix } return bx; } + int get_size() const { return n; @@ -102,6 +114,8 @@ class Matrix protected: virtual int factorize_method() = 0; + virtual int solve_inplace_method(double* b, char transpose, int n_equations) const = 0; }; + } // namespace ddc::detail diff --git a/include/ddc/kernels/splines/matrix_maker.hpp b/include/ddc/kernels/splines/matrix_maker.hpp index 8484d47ec..f31227ea9 100644 --- a/include/ddc/kernels/splines/matrix_maker.hpp +++ b/include/ddc/kernels/splines/matrix_maker.hpp @@ -1,10 +1,11 @@ #pragma once + #include #include "matrix_sparse.hpp" - namespace ddc::detail { + class MatrixMaker { public: @@ -22,4 +23,5 @@ class MatrixMaker preconditionner_max_block_size); } }; + } // namespace ddc::detail diff --git a/include/ddc/kernels/splines/matrix_sparse.hpp b/include/ddc/kernels/splines/matrix_sparse.hpp index d677c689a..6494745bf 100644 --- a/include/ddc/kernels/splines/matrix_sparse.hpp +++ b/include/ddc/kernels/splines/matrix_sparse.hpp @@ -1,4 +1,5 @@ #pragma once + #include #include #include @@ -25,9 +26,13 @@ class Matrix_Sparse : public Matrix { private: const int m_m; + const int m_n; + Kokkos::View m_rows; + Kokkos::View m_cols; + Kokkos::View m_data; std::unique_ptr< @@ -36,7 +41,9 @@ class Matrix_Sparse : public Matrix m_solver_factory; int m_cols_per_par_chunk; // Maximum number of columns of B to be passed to a Ginkgo solver + int m_par_chunks_per_seq_chunk; // Maximum number of teams to be executed in parallel + int m_preconditionner_max_block_size; // Maximum size of Jacobi-block preconditionner public: