Template Numerical Library version\ main:7249e99
Loading...
Searching...
No Matches
TNL::Solvers::IterativeSolverMonitor< Real > Class Template Reference

Object for monitoring convergence of iterative solvers. More...

#include <TNL/Solvers/IterativeSolverMonitor.h>

Inheritance diagram for TNL::Solvers::IterativeSolverMonitor< Real >:
[legend]
Collaboration diagram for TNL::Solvers::IterativeSolverMonitor< Real >:
[legend]

Public Types

using IndexType = std::size_t
 A type for indexing.
using RealType = Real
 A type of the floating-point arithmetics.

Public Member Functions

 IterativeSolverMonitor ()=default
 Construct with no parameters.
void refresh () override
 Causes that the monitor prints out the status of the solver.
void setIterations (const IndexType &iterations)
 Set number of the current iteration.
void setNodesPerIteration (const IndexType &nodes)
 Set the number of nodes of the numerical mesh or lattice.
void setResidue (const RealType &residue)
 Set residue of the current approximation of the solution.
void setStage (const std::string &stage)
 This method can be used for naming a stage of the monitored solver.
void setTime (const RealType &time)
 Set the time of the simulated evolution if it is time dependent.
void setTimeStep (const RealType &timeStep)
 Set the time step for time dependent iterative solvers.
void setVerbose (const IndexType &verbose)
 Set up the verbosity of the monitor.
Public Member Functions inherited from TNL::Solvers::SolverMonitor
 SolverMonitor ()=default
 Basic construct with no arguments.
bool isStopped () const
 Checks whether the main loop was stopped.
void runMainLoop ()
 Starts the main loop from which the method SolverMonitor::refresh is called in given time periods.
void setRefreshRate (const int &refreshRate)
 Set the time interval between two consecutive calls of SolverMonitor::refresh.
void setTimer (Timer &timer)
 Set a timer object for the solver monitor.
void stopMainLoop ()
 Stops the main loop of the monitor. See runMainLoop.
void unsetTimer ()
 Unsets the timer object for the solver monitor.

Protected Member Functions

int getLineWidth ()
Protected Member Functions inherited from TNL::Solvers::SolverMonitor
double getElapsedTime ()

Protected Attributes

std::atomic_bool attributes_changed { false }
RealType elapsed_time_before_refresh = 0
IndexType iterations = 0
IndexType iterations_before_refresh = 0
RealType last_mlups = 0
IndexType nodesPerIteration = 0
RealType residue = 0
std::atomic_bool saved { false }
IndexType saved_iterations = 0
RealType saved_residue = 0
std::string saved_stage
RealType saved_time = 0
RealType saved_timeStep = 0
std::string stage
RealType time = 0
RealType timeStep = 0
IndexType verbose = 2
Protected Attributes inherited from TNL::Solvers::SolverMonitor
std::atomic_bool started { false }
std::atomic_bool stopped { false }
std::atomic_int timeout_milliseconds { 500 }
Timertimer = nullptr

Detailed Description

template<typename Real = double>
class TNL::Solvers::IterativeSolverMonitor< Real >

Object for monitoring convergence of iterative solvers.

Template Parameters
Realis a type of the floating-point arithmetics.
Indexis an indexing type.

The following example shows how to use the iterative solver monitor for monitoring convergence of linear iterative solver:

1#include <iostream>
2#include <memory>
3#include <TNL/Matrices/SparseMatrix.h>
4#include <TNL/Devices/Sequential.h>
5#include <TNL/Devices/Cuda.h>
6#include <TNL/Solvers/Linear/Jacobi.h>
7
8template< typename Device >
9void
10iterativeLinearSolverExample()
11{
12 /***
13 * Set the following matrix (dots represent zero matrix elements):
14 *
15 * / 2.5 -1 . . . \
16 * | -1 2.5 -1 . . |
17 * | . -1 2.5 -1. . |
18 * | . . -1 2.5 -1 |
19 * \ . . . -1 2.5 /
20 */
23 const int size( 5 );
24 auto matrix_ptr = std::make_shared< MatrixType >();
25 matrix_ptr->setDimensions( size, size );
26 matrix_ptr->setRowCapacities( Vector( { 2, 3, 3, 3, 2 } ) );
27
28 auto f = [ = ] __cuda_callable__( typename MatrixType::RowView & row ) mutable
29 {
30 const int rowIdx = row.getRowIndex();
31 if( rowIdx == 0 ) {
32 row.setElement( 0, rowIdx, 2.5 ); // diagonal element
33 row.setElement( 1, rowIdx + 1, -1 ); // element above the diagonal
34 }
35 else if( rowIdx == size - 1 ) {
36 row.setElement( 0, rowIdx - 1, -1.0 ); // element below the diagonal
37 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
38 }
39 else {
40 row.setElement( 0, rowIdx - 1, -1.0 ); // element below the diagonal
41 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
42 row.setElement( 2, rowIdx + 1, -1.0 ); // element above the diagonal
43 }
44 };
45
46 /***
47 * Set the matrix elements.
48 */
49 matrix_ptr->forAllRows( f );
50 std::cout << *matrix_ptr << '\n';
51
52 /***
53 * Set the right-hand side vector.
54 */
55 Vector x( size, 1.0 );
56 Vector b( size );
57 matrix_ptr->vectorProduct( x, b );
58 x = 0.0;
59 std::cout << "Vector b = " << b << '\n';
60
61 /***
62 * Setup solver of the linear system.
63 */
65 LinearSolver solver;
66 solver.setMatrix( matrix_ptr );
67 solver.setOmega( 0.0005 );
68
69 /***
70 * Setup monitor of the iterative solver.
71 */
72 using IterativeSolverMonitorType = TNL::Solvers::IterativeSolverMonitor< double >;
73 IterativeSolverMonitorType monitor;
74 TNL::Solvers::SolverMonitorThread monitorThread( monitor );
75 monitor.setRefreshRate( 10 ); // refresh rate in milliseconds
76 monitor.setVerbose( 1 );
77 monitor.setStage( "Jacobi stage:" );
78 solver.setSolverMonitor( monitor );
79 solver.setConvergenceResidue( 1.0e-6 );
80 solver.solve( b, x );
81 monitor.stopMainLoop();
82 std::cout << "Vector x = " << x << '\n';
83}
84
85int
86main( int argc, char* argv[] )
87{
88 std::cout << "Solving linear system on host:\n";
89 iterativeLinearSolverExample< TNL::Devices::Sequential >();
90
91#ifdef __CUDACC__
92 std::cout << "Solving linear system on CUDA device:\n";
93 iterativeLinearSolverExample< TNL::Devices::Cuda >();
94#endif
95}
#define __cuda_callable__
This macro serves for annotating functions which are supposed to be called even from the GPU device.
Definition Macros.h:50
Vector extends Array with algebraic operations.
Definition Vector.h:37
Implementation of sparse matrix, i.e. matrix storing only non-zero elements.
Definition SparseMatrix.h:57
Iterative solver of linear systems based on the Jacobi method.
Definition Jacobi.h:21
virtual void setMatrix(const MatrixPointer &matrix)
Set the matrix of the linear system.
Definition LinearSolver.h:120
A RAII wrapper for launching the SolverMonitor's main loop in a separate thread.
Definition SolverMonitor.h:142
T make_shared(T... args)

