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

Brainstorm about speeding up TJLF #4

Open
orso82 opened this issue Oct 26, 2023 · 5 comments
Open

Brainstorm about speeding up TJLF #4

orso82 opened this issue Oct 26, 2023 · 5 comments

Comments

@orso82
Copy link
Member

orso82 commented Oct 26, 2023

For typical use-cases each eigensolve tends to be fast (grows with number of species and number of basis). The main issue is that TJLF does a lot of eigensolves! (order ~200)

Many of the eigensolves are used to find the width of the modes. Can such width be determined only for few Ky's and not for each one of them? For example, when width is entered by user, the same width is used for all Ky's. Perhaps we can calculate only few widths (eg at lowest and highest Kw) and interpolate between them?

@bclyons12
Copy link
Member

Ah, okay, this is the stuff I don't know anything about. Each call to eigen allocates some workspace (I believe) and then calls a non-allocating version:

function eigen(A::AbstractMatrix{TA}, B::AbstractMatrix{TB}; kws...) where {TA,TB}
    S = promote_type(eigtype(TA), TB)
    eigen!(eigencopy_oftype(A, S), eigencopy_oftype(B, S); kws...)
end

If we can preallocate the workspace and call eigen! directly, maybe that would have some improvement. I'm not sure though. It does look like most of the time is spent in ggev!

@tomneiser
Copy link
Collaborator

The width depends on the type of mode. Above a certain ky we can expect to be only dealing with ETG's, so there could be some improvement for say k_y > 10. Otherwise we would need to run a form of mode ID routine that guesses the best width based on inputs or initial eigenvalues.

@orso82
Copy link
Member Author

orso82 commented Oct 27, 2023

@bclyons12 there could certainly be some allocation savings if we preallocated the workspace. As you know, we just need to be careful if we eventually desire to multi-thread the calculation per k_y that each thread uses its own work matrix.

@orso82
Copy link
Member Author

orso82 commented Oct 27, 2023

@tomneiser should we expect those widths to change significantly between iterations of the FluxMatcher? If not, we could happily pay the price of calculating the optimal width once, and then use those same widths for all subsequent FluxMatcher iterations.

@tomneiser
Copy link
Collaborator

tomneiser commented Oct 28, 2023

I think this is a good idea. The widths don't change every iteration, maybe every 30 iterations we can re-evaluate them

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