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

Remove unused diagonalizers and linear solvers from dfoccwave::Tensor2d and dfoccwave::Array2d #2684

Merged
merged 6 commits into from
Apr 19, 2023

Conversation

TiborGY
Copy link
Contributor

@TiborGY TiborGY commented Aug 14, 2022

Description

Much like occ (PR #2679), dfocc also has these functions that are never called anywhere C++-side, and not PSI_API.
This is another shard of the #2642 mega-PR that can be merged independently.

Todos

  • Unused code is removed from dfoccwave::Array2d
  • Unused code is removed from dfoccwave::Tensor2d

Status

  • Ready for review
  • Ready for merge

@JonathonMisiewicz
Copy link
Contributor

@loriab, I'm not comfortable merging this in while the dfocc cleanup is ongoing. Your thoughts?

@loriab
Copy link
Member

loriab commented Aug 15, 2022

I'm not comfortable merging this in while the dfocc cleanup is ongoing. Your thoughts?

Somehow I had the impression this was in occ, so it was fine. I agree hold off for now.

@TiborGY
Copy link
Contributor Author

TiborGY commented Aug 15, 2022

I'm not comfortable merging this in while the dfocc cleanup is ongoing. Your thoughts?

Somehow I had the impression this was in occ, so it was fine. I agree hold off for now.

Sure, no problem. FYI some of the diagonalizer cleanup is blocked until this is in, but I can chip off some other shards.
PS: Homologues of Array2d are present in both occ and dfocc.

@JonathonMisiewicz
Copy link
Contributor

JonathonMisiewicz commented Aug 15, 2022

Please focus on other shards. I recommend discussing again once #2669, #2670, and the next PR in that series (not currently pushed, will be about merging in non-FNO methods contributed by Bozkaya's group) are merged in.

@TiborGY TiborGY marked this pull request as draft March 23, 2023 15:57
@TiborGY TiborGY marked this pull request as ready for review March 23, 2023 18:04
@TiborGY
Copy link
Contributor Author

TiborGY commented Mar 23, 2023

PR rebased, CI tests are passing.

@JonathonMisiewicz
Copy link
Contributor

I'd like @loriab's opinion before discussing this one, since there's still some dfocc to merge in.

@TiborGY
Copy link
Contributor Author

TiborGY commented Apr 6, 2023

I'd like @loriab's opinion before discussing this one, since there's still some dfocc to merge in.

Very well. Please let me know if a decision has been reached. This is blocking the last remaining pieces of the diagonalizer rework saga.

@loriab
Copy link
Member

loriab commented Apr 6, 2023

If I'm remembering where I left off and performing the diffs correctly, there's no more changes to be made to those 4 array/tensor files in the dfocc saga. And none of the yet-to-be-PRd code uses davidson, cdsyev, cdgesv, lineq_flin, or lineq_pople. There is new code with diagonalize, though, listed below. If the changes in this PR don't interfere with the calls below, or we can work around them, I think we can release the hold and merge this. Thanks for your patience, @TiborGY.

# HciA is Tensor2d (or sharedptr to it)
cis.cc:          HciA->diagonalize(CciA, EciA, cutoff);

# G is Tensor2d
davidson.cc:    G->diagonalize(init_dim, alpha, lambda, 1e-12, true);
davidson.cc:    G->diagonalize(L, alpha, lambda, 1e-12, true);
davidson.cc:    G->diagonalize(init_dim, alpha, lambda, 1e-12, true);
davidson.cc:    G->diagonalize(L, alpha, lambda, 1e-12, true);
davidson.cc:    G->diagonalize(L, alpha, lambda, 1e-12, true);

# Gamma* and Fock* are Tensor2d
fno.cc:    Gamma_->diagonalize(Tvv_, diag_n_, cutoff_, false);
fno.cc:        FockfvA->diagonalize(UfvA, eigfvA, cutoff_);
fno.cc:        FockvvA->diagonalize(UvvA, eigvvA, cutoff_);
fno.cc:    GammaA_->diagonalize(TvvA_, diag_nA_, cutoff_, false);
fno.cc:    GammaB_->diagonalize(TvvB_, diag_nB_, cutoff_, false);
fno.cc:        FockfvA->diagonalize(UfvA, eigfvA, cutoff_);
fno.cc:        FockvvA->diagonalize(UvvA, eigvvA, cutoff_);
fno.cc:        FockfvB->diagonalize(UfvB, eigfvB, cutoff_);
fno.cc:        FockvvB->diagonalize(UvvB, eigvvB, cutoff_);

# a_opdm, etc. are Matrix
occ_iterations.cc:            a_opdm->diagonalize(aevecs, aevals, descending);
occ_iterations.cc:            a_opdm->diagonalize(aevecs, aevals, descending);
occ_iterations.cc:            b_opdm->diagonalize(bevecs, bevals, descending);

# FockooA, etc. are Tensor2d
semi_canonic.cc:    FockooA->diagonalize(UooA, eigooA, cutoff);
semi_canonic.cc:    FockvvA->diagonalize(UvvA, eigvvA, cutoff);
semi_canonic.cc:        FockooB->diagonalize(UooB, eigooB, cutoff);
semi_canonic.cc:        FockvvB->diagonalize(UvvB, eigvvB, cutoff);

@TiborGY
Copy link
Contributor Author

TiborGY commented Apr 7, 2023

Thanks for looking into it. It looks like none of these involve Array2d::diagonalize, so this PR is good on that front. This PR does not touch Matrix::diagonalize, so those calls are safe from it.

But, some Tensor2d::diagonalize calls would indeed fail after this PR. I think the easiest option here is to back out the removal of Tensor2d::diagonalize overloads for now.

FYI, my plan was to eventually change the function signature of Tensor2d::diagonalize after this PR. The init_dim and cutoff arguments have been defunct (as in no-op, unused) for ages. But that can wait until dfocc is no longer in such flux, I can excise sq_rsp while keeping the current interfaces.

@TiborGY TiborGY marked this pull request as draft April 7, 2023 15:17
@TiborGY TiborGY marked this pull request as ready for review April 15, 2023 13:06
@TiborGY
Copy link
Contributor Author

TiborGY commented Apr 17, 2023

CI is acting up, but otherwise this is ready

Copy link
Member

@susilehtola susilehtola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negative LOC always good

Copy link
Member

@loriab loriab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@loriab loriab added this pull request to the merge queue Apr 19, 2023
Merged via the queue into psi4:master with commit e00b586 Apr 19, 2023
@TiborGY TiborGY deleted the patch-9 branch April 20, 2023 22:58
@loriab loriab mentioned this pull request May 3, 2023
10 tasks
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

Successfully merging this pull request may close these issues.

None yet

4 participants