1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-16 06:47:06 +01:00

Cleaning up the CG reproduciblity test. More info reported

This commit is contained in:
Guido Cossu
2016-12-08 05:50:40 +00:00
parent b2dc17e160
commit 538e64e5b4
13 changed files with 196 additions and 42 deletions

View File

@ -37,10 +37,7 @@ struct CG_state {
bool do_repro;
std::vector<RealD> residuals;
CG_state() {
do_repro = false;
residuals.clear();
}
CG_state() {reset();}
void reset(){
do_repro = false;
@ -71,7 +68,14 @@ class ConjugateGradient : public OperatorFunction<Field> {
: Tolerance(tol),
MaxIterations(maxit),
ErrorOnNoConverge(err_on_no_conv),
ReproTest(ReproducibilityTest){};
ReproTest(ReproducibilityTest){
if(ReproducibilityTest == true && err_on_no_conv == true){
std::cout << GridLogMessage << "CG: Reproducibility test ON "<<
"and error on convergence ON are incompatible options" << std::endl;
exit(1);
}
};
void operator()(LinearOperatorBase<Field> &Linop, const Field &src,
@ -210,6 +214,7 @@ class ConjugateGradient : public OperatorFunction<Field> {
ReprTest.do_check = true;
ReprTest.reset_counter();
this->operator()(Linop, src, psi_start);// run the repro test
std::cout << GridLogMessage << "Test passed" << std::endl;
}
// Clear state