TFQMR: remove extra storage and a copy call
Hi all,
just a suggestion... Au_new vector within TFQMR is not needed, it can be removed by preparing v using Au just few lines before:
if( solver_par->numiter%2 == 0 ){
...
u_mp1 = w + beta*u_m;
v = beta * (Au + beta*v)); // update: prepare v here to avoid using Au_new later
}
...
Au = A pu_m // update: Au_new is not used
....
if( solver_par->numiter%2 == 0 ){
v += Au; // update: add new product
}
// update: one deep copy less
Few percent faster and less storage. Best regards
Comments (4)
-
-
- changed status to resolved
Optimized code according to Josip Basic's comment.
-
reporter Hartwig, you're welcome.
It can be applied for preconditioned, unrolled and merged versions, as well.
Moreover, I also don't see the point in having both u_m and u_mp1 in unrolled/merged versions of TFQMR, since you always copy the data from u_mp1 to u_m after doing something with u_mp1. However, it's needed in the unrolled version of the solver.
-
Josip, yes, I agree, I can remove one of these vectors in the merged versions. And I will introduce this change once I have some time. If you want to go through the process of doing a pull request with these optimizations, you are sure welcome! Cheers, Hartwig
- Log in to comment
Great thanks, Josip, I did include your optimization.