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

Handle runtime scheme policy #46

Open
tkloczko opened this issue Aug 4, 2020 · 11 comments
Open

Handle runtime scheme policy #46

tkloczko opened this issue Aug 4, 2020 · 11 comments

Comments

@tkloczko
Copy link

tkloczko commented Aug 4, 2020

Hi guys,
.
Firstly, I would like to tell you that the work you have already done is very interesting. I read the paper about the different format mentioned in #21 . It gives nice ideas to drive the architecture.
I also read the sources, the notion of scheme is a great way to customize the different storage models. However, when using such a design in, for instance, a FE code, some drawbacks can arise.

Typically, it is natural to build the matrix of the linear system using a map scheme. Then, according to the solver of the linear system, one needs to convert to either CSR, COO or another format. This is not quite difficult. But in case of the choice of the solver is done at runtime, using the current design is not possible since you don't know at compile time the type of scheme you need to tackle the solver that will be used.

This is the same drawback that led to conceive the std polymorphic allocator. You don't want to recompile the code every time you need to change the allocation policy. It is the same problem with the sparse scheme. In our experience, we realized that it was the solver that drives in general the scheme policy.
In terms of architecture, it is of course much involved. The sparse array or tensor can be composed by an abstract scheme (no more template parameter is needed I think) implemented by the concrete schemes but you then need abstract nz iterators which can lead to a lack of performance. However, it is still possible to "extract" the concrete scheme when performance is required.

We did a similar design few years ago in the context of distributed sparse linear algebra (in the sense of MPI). It would be great to see how this former work could fit with your brand new architecture.

See you,
Cheers,
Thibaud.

@gouarin
Copy link
Member

gouarin commented Aug 5, 2020

Hi @tkloczko,

thanks for your message!

Each scheme should be able to give the sparse N-D array in another scheme. I agree with you it's generally the solver which gives you the scheme to use. But since we have conversion tools, we should be able to communicate with the different layers that you can find in linear algebra. There are a lot of libraries in linear algebra (umfpack, superlu, hypre, ...) and it's a difficult topic. So the idea is not to write linear solvers but to build interfaces to these libraries with the good scheme and the good memory layer.

Let me know if I don't well understand your message.

@tkloczko
Copy link
Author

tkloczko commented Aug 5, 2020

Hi @gouarin ,

Thanks a lot for the reply. Maybe the first thing would be to know what is the main objective of xtensor-sparse. I am available a lot by the end of the week for a phone call or a visio. I also started to code a xsparse_polymorphic_scheme to illustrate what I have in minds in terms of runtime modularity.

Here is a link to a presentation we did 5 years ago that deal with distributed version of Sparse Matrix. The goal was to plug matrices coming from a MPI Finite-Volume (or FE) code with linear solver such as Hypre , Mumps, MaPhys ... It seems that it is a very similar problem that you try to address.

Let me know,
Cheers,
Thib

@JohanMabille
Copy link
Member

Hi @tkloczko,

Happy to see you here! As @gouarin said, the idea is to provide different schemes tjat implement a common API and conversion tools that allow to easily switch from one scheme to another one.

Even with static encoded scheme, these conversion tools will avoid rebuilding your software if you change the solver dynamically since the conversion code will be always be compiled.

I'm on holidays until the end of the week, but if you're available next week I'll be happy to join a call with you and Loic. Otherwise I will catch up with Loic so he can give me some feedback about your discussion.

Cheers,

Johan

@tkloczko
Copy link
Author

tkloczko commented Aug 5, 2020

Hi @JohanMabille ,

I will be available next week too, at more regular time ;-) ! Enjoy your holidays !

Let me know about your availability as soon as you are back.

Cheers,

Thib

@gouarin
Copy link
Member

gouarin commented Aug 6, 2020

I'm also on vacation this week. But I will be available next week to discuss with you.

@tkloczko
Copy link
Author

tkloczko commented Aug 6, 2020

Bonne fin de vacances alors :-) ! À la semaine prochaine !

@JohanMabille
Copy link
Member

I'm back and available any time except from 11:30 to 12:00 every day, and Wednesday the whole day.

@tkloczko
Copy link
Author

Hi Johan !

Tomorrow between 12:45 and 14:30 ?

BTW, I did a PR just to illustrate what I had in mind.
Thib.

@gouarin
Copy link
Member

gouarin commented Aug 10, 2020 via email

@JohanMabille
Copy link
Member

@tkloczko Yes I saw your PR but I didn't have the time to get into the details (I have more than 70 notifications to pop ;)).

Tomorrow between 13:30 and 14:30 works for me.

@tkloczko
Copy link
Author

Ok let's go for that time !

Can we do that using Discord ?

@JohanMabille No pb, I know you are very busy :-) !

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

No branches or pull requests

3 participants