-
Notifications
You must be signed in to change notification settings - Fork 152
fixed issue with possible zero-sized gemm call in TWFFastDeriv code #6004
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -336,8 +336,9 @@ void TWFFastDerivWrapper::computeMDDerivatives_Obs(const std::vector<ValueMatrix | |
|
|
||
| // s[h,v] = -Minv_B[h,o].Minv_Mv[o,v] | ||
| ValueMatrix s_hv(nocc, nvirt); | ||
| BLAS::gemm('n', 'n', nvirt, nocc, nocc, -1.0, Minv_Mv[sid].data(), Minv_Mv[sid].cols(), Minv_B[sid].data(), | ||
| Minv_B[sid].cols(), 0.0, s_hv.data(), s_hv.cols()); | ||
| if (nvirt > 0) | ||
| BLAS::gemm('n', 'n', nvirt, nocc, nocc, -1.0, Minv_Mv[sid].data(), Minv_Mv[sid].cols(), Minv_B[sid].data(), | ||
| Minv_B[sid].cols(), 0.0, s_hv.data(), s_hv.cols()); | ||
|
|
||
| // s[h,v] = Minv_B[h,v] - Minv_B[h,o].Minv_Mv[o,v] | ||
| for (size_t i = 0; i < s_hv.rows(); i++) | ||
|
|
@@ -428,6 +429,9 @@ void TWFFastDerivWrapper::computeMDDerivatives_Obs(const std::vector<ValueMatrix | |
|
|
||
| void TWFFastDerivWrapper::transform_Av_AoBv(const ValueMatrix& A, const ValueMatrix& B, ValueMatrix& X) const | ||
| { | ||
| // if nvirt == 0, no work to do | ||
| if (X.cols() == 0) return; | ||
|
|
||
| // A [h,o+v] | ||
| // B [o,v] | ||
|
|
||
|
|
@@ -530,8 +534,9 @@ void TWFFastDerivWrapper::computeMDDerivatives_dmu(const std::vector<ValueMatrix | |
| transform_Av_AoBv(Minv_B[sid], Minv_Mv[sid], X3b_ov); | ||
|
|
||
| // X432b[h,v] -= Minv_dM[h,o].X3b[o,v] | ||
| BLAS::gemm('n', 'n', nvirt, nocc, nocc, -1.0, X3b_ov.data(), X3b_ov.cols(), Minv_dM[sid].data(), | ||
| Minv_dM[sid].cols(), 1.0, X432b_hv.data(), X432b_hv.cols()); | ||
| if (nvirt > 0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can it cover a larger scope? All the |
||
| BLAS::gemm('n', 'n', nvirt, nocc, nocc, -1.0, X3b_ov.data(), X3b_ov.cols(), Minv_dM[sid].data(), | ||
| Minv_dM[sid].cols(), 1.0, X432b_hv.data(), X432b_hv.cols()); | ||
|
|
||
|
|
||
| // compute difference from ref here and add that term back later | ||
|
|
@@ -830,8 +835,9 @@ void TWFFastDerivWrapper::buildIntermediates(const std::vector<ValueMatrix>& Min | |
| // n: all orbs (o+v) | ||
|
|
||
| // Minv_Mv = Minv[o,e].M[e,v] | ||
| BLAS::gemm('n', 'n', nvirt, ptclnum, ptclnum, 1.0, M[id].data() + ptclnum, M[id].cols(), Minv[id].data(), | ||
| Minv[id].cols(), 0.0, Minv_Mv[id].data(), Minv_Mv[id].cols()); | ||
| if (nvirt > 0) // avoid gemm call with LDC == 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you move the definition of |
||
| BLAS::gemm('n', 'n', nvirt, ptclnum, ptclnum, 1.0, M[id].data() + ptclnum, M[id].cols(), Minv[id].data(), | ||
| Minv[id].cols(), 0.0, Minv_Mv[id].data(), Minv_Mv[id].cols()); | ||
|
|
||
| // Minv_B = Minv[o,e].B[e,n] | ||
| BLAS::gemm('n', 'n', norb, ptclnum, ptclnum, 1.0, B[id].data(), B[id].cols(), Minv[id].data(), Minv[id].cols(), 0.0, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When nvirt = 0, is max_exc_level defined at line 360 always zero? if so, prefer an early return before
s_hvis defined.