The result looks as follows:

Solving linear system on host:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
Jacobi stage: ITER: 26205 RES: 0.012901
Jacobi stage: ITER: 52015 RES: 0.00024476
Jacobi stage: ITER: 78087 RES: 4.4646e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]
Solving linear system on CUDA device:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
Jacobi stage: ITER: 3495 RES: 0.43668
Jacobi stage: ITER: 4169 RES: 0.38878
Jacobi stage: ITER: 4645 RES: 0.35926
Jacobi stage: ITER: 5105 RES: 0.33338
Jacobi stage: ITER: 5571 RES: 0.30951
Jacobi stage: ITER: 6027 RES: 0.28795
Jacobi stage: ITER: 6479 RES: 0.26822
Jacobi stage: ITER: 6917 RES: 0.25041
Jacobi stage: ITER: 7379 RES: 0.23313
Jacobi stage: ITER: 7839 RES: 0.21709
Jacobi stage: ITER: 8299 RES: 0.20219
Jacobi stage: ITER: 8743 RES: 0.1888
Jacobi stage: ITER: 9199 RES: 0.17598
Jacobi stage: ITER: 9653 RES: 0.16405
Jacobi stage: ITER: 10115 RES: 0.15284
Jacobi stage: ITER: 10571 RES: 0.14249
Jacobi stage: ITER: 11025 RES: 0.13284
Jacobi stage: ITER: 11483 RES: 0.12385
Jacobi stage: ITER: 11879 RES: 0.11653
Jacobi stage: ITER: 12175 RES: 0.11135
Jacobi stage: ITER: 12467 RES: 0.10647
Jacobi stage: ITER: 12761 RES: 0.10173
Jacobi stage: ITER: 13055 RES: 0.097271
Jacobi stage: ITER: 13345 RES: 0.093004
Jacobi stage: ITER: 13615 RES: 0.089252
Jacobi stage: ITER: 13899 RES: 0.085442
Jacobi stage: ITER: 14191 RES: 0.081694
Jacobi stage: ITER: 14619 RES: 0.076496
Jacobi stage: ITER: 15071 RES: 0.071365
Jacobi stage: ITER: 15529 RES: 0.066496
Jacobi stage: ITER: 15993 RES: 0.061922
Jacobi stage: ITER: 16455 RES: 0.057697
Jacobi stage: ITER: 16915 RES: 0.053761
Jacobi stage: ITER: 17371 RES: 0.050125
Jacobi stage: ITER: 17835 RES: 0.046676
Jacobi stage: ITER: 18291 RES: 0.043519
Jacobi stage: ITER: 18749 RES: 0.04055
Jacobi stage: ITER: 19203 RES: 0.03783
Jacobi stage: ITER: 19665 RES: 0.035228
Jacobi stage: ITER: 20133 RES: 0.032784
Jacobi stage: ITER: 20599 RES: 0.030529
Jacobi stage: ITER: 21051 RES: 0.028481
Jacobi stage: ITER: 21487 RES: 0.026637
Jacobi stage: ITER: 21945 RES: 0.024819
Jacobi stage: ITER: 22411 RES: 0.023112
Jacobi stage: ITER: 22875 RES: 0.021522
Jacobi stage: ITER: 23329 RES: 0.020066
Jacobi stage: ITER: 23771 RES: 0.018755
Jacobi stage: ITER: 24235 RES: 0.017465
Jacobi stage: ITER: 24691 RES: 0.016283
Jacobi stage: ITER: 25151 RES: 0.015173
Jacobi stage: ITER: 25607 RES: 0.014146
Jacobi stage: ITER: 26065 RES: 0.013181
Jacobi stage: ITER: 26519 RES: 0.012297
Jacobi stage: ITER: 26975 RES: 0.011465
Jacobi stage: ITER: 27435 RES: 0.010683
Jacobi stage: ITER: 27905 RES: 0.009936
Jacobi stage: ITER: 28369 RES: 0.0092525
Jacobi stage: ITER: 28831 RES: 0.0086213
Jacobi stage: ITER: 29281 RES: 0.008043
Jacobi stage: ITER: 29723 RES: 0.0075174
Jacobi stage: ITER: 30155 RES: 0.0070348
Jacobi stage: ITER: 30605 RES: 0.0065629
Jacobi stage: ITER: 31059 RES: 0.0061227
Jacobi stage: ITER: 31519 RES: 0.0057051
Jacobi stage: ITER: 31975 RES: 0.0053191
Jacobi stage: ITER: 32441 RES: 0.0049502
Jacobi stage: ITER: 32899 RES: 0.0046153
Jacobi stage: ITER: 33347 RES: 0.0043084
Jacobi stage: ITER: 33803 RES: 0.004017
Jacobi stage: ITER: 34259 RES: 0.0037452
Jacobi stage: ITER: 34713 RES: 0.0034919
Jacobi stage: ITER: 35173 RES: 0.0032537
Jacobi stage: ITER: 35639 RES: 0.0030299
Jacobi stage: ITER: 36103 RES: 0.0028214
Jacobi stage: ITER: 36561 RES: 0.002629
Jacobi stage: ITER: 37023 RES: 0.0024496
Jacobi stage: ITER: 37475 RES: 0.0022853
Jacobi stage: ITER: 37933 RES: 0.0021294
Jacobi stage: ITER: 38383 RES: 0.0019878
Jacobi stage: ITER: 38817 RES: 0.001859
Jacobi stage: ITER: 39265 RES: 0.0017354
Jacobi stage: ITER: 39717 RES: 0.001619
Jacobi stage: ITER: 40187 RES: 0.0015067
Jacobi stage: ITER: 40653 RES: 0.0014022
Jacobi stage: ITER: 41113 RES: 0.0013066
Jacobi stage: ITER: 41563 RES: 0.0012197
Jacobi stage: ITER: 42015 RES: 0.0011379
Jacobi stage: ITER: 42455 RES: 0.0010635
Jacobi stage: ITER: 42895 RES: 0.000994
Jacobi stage: ITER: 43335 RES: 0.00092904
Jacobi stage: ITER: 43775 RES: 0.00086832
Jacobi stage: ITER: 44215 RES: 0.00081158
Jacobi stage: ITER: 44655 RES: 0.00075854
Jacobi stage: ITER: 45095 RES: 0.00070897
Jacobi stage: ITER: 45533 RES: 0.00066264
Jacobi stage: ITER: 45971 RES: 0.00061971
Jacobi stage: ITER: 46411 RES: 0.00057921
Jacobi stage: ITER: 46851 RES: 0.00054136
Jacobi stage: ITER: 47289 RES: 0.00050598
Jacobi stage: ITER: 47727 RES: 0.00047321
Jacobi stage: ITER: 48167 RES: 0.00044228
Jacobi stage: ITER: 48607 RES: 0.00041338
Jacobi stage: ITER: 49045 RES: 0.00038636
Jacobi stage: ITER: 49483 RES: 0.00036134
Jacobi stage: ITER: 49923 RES: 0.00033772
Jacobi stage: ITER: 50363 RES: 0.00031565
Jacobi stage: ITER: 50803 RES: 0.00029502
Jacobi stage: ITER: 51243 RES: 0.00027574
Jacobi stage: ITER: 51681 RES: 0.00025772
Jacobi stage: ITER: 52121 RES: 0.00024088
Jacobi stage: ITER: 52559 RES: 0.00022528
Jacobi stage: ITER: 52999 RES: 0.00021055
Jacobi stage: ITER: 53439 RES: 0.00019679
Jacobi stage: ITER: 53877 RES: 0.00018393
Jacobi stage: ITER: 54317 RES: 0.00017191
Jacobi stage: ITER: 54755 RES: 0.00016078
Jacobi stage: ITER: 55195 RES: 0.00015027
Jacobi stage: ITER: 55635 RES: 0.00014045
Jacobi stage: ITER: 56075 RES: 0.00013127
Jacobi stage: ITER: 56513 RES: 0.00012269
Jacobi stage: ITER: 56953 RES: 0.00011467
Jacobi stage: ITER: 57391 RES: 0.00010725
Jacobi stage: ITER: 57831 RES: 0.00010024
Jacobi stage: ITER: 58271 RES: 9.3687e-05
Jacobi stage: ITER: 58711 RES: 8.7564e-05
Jacobi stage: ITER: 59151 RES: 8.1842e-05
Jacobi stage: ITER: 59589 RES: 7.6493e-05
Jacobi stage: ITER: 60029 RES: 7.1494e-05
Jacobi stage: ITER: 60467 RES: 6.6863e-05
Jacobi stage: ITER: 60907 RES: 6.2494e-05
Jacobi stage: ITER: 61347 RES: 5.8409e-05
Jacobi stage: ITER: 61787 RES: 5.4592e-05
Jacobi stage: ITER: 62227 RES: 5.1025e-05
Jacobi stage: ITER: 62665 RES: 4.769e-05
Jacobi stage: ITER: 63103 RES: 4.4601e-05
Jacobi stage: ITER: 63543 RES: 4.1686e-05
Jacobi stage: ITER: 63981 RES: 3.8962e-05
Jacobi stage: ITER: 64419 RES: 3.6438e-05
Jacobi stage: ITER: 64857 RES: 3.4057e-05
Jacobi stage: ITER: 65295 RES: 3.1851e-05
Jacobi stage: ITER: 65735 RES: 2.9769e-05
Jacobi stage: ITER: 66171 RES: 2.7841e-05
Jacobi stage: ITER: 66611 RES: 2.6021e-05
Jacobi stage: ITER: 67049 RES: 2.4321e-05
Jacobi stage: ITER: 67487 RES: 2.2745e-05
Jacobi stage: ITER: 67925 RES: 2.1259e-05
Jacobi stage: ITER: 68363 RES: 1.9882e-05
Jacobi stage: ITER: 68803 RES: 1.8583e-05
Jacobi stage: ITER: 69239 RES: 1.7379e-05
Jacobi stage: ITER: 69679 RES: 1.6243e-05
Jacobi stage: ITER: 70115 RES: 1.5191e-05
Jacobi stage: ITER: 70563 RES: 1.4181e-05
Jacobi stage: ITER: 71001 RES: 1.3254e-05
Jacobi stage: ITER: 71439 RES: 1.2395e-05
Jacobi stage: ITER: 71879 RES: 1.1585e-05
Jacobi stage: ITER: 72317 RES: 1.0828e-05
Jacobi stage: ITER: 72755 RES: 1.0127e-05
Jacobi stage: ITER: 73193 RES: 9.465e-06
Jacobi stage: ITER: 73631 RES: 8.8519e-06
Jacobi stage: ITER: 74069 RES: 8.2734e-06
Jacobi stage: ITER: 74507 RES: 7.7375e-06
Jacobi stage: ITER: 74943 RES: 7.2363e-06
Jacobi stage: ITER: 75383 RES: 6.7634e-06
Jacobi stage: ITER: 75819 RES: 6.3253e-06
Jacobi stage: ITER: 76257 RES: 5.9119e-06
Jacobi stage: ITER: 76695 RES: 5.529e-06
Jacobi stage: ITER: 77133 RES: 5.1676e-06
Jacobi stage: ITER: 77571 RES: 4.8329e-06
Jacobi stage: ITER: 78009 RES: 4.5171e-06
Jacobi stage: ITER: 78453 RES: 4.2193e-06
Jacobi stage: ITER: 78891 RES: 3.946e-06
Jacobi stage: ITER: 79331 RES: 3.6881e-06
Jacobi stage: ITER: 79769 RES: 3.4471e-06
Jacobi stage: ITER: 80207 RES: 3.2238e-06
Jacobi stage: ITER: 80647 RES: 3.0131e-06
Jacobi stage: ITER: 81085 RES: 2.8162e-06
Jacobi stage: ITER: 81523 RES: 2.6338e-06
Jacobi stage: ITER: 81961 RES: 2.4616e-06
Jacobi stage: ITER: 82399 RES: 2.3022e-06
Jacobi stage: ITER: 82839 RES: 2.1517e-06
Jacobi stage: ITER: 83277 RES: 2.0111e-06
Jacobi stage: ITER: 83715 RES: 1.8808e-06
Jacobi stage: ITER: 84153 RES: 1.7579e-06
Jacobi stage: ITER: 84591 RES: 1.644e-06
Jacobi stage: ITER: 85031 RES: 1.5366e-06
Jacobi stage: ITER: 85469 RES: 1.4362e-06
Jacobi stage: ITER: 85907 RES: 1.3432e-06
Jacobi stage: ITER: 86347 RES: 1.2554e-06
Jacobi stage: ITER: 86785 RES: 1.1733e-06
Jacobi stage: ITER: 87223 RES: 1.0973e-06
Jacobi stage: ITER: 87663 RES: 1.0256e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]

