OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
petsc_AMG_report Class Reference

Class to test AMG solvers. More...

Detailed Description

Class to test AMG solvers.

Definition at line 42 of file petsc_solver_AMG_report.hpp.

#include <petsc_solver_AMG_report.hpp>

Public Member Functions

void setTergetAMGAccuracy (double t_a)
 Set the target accuracy to score the AMG solver.
 
void setMaxSweep (int max_sw)
 Set the target accuracy to score the AMG solver.
 
void try_solve (SparseMatrix< double, int, PETSC_BASE > &A, const Vector< double, PETSC_BASE > &b)
 Try to use AMG pre-conditioner and check how they they perform.
 

Private Member Functions

void benchmark (SparseMatrix< double, int, PETSC_BASE > &A, const Vector< double, PETSC_BASE > &b, petsc_solver< double > &solver, openfpm::vector< AMG_time_err_coars > &perf_amg)
 benchmark the selected setting for the preconditioner
 
void test_coarsener (SparseMatrix< double, int, PETSC_BASE > &A, const Vector< double, PETSC_BASE > &b)
 test the corasener for this problem
 
double score_solver (double t_solve, double t_m)
 Score the solver.
 
void write_report_coars (GoogleChart &cg)
 Write the report for coarsening.
 
void write_report_cycle (GoogleChart &cg, openfpm::vector< std::string > &coars)
 Write the report for coarsening.
 
void write_report_cycle_asym (GoogleChart &cg, openfpm::vector< std::string > &coars)
 Write the report for coarsening.
 
void test_cycle_type (SparseMatrix< double, int, PETSC_BASE > &A, const Vector< double, PETSC_BASE > &b, openfpm::vector< std::string > &coarsener_to_test)
 test the corasener for this problem
 
void test_cycle_asym (SparseMatrix< double, int, PETSC_BASE > &A, const Vector< double, PETSC_BASE > &b, openfpm::vector< size_t > &ids_ts, openfpm::vector< std::string > &coarsener_to_test)
 test best asymmetric combination of sweeps
 
void write_report (openfpm::vector< std::string > &coars)
 
void best_coarsener (openfpm::vector< std::string > &coars)
 take the most accurate and the fastest AMG
 
void best_score (openfpm::vector< AMG_time_err_coars > &perf, openfpm::vector< size_t > &sw_optimal, size_t nm)
 Return the best scoring solver.
 

Private Attributes

size_t num_sweep_test = 10
 Number of sweeps for test.
 
double target_accuracy = 1
 Target accuracy for the preconditioner.
 
openfpm::vector< AMG_time_err_coarsperf_amg_coars
 It contains the performance of several AMG methods coarsener.
 
openfpm::vector< AMG_time_err_coarsperf_amg_sweep_sym
 It contain the performance of several AMG methods sweep configuration.
 
openfpm::vector< AMG_time_err_coarsperf_amg_sweep_asym
 It contain the performance of several AMG methods sweep configuration.
 
openfpm::vector< std::string > method
 List of methods.
 
openfpm::vector< size_t > v_cycle_tested_sym
 List of tested cycles.
 
openfpm::vector< std::pair< size_t, size_t > > v_cycle_tested_asym
 List of tested cycles in case of asymmetric.
 
openfpm::vector< size_t > asym_tests
 starting point of each coarsening test for the asymmetric test
 

Member Function Documentation

◆ benchmark()

void petsc_AMG_report::benchmark ( SparseMatrix< double, int, PETSC_BASE > &  A,
const Vector< double, PETSC_BASE > &  b,
petsc_solver< double > &  solver,
openfpm::vector< AMG_time_err_coars > &  perf_amg 
)
inlineprivate

benchmark the selected setting for the preconditioner

Parameters
Asparse matrix
bright-hand-side
solverto use for benchmarking
perf_amgperformance of the AMG

Definition at line 79 of file petsc_solver_AMG_report.hpp.

◆ best_coarsener()

void petsc_AMG_report::best_coarsener ( openfpm::vector< std::string > &  coars)
inlineprivate

take the most accurate and the fastest AMG

Parameters
coarsvector with the best coarsener

Definition at line 481 of file petsc_solver_AMG_report.hpp.

◆ best_score()

void petsc_AMG_report::best_score ( openfpm::vector< AMG_time_err_coars > &  perf,
openfpm::vector< size_t > &  sw_optimal,
size_t  nm 
)
inlineprivate

Return the best scoring solver.

Parameters
perfwhere to search for the best score
optimalnumber of sweeps for each tested method
mnnumber of method tested

Definition at line 514 of file petsc_solver_AMG_report.hpp.

◆ score_solver()

double petsc_AMG_report::score_solver ( double  t_solve,
double  t_m 
)
inlineprivate

Score the solver.

Parameters
t_solvetime to solve
t_mtarget accuracy the solver should reach

Definition at line 197 of file petsc_solver_AMG_report.hpp.

◆ setMaxSweep()

void petsc_AMG_report::setMaxSweep ( int  max_sw)
inline

Set the target accuracy to score the AMG solver.

Set the maximum number of sweep for testing

Parameters
max_swmax number of sweep

Definition at line 562 of file petsc_solver_AMG_report.hpp.

◆ setTergetAMGAccuracy()

void petsc_AMG_report::setTergetAMGAccuracy ( double  t_a)
inline

Set the target accuracy to score the AMG solver.

