Improved Matrix organisation #425
Replies: 6 comments 45 replies
-
I'm not sure if Alternatively we could break up the data and the solver and call |
Beta Was this translation helpful? Give feedback.
-
I agree we should use Kokkos::View. We cannot mix virtual functions and templates so i would template the base class by the execution space and use a fixed layout to right or left. I am not convinced by the layout stride in the end, we kind of need to know the child class to know what layout is expected. Factorize could be renamed fill_complete like in trilinos ? This way we could keep the same base for sparse and lapack based methods |
Beta Was this translation helpful? Give feedback.
-
Maybe we could write some kind of complicated |
Beta Was this translation helpful? Give feedback.
-
I think #329 partially solves this by using If you want this issue to be addressed before merging #329 I think we can |
Beta Was this translation helpful? Give feedback.
-
First, let me say I like the API, it is nice and clear. Maybe more than Regarding inheritance, do we really need it? Couldn't we just converge on a templated API like the one you propose and have multiple independent implementations of it. It would then be up to the user to be general and template or to make a virtual-based wrapper with specific types of parameters |
Beta Was this translation helpful? Give feedback.
-
Assembling some of the comments here to show a new proposal: template <class ExecSpace>
class Matrix
{
int m_n;
using DView2D = Kokkos::View<double**, typename ExecSpace::memory_space, Kokkos::LayoutStride>;
public:
explicit Matrix(const int mat_size) : m_n(mat_size) {}
virtual ~Matrix() = default;
virtual DView2D solve_inplace(DView2D const b) const = 0;
virtual DView2D solve_transpose_inplace(DView2D const b) const = 0;
virtual DView2D solve_multiple_inplace(DView2D const bx) const = 0;
virtual DView2D solve_multiple_transpose_inplace(DView2D const bx) const = 0;
int get_size() const
{
return m_n;
}
}; |
Beta Was this translation helpful? Give feedback.
-
Currently the super-class
Matrix
is designed with LAPACK in mind. As a result it defines some pure functions with prototypes that are poorly adapted to other classes:ddc/include/ddc/kernels/splines/matrix.hpp
Lines 127 to 131 in 9ef820e
I think we should reorganise this somewhat. However it is not clear what the correct implementation should be.
In any case the current
Matrix
class should be renamed to better reflect its purpose. E.gLAPACKMatrix
. If it is still useful to have aMatrix
abstract class then I think this should look something like:however I believe this code will not compile (templates + virtual). Maybe there is another solution to enforce the implementation of a minimum subset of functions?
One option could be to make
Matrix
templated byArgs...
I think this makes sense forMemSpace
but I'm not sure it is logical for the layout.@tpadioleau @jbigot what do you think?
@blegouix any additional suggestions?
Beta Was this translation helpful? Give feedback.
All reactions