The following example shows how to employ timer (TNL::Timer) to the monitor of iterative solvers:

1#include <iostream>
2#include <memory>
3#include <TNL/Timer.h>
4#include <TNL/Matrices/SparseMatrix.h>
5#include <TNL/Devices/Sequential.h>
6#include <TNL/Devices/Cuda.h>
7#include <TNL/Solvers/Linear/Jacobi.h>
8
9template< typename Device >
10void
11iterativeLinearSolverExample()
12{
13 /***
14 * Set the following matrix (dots represent zero matrix elements):
15 *
16 * / 2.5 -1 . . . \
17 * | -1 2.5 -1 . . |
18 * | . -1 2.5 -1. . |
19 * | . . -1 2.5 -1 |
20 * \ . . . -1 2.5 /
21 */
24 const int size( 5 );
25 auto matrix_ptr = std::make_shared< MatrixType >();
26 matrix_ptr->setDimensions( size, size );
27 matrix_ptr->setRowCapacities( Vector( { 2, 3, 3, 3, 2 } ) );
28
29 auto f = [ = ] __cuda_callable__( typename MatrixType::RowView & row ) mutable
30 {
31 const int rowIdx = row.getRowIndex();
32 if( rowIdx == 0 ) {
33 row.setElement( 0, rowIdx, 2.5 ); // diagonal element
34 row.setElement( 1, rowIdx + 1, -1 ); // element above the diagonal
35 }
36 else if( rowIdx == size - 1 ) {
37 row.setElement( 0, rowIdx - 1, -1.0 ); // element below the diagonal
38 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
39 }
40 else {
41 row.setElement( 0, rowIdx - 1, -1.0 ); // element below the diagonal
42 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
43 row.setElement( 2, rowIdx + 1, -1.0 ); // element above the diagonal
44 }
45 };
46
47 /***
48 * Set the matrix elements.
49 */
50 matrix_ptr->forAllRows( f );
51 std::cout << *matrix_ptr << '\n';
52
53 /***
54 * Set the right-hand side vector.
55 */
56 Vector x( size, 1.0 );
57 Vector b( size );
58 matrix_ptr->vectorProduct( x, b );
59 x = 0.0;
60 std::cout << "Vector b = " << b << '\n';
61
62 /***
63 * Setup solver of the linear system.
64 */
66 LinearSolver solver;
67 solver.setMatrix( matrix_ptr );
68 solver.setOmega( 0.0005 );
69
70 /***
71 * Setup monitor of the iterative solver.
72 */
73 using IterativeSolverMonitorType = TNL::Solvers::IterativeSolverMonitor< double >;
74 IterativeSolverMonitorType monitor;
75 TNL::Solvers::SolverMonitorThread mmonitorThread( monitor );
76 monitor.setRefreshRate( 10 ); // refresh rate in milliseconds
77 monitor.setVerbose( 1 );
78 monitor.setStage( "Jacobi stage:" );
79 TNL::Timer timer;
80 monitor.setTimer( timer );
81 timer.start();
82 solver.setSolverMonitor( monitor );
83 solver.setConvergenceResidue( 1.0e-6 );
84 solver.solve( b, x );
85 monitor.stopMainLoop();
86 std::cout << "Vector x = " << x << '\n';
87}
88
89int
90main( int argc, char* argv[] )
91{
92 std::cout << "Solving linear system on host:\n";
93 iterativeLinearSolverExample< TNL::Devices::Sequential >();
94
95#ifdef __CUDACC__
96 std::cout << "Solving linear system on CUDA device:\n";
97 iterativeLinearSolverExample< TNL::Devices::Cuda >();
98#endif
99}
Class for real time, CPU time and CPU cycles measuring.
Definition Timer.h:25
void start()
Starts timer.

