Added timing of prepare call for linear solvers

This commit is contained in:
hnil 2019-04-04 12:20:30 +02:00 committed by Markus Blatt
parent ed24b3fcad
commit 4f1603407d
3 changed files with 18 additions and 2 deletions

View File

@ -297,13 +297,15 @@ namespace Opm {
// equations // equations
wellModel().linearize(ebosSimulator().model().linearizer().jacobian(), wellModel().linearize(ebosSimulator().model().linearizer().jacobian(),
ebosSimulator().model().linearizer().residual()); ebosSimulator().model().linearizer().residual());
linear_solve_setup_time_ = 0.0;
try { try {
solveJacobianSystem(x); solveJacobianSystem(x);
report.linear_solve_setup_time += linear_solve_setup_time_;
report.linear_solve_time += perfTimer.stop(); report.linear_solve_time += perfTimer.stop();
report.total_linear_iterations += linearIterationsLastSolve(); report.total_linear_iterations += linearIterationsLastSolve();
} }
catch (...) { catch (...) {
report.linear_solve_setup_time += linear_solve_setup_time_;
report.linear_solve_time += perfTimer.stop(); report.linear_solve_time += perfTimer.stop();
report.total_linear_iterations += linearIterationsLastSolve(); report.total_linear_iterations += linearIterationsLastSolve();
@ -473,7 +475,10 @@ namespace Opm {
x = 0.0; x = 0.0;
auto& ebosSolver = ebosSimulator_.model().newtonMethod().linearSolver(); auto& ebosSolver = ebosSimulator_.model().newtonMethod().linearSolver();
Dune::Timer perfTimer;
perfTimer.start();
ebosSolver.prepare(ebosJac, ebosResid); ebosSolver.prepare(ebosJac, ebosResid);
linear_solve_setup_time_ = perfTimer.stop();
ebosSolver.setResidual(ebosResid); ebosSolver.setResidual(ebosResid);
// actually, the error needs to be calculated after setResidual in order to // actually, the error needs to be calculated after setResidual in order to
// account for parallelization properly. since the residual of ECFV // account for parallelization properly. since the residual of ECFV
@ -906,7 +911,7 @@ namespace Opm {
double dsMax() const { return param_.ds_max_; } double dsMax() const { return param_.ds_max_; }
double drMaxRel() const { return param_.dr_max_rel_; } double drMaxRel() const { return param_.dr_max_rel_; }
double maxResidualAllowed() const { return param_.max_residual_allowed_; } double maxResidualAllowed() const { return param_.max_residual_allowed_; }
double linear_solve_setup_time_;
public: public:
std::vector<bool> wasSwitched_; std::vector<bool> wasSwitched_;
}; };

View File

@ -33,6 +33,7 @@ namespace Opm
total_time(0.0), total_time(0.0),
solver_time(0.0), solver_time(0.0),
assemble_time(0.0), assemble_time(0.0),
linear_solve_setup_time(0.0),
linear_solve_time(0.0), linear_solve_time(0.0),
update_time(0.0), update_time(0.0),
output_write_time(0.0), output_write_time(0.0),
@ -49,6 +50,7 @@ namespace Opm
{ {
pressure_time += sr.pressure_time; pressure_time += sr.pressure_time;
transport_time += sr.transport_time; transport_time += sr.transport_time;
linear_solve_setup_time += sr.linear_solve_setup_time;
linear_solve_time += sr.linear_solve_time; linear_solve_time += sr.linear_solve_time;
solver_time += sr.solver_time; solver_time += sr.solver_time;
assemble_time += sr.assemble_time; assemble_time += sr.assemble_time;
@ -119,6 +121,14 @@ namespace Opm
} }
os << std::endl; os << std::endl;
t = linear_solve_setup_time + (failureReport ? failureReport->linear_solve_setup_time : 0.0);
os << " Linear solve setup time (seconds): " << t;
if (failureReport) {
os << " (Failed: " << failureReport->linear_solve_setup_time << "; "
<< 100*failureReport->linear_solve_setup_time/t << "%)";
}
os << std::endl;
t = update_time + (failureReport ? failureReport->update_time : 0.0); t = update_time + (failureReport ? failureReport->update_time : 0.0);
os << " Update time (seconds): " << t; os << " Update time (seconds): " << t;
if (failureReport) { if (failureReport) {

View File

@ -33,6 +33,7 @@ namespace Opm
double total_time; double total_time;
double solver_time; double solver_time;
double assemble_time; double assemble_time;
double linear_solve_setup_time;
double linear_solve_time; double linear_solve_time;
double update_time; double update_time;
double output_write_time; double output_write_time;