Jutho / KrylovKit.jl

Krylov methods for linear problems, eigenvalues, singular values and matrix functions
Other
281 stars 35 forks source link

Memory optimisation #40

Closed rveltz closed 2 years ago

rveltz commented 3 years ago

Hi,

I am using KK in a very memory "limited" GPU. I would like to ask you a few questions to optimize my code:

If you have suggestions, please do not hesitate,

Thank you

Best regards.

Jutho commented 3 years ago

My apologies for failing to respond to this. To this date, KrylovKit is not the most memory friendly, i.e. it is not reusing memory from previous vectors (e.g. the Krylov subspace from the previous iteration). This, you can notice based on the fact that, if you implement the linear operator as a function, KrylovKit only requires, or in fact only accepts, an out of place method, which allocates a new vector for the result of the application of the linear map. Replacing this with in-place methods that reuse the memory has been on the todo list from day one, but so far has not happened. Hopefully I will find the time one day.

rveltz commented 3 years ago

thank you

Jutho commented 2 years ago

I will close this in favor of Issue #9 , which is really the same issue at the core. Feel free to reopen if there is anything GPU specific that I should think about.