ORNL / ReSolve

Library of GPU-resident linear solvers
Other
58 stars 2 forks source link

Who has responsibility to set up `GramSchmidt` class instance? #197

Closed pelesh closed 1 month ago

pelesh commented 2 months ago

A pointer to GramSchmidt class instance needs to be passed to each (F)GMRES solver instance. This design abstracts away Gram-Schmidt method from the iterative solver implementation and allows for adding new reorthogonalization methods in the future.

However, in current design (and examples), the application calling the (F)GMRES solver has the responsibility to set up the GramSchmidt class. The setup function takes in two parameters -- the size of the linear system and the number of iterations till solver restart. Having the calling application set these two parameters creates a risk that GramSchmidt and iterative solver class can receive different values for the two parameters, possibly leading to hard to detect bugs in the application code.

Consider shifting responsibility of setting up GramSchmidt class instance from the calling application to the iterative solver itself. A setup method in a (F)GMRES class could set up the GramSchmidt instance, as well, since it has access to all needed parameter values for that. Such implementation would ensure the same parameter values are used for (F)GMRES and the GramSchmidtclass.

CC @stonecoldhughes @maksud