The score is calculated as \( \frac{1}{t_s} max(1,t_a/t_m) \)

where \( t_s \) is the time to solve the system \( t_a \) is the target accuracy \( t_m \) is the time of the method

Parameters
t_atarget accuracy

Definition at line 550 of file petsc_solver_AMG_report.hpp.

◆ test_coarsener()

void petsc_AMG_report::test_coarsener ( SparseMatrix< double, int, PETSC_BASE > &  A,
const Vector< double, PETSC_BASE > &  b 
)
inlineprivate

test the corasener for this problem

Parameters
Amatrix to invert
bright-hand-side

Definition at line 124 of file petsc_solver_AMG_report.hpp.

◆ test_cycle_asym()

void petsc_AMG_report::test_cycle_asym ( SparseMatrix< double, int, PETSC_BASE > &  A,
const Vector< double, PETSC_BASE > &  b,
openfpm::vector< size_t > &  ids_ts,
openfpm::vector< std::string > &  coarsener_to_test 
)
inlineprivate

test best asymmetric combination of sweeps

Parameters
Amatrix to invert
bright-hand-side
ids_tsset of sweep configuration to test
coarsener_to_testcoarsener to test

Definition at line 404 of file petsc_solver_AMG_report.hpp.

◆ test_cycle_type()

void petsc_AMG_report::test_cycle_type ( SparseMatrix< double, int, PETSC_BASE > &  A,
const Vector< double, PETSC_BASE > &  b,
openfpm::vector< std::string > &  coarsener_to_test 
)
inlineprivate

test the corasener for this problem

Parameters
Amatrix to invert
bright-hand-side
coarsener_to_testcoarsener to test

Definition at line 350 of file petsc_solver_AMG_report.hpp.

◆ try_solve()

void petsc_AMG_report::try_solve ( SparseMatrix< double, int, PETSC_BASE > &  A,
const Vector< double, PETSC_BASE > &  b 
)
inline

Try to use AMG pre-conditioner and check how they they perform.

Parameters
ASparse matrix
bright-hand side

Definition at line 575 of file petsc_solver_AMG_report.hpp.

◆ write_report()

void petsc_AMG_report::write_report ( openfpm::vector< std::string > &  coars)
inlineprivate

Write the report on file

Parameters
coarsset of coarsener tested

Definition at line 460 of file petsc_solver_AMG_report.hpp.

◆ write_report_coars()

void petsc_AMG_report::write_report_coars ( GoogleChart cg)
inlineprivate

Write the report for coarsening.

Parameters
cgGoogle chart

Definition at line 207 of file petsc_solver_AMG_report.hpp.

◆ write_report_cycle()

void petsc_AMG_report::write_report_cycle ( GoogleChart cg,
openfpm::vector< std::string > &  coars 
)
inlineprivate

Write the report for coarsening.

Parameters
cgGoogle chart
coarstype of coarsening

Definition at line 250 of file petsc_solver_AMG_report.hpp.

◆ write_report_cycle_asym()

void petsc_AMG_report::write_report_cycle_asym ( GoogleChart cg,
openfpm::vector< std::string > &  coars 
)
inlineprivate

Write the report for coarsening.

Parameters
cgGoogle chart
coarstype of coarsening

Definition at line 298 of file petsc_solver_AMG_report.hpp.

Field Documentation

◆ asym_tests

openfpm::vector<size_t> petsc_AMG_report::asym_tests
private

starting point of each coarsening test for the asymmetric test

Definition at line 69 of file petsc_solver_AMG_report.hpp.

◆ method

openfpm::vector<std::string> petsc_AMG_report::method
private

List of methods.

Definition at line 60 of file petsc_solver_AMG_report.hpp.

◆ num_sweep_test

size_t petsc_AMG_report::num_sweep_test = 10
private

Number of sweeps for test.

Definition at line 45 of file petsc_solver_AMG_report.hpp.

◆ perf_amg_coars

openfpm::vector<AMG_time_err_coars> petsc_AMG_report::perf_amg_coars
private

It contains the performance of several AMG methods coarsener.

Definition at line 51 of file petsc_solver_AMG_report.hpp.

◆ perf_amg_sweep_asym

openfpm::vector<AMG_time_err_coars> petsc_AMG_report::perf_amg_sweep_asym
private

It contain the performance of several AMG methods sweep configuration.

Definition at line 57 of file petsc_solver_AMG_report.hpp.

◆ perf_amg_sweep_sym

openfpm::vector<AMG_time_err_coars> petsc_AMG_report::perf_amg_sweep_sym
private

It contain the performance of several AMG methods sweep configuration.

Definition at line 54 of file petsc_solver_AMG_report.hpp.

◆ target_accuracy

double petsc_AMG_report::target_accuracy = 1
private

Target accuracy for the preconditioner.

Definition at line 48 of file petsc_solver_AMG_report.hpp.

◆ v_cycle_tested_asym

openfpm::vector<std::pair<size_t,size_t> > petsc_AMG_report::v_cycle_tested_asym
private

List of tested cycles in case of asymmetric.

Definition at line 66 of file petsc_solver_AMG_report.hpp.

◆ v_cycle_tested_sym

openfpm::vector<size_t> petsc_AMG_report::v_cycle_tested_sym
private

List of tested cycles.

Definition at line 63 of file petsc_solver_AMG_report.hpp.


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