1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

WilsonMG: Fix random behavior in GMRES

From time to time I saw random since the basis vectors were not initialized
properly.
This commit is contained in:
Daniel Richtmann 2018-06-11 15:54:32 +02:00
parent 4f41cd114d
commit 2ab9d4bc56
No known key found for this signature in database
GPG Key ID: B33C490AF0772057
5 changed files with 13 additions and 8 deletions

View File

@ -145,7 +145,8 @@ class CommunicationAvoidingGeneralisedMinimalResidual : public OperatorFunction<
Field w(src._grid);
Field r(src._grid);
std::vector<Field> v(RestartLength + 1, src._grid);
// this should probably be made a class member so that it is only allocated once, not in every restart
std::vector<Field> v(RestartLength + 1, src._grid); for (auto &elem : v) elem = zero;
MatrixTimer.Start();
LinOp.Op(psi, w);

View File

@ -152,8 +152,9 @@ class FlexibleCommunicationAvoidingGeneralisedMinimalResidual : public OperatorF
Field w(src._grid);
Field r(src._grid);
std::vector<Field> v(RestartLength + 1, src._grid);
std::vector<Field> z(RestartLength + 1, src._grid);
// these should probably be made class members so that they are only allocated once, not in every restart
std::vector<Field> v(RestartLength + 1, src._grid); for (auto &elem : v) elem = zero;
std::vector<Field> z(RestartLength + 1, src._grid); for (auto &elem : z) elem = zero;
MatrixTimer.Start();
LinOp.Op(psi, w);

View File

@ -150,8 +150,9 @@ class FlexibleGeneralisedMinimalResidual : public OperatorFunction<Field> {
Field w(src._grid);
Field r(src._grid);
std::vector<Field> v(RestartLength + 1, src._grid);
std::vector<Field> z(RestartLength + 1, src._grid);
// these should probably be made class members so that they are only allocated once, not in every restart
std::vector<Field> v(RestartLength + 1, src._grid); for (auto &elem : v) elem = zero;
std::vector<Field> z(RestartLength + 1, src._grid); for (auto &elem : z) elem = zero;
MatrixTimer.Start();
LinOp.Op(psi, w);

View File

@ -143,7 +143,8 @@ class GeneralisedMinimalResidual : public OperatorFunction<Field> {
Field w(src._grid);
Field r(src._grid);
std::vector<Field> v(RestartLength + 1, src._grid);
// this should probably be made a class member so that it is only allocated once, not in every restart
std::vector<Field> v(RestartLength + 1, src._grid); for (auto &elem : v) elem = zero;
MatrixTimer.Start();
LinOp.Op(psi, w);

View File

@ -157,8 +157,9 @@ class MixedPrecisionFlexibleGeneralisedMinimalResidual : public OperatorFunction
FieldD w(src._grid);
FieldD r(src._grid);
std::vector<FieldD> v(RestartLength + 1, src._grid); // these should probably be made class members
std::vector<FieldD> z(RestartLength + 1, src._grid); // so that they are only allocated once, not in every restart
// these should probably be made class members so that they are only allocated once, not in every restart
std::vector<FieldD> v(RestartLength + 1, src._grid); for (auto &elem : v) elem = zero;
std::vector<FieldD> z(RestartLength + 1, src._grid); for (auto &elem : z) elem = zero;
MatrixTimer.Start();
LinOp.Op(psi, w);