The result looks as follows:

Solving linear system on host:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
ELA:1.396e-0
ELA: 0.10012 Jacobi stage: ITER: 28855 RES: 0.0085896
ELA: 0.20027 Jacobi stage: ITER: 58387 RES: 9.1976e-05
ELA: 0.30039 Jacobi stage: ITER: 87039 RES: 1.1288e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]
Solving linear system on CUDA device:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
ELA:1.7071e-
ELA: 0.10013 Jacobi stage: ITER: 663 RES: 0.81092
ELA: 0.20025 Jacobi stage: ITER: 1163 RES: 0.70781
ELA: 0.30034 Jacobi stage: ITER: 1619 RES: 0.63368
ELA: 0.40046 Jacobi stage: ITER: 2085 RES: 0.57157
ELA: 0.50059 Jacobi stage: ITER: 2543 RES: 0.52095
ELA: 0.60073 Jacobi stage: ITER: 2991 RES: 0.4783
ELA: 0.70086 Jacobi stage: ITER: 3435 RES: 0.44133
ELA: 0.80098 Jacobi stage: ITER: 3889 RES: 0.40767
ELA: 0.90259 Jacobi stage: ITER: 4351 RES: 0.37726
ELA: 1.0027 Jacobi stage: ITER: 4813 RES: 0.34953
ELA: 1.1028 Jacobi stage: ITER: 5255 RES: 0.32554
ELA: 1.2029 Jacobi stage: ITER: 5707 RES: 0.3029
ELA: 1.3031 Jacobi stage: ITER: 6163 RES: 0.28185
ELA: 1.4032 Jacobi stage: ITER: 6625 RES: 0.26208
ELA: 1.5033 Jacobi stage: ITER: 7079 RES: 0.24425
ELA: 1.6034 Jacobi stage: ITER: 7531 RES: 0.2277
ELA: 1.7035 Jacobi stage: ITER: 7991 RES: 0.21204
ELA: 1.8038 Jacobi stage: ITER: 8409 RES: 0.19872
ELA: 1.9039 Jacobi stage: ITER: 8703 RES: 0.18997
ELA: 2.004 Jacobi stage: ITER: 8995 RES: 0.1816
ELA: 2.1043 Jacobi stage: ITER: 9291 RES: 0.17351
ELA: 2.2044 Jacobi stage: ITER: 9583 RES: 0.16588
ELA: 2.3046 Jacobi stage: ITER: 9873 RES: 0.15859
ELA: 2.4047 Jacobi stage: ITER: 10149 RES: 0.15199
ELA: 2.5048 Jacobi stage: ITER: 10419 RES: 0.14586
ELA: 2.6053 Jacobi stage: ITER: 10713 RES: 0.13937
ELA: 2.7055 Jacobi stage: ITER: 11111 RES: 0.13113
ELA: 2.8056 Jacobi stage: ITER: 11567 RES: 0.12226
ELA: 2.9057 Jacobi stage: ITER: 12011 RES: 0.11419
ELA: 3.0059 Jacobi stage: ITER: 12471 RES: 0.1064
ELA: 3.1093 Jacobi stage: ITER: 12951 RES: 0.098837
ELA: 3.2094 Jacobi stage: ITER: 13411 RES: 0.092094
ELA: 3.3103 Jacobi stage: ITER: 13871 RES: 0.08581
ELA: 3.4105 Jacobi stage: ITER: 14331 RES: 0.079956
ELA: 3.5107 Jacobi stage: ITER: 14791 RES: 0.074501
ELA: 3.6108 Jacobi stage: ITER: 15247 RES: 0.069461
ELA: 3.7109 Jacobi stage: ITER: 15701 RES: 0.064762
ELA: 3.8151 Jacobi stage: ITER: 16181 RES: 0.060159
ELA: 3.9153 Jacobi stage: ITER: 16649 RES: 0.055986
ELA: 4.0154 Jacobi stage: ITER: 17117 RES: 0.052103
ELA: 4.1155 Jacobi stage: ITER: 17567 RES: 0.048638
ELA: 4.2156 Jacobi stage: ITER: 18003 RES: 0.045487
ELA: 4.3163 Jacobi stage: ITER: 18457 RES: 0.04241
ELA: 4.4165 Jacobi stage: ITER: 18919 RES: 0.039517
ELA: 4.5173 Jacobi stage: ITER: 19383 RES: 0.036799
ELA: 4.6175 Jacobi stage: ITER: 19837 RES: 0.034309
ELA: 4.7177 Jacobi stage: ITER: 20279 RES: 0.032067
ELA: 4.8178 Jacobi stage: ITER: 20731 RES: 0.029916
ELA: 4.9179 Jacobi stage: ITER: 21185 RES: 0.027893
ELA: 5.018 Jacobi stage: ITER: 21645 RES: 0.02599
ELA: 5.1182 Jacobi stage: ITER: 22095 RES: 0.024262
ELA: 5.2183 Jacobi stage: ITER: 22555 RES: 0.022606
ELA: 5.3203 Jacobi stage: ITER: 23017 RES: 0.021051
ELA: 5.4205 Jacobi stage: ITER: 23475 RES: 0.019627
ELA: 5.5206 Jacobi stage: ITER: 23933 RES: 0.018288
ELA: 5.6207 Jacobi stage: ITER: 24403 RES: 0.01702
ELA: 5.7208 Jacobi stage: ITER: 24867 RES: 0.015849
ELA: 5.8209 Jacobi stage: ITER: 25329 RES: 0.014759
ELA: 5.921 Jacobi stage: ITER: 25775 RES: 0.013786
ELA: 6.0212 Jacobi stage: ITER: 26211 RES: 0.012893
ELA: 6.1215 Jacobi stage: ITER: 26639 RES: 0.012072
ELA: 6.2216 Jacobi stage: ITER: 27091 RES: 0.011263
ELA: 6.3217 Jacobi stage: ITER: 27537 RES: 0.010514
ELA: 6.4224 Jacobi stage: ITER: 27995 RES: 0.0098026
ELA: 6.5225 Jacobi stage: ITER: 28451 RES: 0.0091395
ELA: 6.6226 Jacobi stage: ITER: 28915 RES: 0.0085108
ELA: 6.7233 Jacobi stage: ITER: 29379 RES: 0.0079253
ELA: 6.8234 Jacobi stage: ITER: 29823 RES: 0.0074028
ELA: 6.9236 Jacobi stage: ITER: 30281 RES: 0.0068978
ELA: 7.0237 Jacobi stage: ITER: 30735 RES: 0.0064352
ELA: 7.1239 Jacobi stage: ITER: 31191 RES: 0.0059998
ELA: 7.224 Jacobi stage: ITER: 31647 RES: 0.005594
ELA: 7.3241 Jacobi stage: ITER: 32113 RES: 0.005206
ELA: 7.4243 Jacobi stage: ITER: 32579 RES: 0.0048478
ELA: 7.5244 Jacobi stage: ITER: 33035 RES: 0.0045199
ELA: 7.6248 Jacobi stage: ITER: 33495 RES: 0.0042116
ELA: 7.725 Jacobi stage: ITER: 33941 RES: 0.0039315
ELA: 7.8251 Jacobi stage: ITER: 34397 RES: 0.0036656
ELA: 7.9252 Jacobi stage: ITER: 34847 RES: 0.0034218
ELA: 8.0253 Jacobi stage: ITER: 35277 RES: 0.0032021
ELA: 8.1263 Jacobi stage: ITER: 35729 RES: 0.0029873
ELA: 8.2265 Jacobi stage: ITER: 36175 RES: 0.0027904
ELA: 8.3266 Jacobi stage: ITER: 36637 RES: 0.0025984
ELA: 8.4268 Jacobi stage: ITER: 37103 RES: 0.0024197
ELA: 8.5269 Jacobi stage: ITER: 37563 RES: 0.0022546
ELA: 8.6271 Jacobi stage: ITER: 38007 RES: 0.002106
ELA: 8.7272 Jacobi stage: ITER: 38463 RES: 0.0019635
ELA: 8.8273 Jacobi stage: ITER: 38903 RES: 0.0018352
ELA: 8.9275 Jacobi stage: ITER: 39343 RES: 0.0017153
ELA: 9.0276 Jacobi stage: ITER: 39783 RES: 0.0016032
ELA: 9.1277 Jacobi stage: ITER: 40223 RES: 0.0014984
ELA: 9.2279 Jacobi stage: ITER: 40663 RES: 0.0014005
ELA: 9.328 Jacobi stage: ITER: 41101 RES: 0.001309
ELA: 9.4281 Jacobi stage: ITER: 41543 RES: 0.0012234
ELA: 9.5282 Jacobi stage: ITER: 41981 RES: 0.0011435
ELA: 9.6284 Jacobi stage: ITER: 42419 RES: 0.0010694
ELA: 9.7285 Jacobi stage: ITER: 42859 RES: 0.00099951
ELA: 9.8286 Jacobi stage: ITER: 43299 RES: 0.00093419
ELA: 9.9288 Jacobi stage: ITER: 43737 RES: 0.00087314
ELA: 10.029 Jacobi stage: ITER: 44175 RES: 0.00081658
ELA: 10.129 Jacobi stage: ITER: 44615 RES: 0.00076322
ELA: 10.229 Jacobi stage: ITER: 45055 RES: 0.00071334
ELA: 10.329 Jacobi stage: ITER: 45493 RES: 0.00066672
ELA: 10.429 Jacobi stage: ITER: 45933 RES: 0.00062315
ELA: 10.53 Jacobi stage: ITER: 46373 RES: 0.00058243
ELA: 10.63 Jacobi stage: ITER: 46811 RES: 0.0005447
ELA: 10.73 Jacobi stage: ITER: 47251 RES: 0.0005091
ELA: 10.83 Jacobi stage: ITER: 47691 RES: 0.00047583
ELA: 10.93 Jacobi stage: ITER: 48131 RES: 0.00044473
ELA: 11.03 Jacobi stage: ITER: 48571 RES: 0.00041567
ELA: 11.13 Jacobi stage: ITER: 49009 RES: 0.00038851
ELA: 11.23 Jacobi stage: ITER: 49447 RES: 0.00036312
ELA: 11.331 Jacobi stage: ITER: 49887 RES: 0.00033959
ELA: 11.431 Jacobi stage: ITER: 50327 RES: 0.0003174
ELA: 11.531 Jacobi stage: ITER: 50767 RES: 0.00029666
ELA: 11.631 Jacobi stage: ITER: 51207 RES: 0.00027727
ELA: 11.731 Jacobi stage: ITER: 51645 RES: 0.00025915
ELA: 11.831 Jacobi stage: ITER: 52085 RES: 0.00024222
ELA: 11.931 Jacobi stage: ITER: 52523 RES: 0.00022653
ELA: 12.031 Jacobi stage: ITER: 52963 RES: 0.00021172
ELA: 12.132 Jacobi stage: ITER: 53403 RES: 0.00019789
ELA: 12.232 Jacobi stage: ITER: 53843 RES: 0.00018495
ELA: 12.332 Jacobi stage: ITER: 54283 RES: 0.00017287
ELA: 12.432 Jacobi stage: ITER: 54721 RES: 0.00016157
ELA: 12.532 Jacobi stage: ITER: 55161 RES: 0.00015101
ELA: 12.632 Jacobi stage: ITER: 55601 RES: 0.00014114
ELA: 12.732 Jacobi stage: ITER: 56039 RES: 0.000132
ELA: 12.833 Jacobi stage: ITER: 56479 RES: 0.00012337
ELA: 12.933 Jacobi stage: ITER: 56919 RES: 0.00011531
ELA: 13.033 Jacobi stage: ITER: 57359 RES: 0.00010777
ELA: 13.133 Jacobi stage: ITER: 57797 RES: 0.00010073
ELA: 13.233 Jacobi stage: ITER: 58237 RES: 9.4148e-05
ELA: 13.333 Jacobi stage: ITER: 58677 RES: 8.7996e-05
ELA: 13.433 Jacobi stage: ITER: 59115 RES: 8.2296e-05
ELA: 13.534 Jacobi stage: ITER: 59555 RES: 7.6917e-05
ELA: 13.634 Jacobi stage: ITER: 59995 RES: 7.1891e-05
ELA: 13.734 Jacobi stage: ITER: 60433 RES: 6.7193e-05
ELA: 13.834 Jacobi stage: ITER: 60871 RES: 6.284e-05
ELA: 13.934 Jacobi stage: ITER: 61309 RES: 5.8733e-05
ELA: 14.034 Jacobi stage: ITER: 61747 RES: 5.4929e-05
ELA: 14.134 Jacobi stage: ITER: 62185 RES: 5.1339e-05
ELA: 14.234 Jacobi stage: ITER: 62623 RES: 4.8013e-05
ELA: 14.335 Jacobi stage: ITER: 63063 RES: 4.4876e-05
ELA: 14.435 Jacobi stage: ITER: 63499 RES: 4.1969e-05
ELA: 14.535 Jacobi stage: ITER: 63939 RES: 3.9226e-05
ELA: 14.635 Jacobi stage: ITER: 64377 RES: 3.6663e-05
ELA: 14.735 Jacobi stage: ITER: 64815 RES: 3.4288e-05
ELA: 14.835 Jacobi stage: ITER: 65253 RES: 3.2047e-05
ELA: 14.935 Jacobi stage: ITER: 65691 RES: 2.9971e-05
ELA: 15.035 Jacobi stage: ITER: 66131 RES: 2.8012e-05
ELA: 15.136 Jacobi stage: ITER: 66567 RES: 2.6198e-05
ELA: 15.236 Jacobi stage: ITER: 66989 RES: 2.4546e-05
ELA: 15.336 Jacobi stage: ITER: 67427 RES: 2.2956e-05
ELA: 15.436 Jacobi stage: ITER: 67865 RES: 2.1456e-05
ELA: 15.536 Jacobi stage: ITER: 68303 RES: 2.0066e-05
ELA: 15.636 Jacobi stage: ITER: 68743 RES: 1.8755e-05
ELA: 15.736 Jacobi stage: ITER: 69181 RES: 1.7529e-05
ELA: 15.836 Jacobi stage: ITER: 69619 RES: 1.6394e-05
ELA: 15.936 Jacobi stage: ITER: 70055 RES: 1.5332e-05
ELA: 16.037 Jacobi stage: ITER: 70495 RES: 1.433e-05
ELA: 16.137 Jacobi stage: ITER: 70931 RES: 1.3401e-05
ELA: 16.237 Jacobi stage: ITER: 71371 RES: 1.2526e-05
ELA: 16.337 Jacobi stage: ITER: 71807 RES: 1.1714e-05
ELA: 16.437 Jacobi stage: ITER: 72247 RES: 1.0949e-05
ELA: 16.537 Jacobi stage: ITER: 72683 RES: 1.0239e-05
ELA: 16.637 Jacobi stage: ITER: 73121 RES: 9.5703e-06
ELA: 16.737 Jacobi stage: ITER: 73559 RES: 8.9504e-06
ELA: 16.838 Jacobi stage: ITER: 73997 RES: 8.3654e-06
ELA: 16.938 Jacobi stage: ITER: 74435 RES: 7.8236e-06
ELA: 17.038 Jacobi stage: ITER: 74861 RES: 7.3258e-06
ELA: 17.138 Jacobi stage: ITER: 75299 RES: 6.8512e-06
ELA: 17.238 Jacobi stage: ITER: 75739 RES: 6.4035e-06
ELA: 17.338 Jacobi stage: ITER: 76177 RES: 5.985e-06
ELA: 17.438 Jacobi stage: ITER: 76615 RES: 5.5973e-06
ELA: 17.538 Jacobi stage: ITER: 77055 RES: 5.2315e-06
ELA: 17.639 Jacobi stage: ITER: 77493 RES: 4.8896e-06
ELA: 17.739 Jacobi stage: ITER: 77931 RES: 4.5729e-06
ELA: 17.839 Jacobi stage: ITER: 78371 RES: 4.2741e-06
ELA: 17.939 Jacobi stage: ITER: 78809 RES: 3.9947e-06
ELA: 18.039 Jacobi stage: ITER: 79247 RES: 3.736e-06
ELA: 18.139 Jacobi stage: ITER: 79685 RES: 3.4918e-06
ELA: 18.239 Jacobi stage: ITER: 80123 RES: 3.2656e-06
ELA: 18.34 Jacobi stage: ITER: 80563 RES: 3.0522e-06
ELA: 18.44 Jacobi stage: ITER: 81001 RES: 2.8528e-06
ELA: 18.54 Jacobi stage: ITER: 81439 RES: 2.668e-06
ELA: 18.64 Jacobi stage: ITER: 81879 RES: 2.4936e-06
ELA: 18.74 Jacobi stage: ITER: 82317 RES: 2.3306e-06
ELA: 18.84 Jacobi stage: ITER: 82755 RES: 2.1797e-06
ELA: 18.94 Jacobi stage: ITER: 83195 RES: 2.0372e-06
ELA: 19.041 Jacobi stage: ITER: 83633 RES: 1.9041e-06
ELA: 19.141 Jacobi stage: ITER: 84071 RES: 1.7807e-06
ELA: 19.241 Jacobi stage: ITER: 84643 RES: 1.631e-06
ELA: 19.341 Jacobi stage: ITER: 85329 RES: 1.4674e-06
ELA: 19.441 Jacobi stage: ITER: 85987 RES: 1.3268e-06
ELA: 19.541 Jacobi stage: ITER: 86659 RES: 1.1966e-06
ELA: 19.642 Jacobi stage: ITER: 87319 RES: 1.0813e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]

Member Function Documentation

◆ refresh()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::refresh ( )
overridevirtual

Causes that the monitor prints out the status of the solver.

Implements TNL::Solvers::SolverMonitor.

◆ setIterations()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setIterations ( const IndexType & iterations)

Set number of the current iteration.

Parameters
iterationsis number of the current iteration.

◆ setNodesPerIteration()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setNodesPerIteration ( const IndexType & nodes)

Set the number of nodes of the numerical mesh or lattice.

This can be used to compute the number of nodes processed per one second.

Parameters
nodesis number of nodes of the numerical mesh or lattice.

◆ setResidue()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setResidue ( const RealType & residue)

Set residue of the current approximation of the solution.

Parameters
residueis a residue of the current approximation of the solution.

◆ setStage()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setStage ( const std::string & stage)

This method can be used for naming a stage of the monitored solver.

The stage name can be used to differ between various stages of iterative solvers.

Parameters
stageis name of the solver stage.

◆ setTime()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setTime ( const RealType & time)

Set the time of the simulated evolution if it is time dependent.

This can be used for example when solving parabolic or hyperbolic PDEs.

Parameters
timetime of the simulated evolution.

◆ setTimeStep()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setTimeStep ( const RealType & timeStep)

Set the time step for time dependent iterative solvers.

Parameters
timeSteptime step of the time dependent iterative solver.

◆ setVerbose()

template<typename Real = double>
void TNL::Solvers::IterativeSolverMonitor< Real >::setVerbose ( const IndexType & verbose)

Set up the verbosity of the monitor.

Parameters
verboseis the new value of the verbosity of the monitor.

The documentation for this class was generated from the following file: