Skip to content

Conversation

@davpoolechem
Copy link
Contributor

@davpoolechem davpoolechem commented Nov 29, 2022

Description

This PR is a continuation of the IncFock standardization effort initially started in #2682, and restarted in #2792. It is the second PR listed in the PR submission scheme discussed in the comments in #2682.

For all intents and purposes, the PR has basically the same changes as #2792, except applied to DirectJK instead of DFJLinK. The same benefits to DFJLinK seen in #2792 are applied to DirectJK here, and many of the same points of the benefits of that PR apply here, as well.

A couple of notes to be had for reviewers, some of which arise from discussions in #2792:

  1. Unlike CompositeJK Part 1.5: DFJLinK/DFJCOSK IncFock Standardization #2792, this PR is independent of the CompositeJK effort, since this PR is localized within DirectJK.
  2. This PR makes slightly more expansive changes to the DirectJK infrastructure to support the new IncFock formalism, but it is still not a massive number of changes; and most of these changes are similar to those observed in DFJLinK in CompositeJK Part 1.5: DFJLinK/DFJCOSK IncFock Standardization #2792.
  3. As with CompositeJK Part 1.5: DFJLinK/DFJCOSK IncFock Standardization #2792, this PR does not remove the bells and whistles related to IncFock seen in DirectJK (e.g., recomputing the full Fock matrix every so often, disabling IncFock past a given convergence threshold). This PR incorporates the DFJCOSK IncFock formalism as much as possible into DirectJK, while maintaining the IncFock bells and whistles seen in DirectJK.
  4. It should be noted that there are no directJK-x tests akin to the linK-x tests, and thus, no IncFock efficiency tests were added in this PR, as was done for DFJLinK in CompositeJK Part 1.5: DFJLinK/DFJCOSK IncFock Standardization #2792. Technically, IncFock efficiency tests could be added to scf5, but I feel that goes against the spirit of the scf5 test.
  5. I looked at stability tests, as well. STABILITY_ANALYSIS=CHECK works for all of RHF, ROHF, and UHF references.

User API & Changelog headlines

N/A

Dev notes & details

  • Switches DirectJK to using the incremental Fock build implementation used in DFJCOSK. This change standardizes the incremental Fock implementation between DirectJK and DFJCOSK and improves the memory usage of DirectJK in the process.
  • Changes DirectJK machinery to support new incremental Fock formalism.

Questions

  • Do we want to add extra tests for DirectJK to allow for Incremental Fock efficiency tests?

Checklist

Status

  • Ready for review
  • Ready for merge

@loriab loriab added this to the Psi4 1.7 milestone Nov 29, 2022
@loriab loriab added the scf Involves general SCF: convergence algorithms, RHF/UHF/ROHF/CUHF... label Nov 29, 2022
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.

Thanks for looking at stability. Probably later we can add a test for each of the stabilities that parameterizes all the scf methods and incfock combinations.

#ifdef USING_BrianQC
if (brianEnable) {
// zero out J, K, and wK matrices
zero();
Copy link
Member

Choose a reason for hiding this comment

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

just checking that editing brianqc code intentional.

Copy link
Contributor Author

@davpoolechem davpoolechem Nov 30, 2022

Choose a reason for hiding this comment

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

Indeed it is!

The original DirectJK code has a call to zero() at the very beginning of compute_JK(). Unfortunately, this zero() call breaks the IncFock code when using the new IncFock formalism, so essentially, the call to zero() was moved down further in DirectJK. However, the call to zero() also occurs before the BrianQC code. So, I assumed that just flat-out getting rid of the call to zero() at the beginning would break the BrianQC code. The addition of zero() to BrianQC, then, is essentially making sure that zero() is still called at the beginning when BrianQC is used.

Thinking about it further, though, it's possible this same effect can be had by just replacing the original call to zero() with something like

if (!incfock_) zero();

Then, the zero() call is only done for non-IncFock runs without changing the BrianQC code at all. Might be safer to do it that way, since I am not sure if we have immediate access to BrianQC to test changes to BrianQC code.

Copy link
Member

Choose a reason for hiding this comment

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

We don't have immediate BrianQC access, so I think the consolidated zero() you propose would be good.

Copy link
Contributor Author

@davpoolechem davpoolechem Nov 30, 2022

Choose a reason for hiding this comment

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

I'll admit, my only concern is some edge case where someone uses BrianQC while requesting IncFock, then the initial zeroing doesn't happen because IncFock is requested, and then BrianQC possibly breaks.

@davpoolechem
Copy link
Contributor Author

Thanks for looking at stability. Probably later we can add a test for each of the stabilities that parameterizes all the scf methods and incfock combinations.

You're welcome! This would probably be a good idea, especially since, from my testing, some issues pop up with stability tests UHF references depending on the SCF_TYPE method used currently.

@JonathonMisiewicz
Copy link
Contributor

Ping me for review after Pt 1.5 gets merged in. I'm worried about possible merge conflicts.

Copy link
Contributor

@JonathonMisiewicz JonathonMisiewicz left a comment

Choose a reason for hiding this comment

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

This all looks good to me. Let us know when this is ready to merge.

@davpoolechem
Copy link
Contributor Author

This all looks good to me. Let us know when this is ready to merge.

Will do! I think I want to run a quick final test set with the DFJLinK PR merged in, to make sure nothing broke. Then, it should be good to go!

@davpoolechem davpoolechem force-pushed the dpoole34/directjk-incfock branch from 7943e4f to fde9a15 Compare November 30, 2022 17:13
@davpoolechem
Copy link
Contributor Author

So the CI error here is... interesting.

FAILED: src/psi4/libdpd/CMakeFiles/dpd.dir/buf4_mat_irrep_wrt.cc.obj C:\PROGRA~1\LLVM\bin\clang-cl.exe /nologo -TP -DUSING_LAPACK_MKL -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -ID:\a\1\s\psi4\include -ID:\a\1\s\psi4\src -imsvc C:\tools\miniconda3\include -imsvc C:\tools\miniconda3\Library\include -imsvc C:\tools\miniconda3\Library\include\eigen3 /arch:AVX /O2 /Ob2 /DNDEBUG -MD /EHsc -Xclang -fopenmp -std:c++17 /showIncludes /Fosrc\psi4\libdpd\CMakeFiles\dpd.dir\buf4_mat_irrep_wrt.cc.obj /Fdsrc\psi4\libdpd\CMakeFiles\dpd.dir\dpd.pdb -c -- D:\a\1\s\psi4\src\psi4\libdpd\buf4_mat_irrep_wrt.cc In file included from D:\a\1\s\psi4\src\psi4\libdpd\buf4_mat_irrep_wrt.cc:33: In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include\cstdio:9: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include\yvals_core.h(784,1): error: static_assert failed "Error in C++ Standard Library usage." _EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 14.0.0 or newer."); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include\yvals_core.h(456,5): note: expanded from macro '_EMIT_STL_ERROR' static_assert(false, "Error in C++ Standard Library usage.") ^ ~~~~~ 1 error generated.

Two overall errors on the Windows Psi4 build in this vein.

@loriab
Copy link
Member

loriab commented Nov 30, 2022

I've gotten that once today, too. Then I've gotten distracted by other matters. Even if a restart fixes it, another CI failure will crop up later on, so please rebase, and we'll see if this is a consistent issue.

@loriab
Copy link
Member

loriab commented Dec 1, 2022

I got the static_assert error again now. The file it's triggering on hasn't had recent changes, so I don't know why it's popping up now, unless it's an intermittant/brownout strategy to push upgrades. Anyways, switching the llvm version https://github.com/psi4/psi4/pull/2791/files#diff-9f5f8e4d87a7d1fbb0e8f30d1c680c5f42f6af10c04aa81d342c7dfa5af9a99fR10 at least gets the build started.

@davpoolechem davpoolechem force-pushed the dpoole34/directjk-incfock branch from fde9a15 to 772eea5 Compare December 1, 2022 14:25
@davpoolechem
Copy link
Contributor Author

I got the static_assert error again now. The file it's triggering on hasn't had recent changes, so I don't know why it's popping up now, unless it's an intermittant/brownout strategy to push upgrades. Anyways, switching the llvm version https://github.com/psi4/psi4/pull/2791/files#diff-9f5f8e4d87a7d1fbb0e8f30d1c680c5f42f6af10c04aa81d342c7dfa5af9a99fR10 at least gets the build started.

Hmmmm, I see. Thank you for looking into this! I just rebased and pushed again, so we will see if that helps.

@loriab
Copy link
Member

loriab commented Dec 1, 2022

The LLVM bump was a trial in a branch, not master, so you'll have to edit, not just rebase. Sorry I was unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scf Involves general SCF: convergence algorithms, RHF/UHF/ROHF/CUHF...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants