-
Notifications
You must be signed in to change notification settings - Fork 198
Fix(tridiagonal_matrices): spmv y vector overwrite and missing error check in impure init functions #1054
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: master
Are you sure you want to change the base?
Fix(tridiagonal_matrices): spmv y vector overwrite and missing error check in impure init functions #1054
Conversation
|
Thanks for spotting some things I completely missed. Could you also extend the tests to ensure that the cases with |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1054 +/- ##
=========================================
Coverage ? 25.13%
=========================================
Files ? 570
Lines ? 234201
Branches ? 41267
=========================================
Hits ? 58858
Misses ? 175343
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
As it is, we do not perform any check in @perazz, @jvdp1 and @jalvesz : What do you think? Should we modify the interface to be something like subroutine spmv(A, x, y, alpha, beta, op, err)where |
|
I guess we could add an optional error output argument to check for the admissibility of |
|
Well the thing is the underlying Hence, compared to the |
|
I saw the reason ... Have you tried to call these routines from OpenBLAS/MKL with values different than |
| ! Description of the matrix. | ||
| A%n = n | ||
| ! Matrix elements. | ||
| A%dl = [(dl, i = 1, n-1)] |
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.
I know that the brackets syntax looks elegant but it does 2 allocations plus an assignment. Preferer the more efficient syntax:
allocate( A%dl(n-1), source = dl )
allocate( A%dv(n), source= dv )
allocate( A%du(n-1), source = du )|
|
||
| y1 = 0.0_wp | ||
| call random_number(y2) | ||
| y1 = alpha * matmul(Amat, x) + beta * y2 ; call spmv(A, x, y2, alpha=alpha, beta=beta) |
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.
Please use two lines for this. calls should always be in their own line. Same for array assignments. The use of ";" to mix in a single line multiple executions is recommended only for very basic scalar operations.
|
I've just tried with |
Summary:
This pr fixes two issues within tridiagonal_matrices module.
tridiagonal_matrices, the matrix fields were assigned even if there was an error(for example, when the sizes of du and dl vectors differed from dv by more than one).Changes:
if (err0%ok())check in the impure initialization functions.y = 0.0_${k1}$in the spmv subroutine.