I want to retrieve some information from the iterative solver cg and bicgstab to monitor overall convergence of the simulation, but they are "uninitialized" hence last error and #iters are not available.
test code:
solverPerf.initialResidual() = 0.03; // works, test
solverPerf.finalResidual() = (ScalarType)bicgstab.error(); // wrong value, test
solverPerf.nIterations() = (ScalarType)bicgstab.iters();
warning:
clPBiCGStab_solve.C:75:62: warning: ‘((void)& bicgstab +40)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
solverPerf.finalResidual() = (ScalarType)bicgstab.error();
^
clPBiCGStab_solve.C:76:60: warning: ‘((void)& bicgstab +32)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
solverPerf.nIterations() = (ScalarType)bicgstab.iters();
How can I initialize the functions?
T.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Tario,
how do you initialize the bicgstab object? Do you pass it to the solve() call? I can't say what's going on based on your description.
Best regards,
Karli
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I want to retrieve some information from the iterative solver cg and bicgstab to monitor overall convergence of the simulation, but they are "uninitialized" hence last error and #iters are not available.
test code:
warning:
clPBiCGStab_solve.C:75:62: warning: ‘((void)& bicgstab +40)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
solverPerf.finalResidual() = (ScalarType)bicgstab.error();
^
clPBiCGStab_solve.C:76:60: warning: ‘((void)& bicgstab +32)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
solverPerf.nIterations() = (ScalarType)bicgstab.iters();
How can I initialize the functions?
T.
Hi Tario,
how do you initialize the
bicgstab
object? Do you pass it to thesolve()
call? I can't say what's going on based on your description.Best regards,
Karli
This is the bicgstab related section:
viennacl::linalg::bicgstab_tag bicgstab(tolerance_, maxIter_); // Set solver tolerance and maximum iterations
// BLOCK PRECONDITIONER SETUP --------------------------------------------------------------------
viennacl::linalg::block_ilu_precond< viennacl::compressed_matrix<ScalarType>,
viennacl::linalg::ilu0_tag> vcl_block_ilu0(vcl_matrix, viennacl::linalg::ilu0_tag());
// ---------------------------------------------------------------------------------------------------------------
//solverPerf.initialResidual() = (ScalarType)cg_tag.error();
// Solve the linear system
vcl_psi = solve(vcl_matrix,
vcl_source,
viennacl::linalg::bicgstab_tag(),
vcl_block_ilu0);
Hi,
please use
for the solver call.
Best regards,
Karli