schwz
Generated automatically from develop
|
An implementation of the solver interface using the RAS solver. More...
#include <restricted_schwarz.hpp>
Public Member Functions | |
SolverRAS (Settings &settings, Metadata< ValueType, IndexType > &metadata) | |
The constructor that takes in the user settings and a metadata struct containing the solver metadata. More... | |
void | setup_local_matrices (Settings &settings, Metadata< ValueType, IndexType > &metadata, std::vector< unsigned int > &partition_indices, std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &global_matrix, std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &local_matrix, std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &interface_matrix) override |
Sets up the local and the interface matrices from the global matrix and the partition indices. More... | |
void | setup_comm_buffers () override |
Sets up the communication buffers needed for the boundary exchange. | |
void | setup_windows (const Settings &settings, const Metadata< ValueType, IndexType > &metadata, std::shared_ptr< gko::matrix::Dense< ValueType >> &main_buffer) override |
Sets up the windows needed for the asynchronous communication. More... | |
void | exchange_boundary (const Settings &settings, const Metadata< ValueType, IndexType > &metadata, std::shared_ptr< gko::matrix::Dense< ValueType >> &global_solution) override |
Exchanges the elements of the solution vector. More... | |
void | update_boundary (const Settings &settings, const Metadata< ValueType, IndexType > &metadata, std::shared_ptr< gko::matrix::Dense< ValueType >> &local_solution, const std::shared_ptr< gko::matrix::Dense< ValueType >> &local_rhs, const std::shared_ptr< gko::matrix::Dense< ValueType >> &global_solution, const std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &interface_matrix) override |
Update the values into local vector from obtained from the neighboring sub-domains using the interface matrix. More... | |
Public Member Functions inherited from schwz::SchwarzBase< ValueType, IndexType, MixedValueType > | |
SchwarzBase (Settings &settings, Metadata< ValueType, IndexType > &metadata) | |
The constructor that takes in the user settings and a metadata struct containing the solver metadata. More... | |
void | initialize () |
Initialize the matrix and vectors. | |
void | run (std::shared_ptr< gko::matrix::Dense< ValueType >> &solution) |
The function that runs the actual solver and obtains the final solution. More... | |
void | print_vector (const std::shared_ptr< gko::matrix::Dense< ValueType >> &vector, int subd, std::string name) |
The auxiliary function that prints a passed in vector. More... | |
void | print_matrix (const std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &matrix, int rank, std::string name) |
The auxiliary function that prints a passed in CSR matrix. More... | |
Public Member Functions inherited from schwz::Initialize< ValueType, IndexType > | |
Initialize (Settings &settings, Metadata< ValueType, IndexType > &metadata) | |
void | generate_rhs (std::vector< ValueType > &rhs) |
Generates the right hand side vector. More... | |
void | setup_global_matrix (const std::string &filename, const gko::size_type &oned_laplacian_size, std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &global_matrix) |
Generates the 2D global laplacian matrix. More... | |
void | partition (const Settings &settings, const Metadata< ValueType, IndexType > &metadata, const std::shared_ptr< gko::matrix::Csr< ValueType, IndexType >> &global_matrix, std::vector< unsigned int > &partition_indices) |
The partitioning function. More... | |
void | setup_vectors (const Settings &settings, const Metadata< ValueType, IndexType > &metadata, std::vector< ValueType > &rhs, std::shared_ptr< gko::matrix::Dense< ValueType >> &local_rhs, std::shared_ptr< gko::matrix::Dense< ValueType >> &global_rhs, std::shared_ptr< gko::matrix::Dense< ValueType >> &local_solution) |
Setup the vectors with default values and allocate mameory if not allocated. More... | |
Public Member Functions inherited from schwz::Settings | |
Settings (std::string executor_string="reference") | |
Public Member Functions inherited from schwz::Communicate< ValueType, IndexType, MixedValueType > | |
void | local_to_global_vector (const Settings &settings, const Metadata< ValueType, IndexType > &metadata, const std::shared_ptr< gko::matrix::Dense< ValueType >> &local_vector, std::shared_ptr< gko::matrix::Dense< ValueType >> &global_vector) |
Transforms data from a local vector to a global vector. More... | |
void | clear (Settings &settings) |
Clears the data. | |
Public Member Functions inherited from schwz::Solve< ValueType, IndexType, MixedValueType > | |
Solve (const Settings &settings) | |
Additional Inherited Members | |
Public Types inherited from schwz::Settings | |
enum | partition_settings { partition_regular = 0x0, partition_regular2d = 0x4, partition_metis = 0x1, partition_zoltan = 0x2, partition_custom = 0x3 } |
The partition algorithm to be used for partitioning the matrix. | |
enum | local_solver_settings { direct_solver_cholmod = 0x0, direct_solver_umfpack = 0x5, direct_solver_ginkgo = 0x1, iterative_solver_ginkgo = 0x2, iterative_solver_dealii = 0x3, solver_custom = 0x4 } |
The local solver algorithm for the local subdomain solves. | |
Public Types inherited from schwz::Solve< ValueType, IndexType, MixedValueType > | |
using | ResidualCriterionFactory = typename gko::stop::ResidualNormReduction< ValueType >::Factory |
using | IterationCriterionFactory = typename gko::stop::Iteration::Factory |
Public Attributes inherited from schwz::SchwarzBase< ValueType, IndexType, MixedValueType > | |
std::shared_ptr< gko::matrix::Csr< ValueType, IndexType > > | local_matrix |
The local subdomain matrix. | |
std::shared_ptr< gko::matrix::Permutation< IndexType > > | local_perm |
The local subdomain permutation matrix/array. | |
std::shared_ptr< gko::matrix::Permutation< IndexType > > | local_inv_perm |
The local subdomain inverse permutation matrix/array. | |
std::shared_ptr< gko::matrix::Csr< ValueType, IndexType > > | triangular_factor_l |
The local lower triangular factor used for the triangular solves. | |
std::shared_ptr< gko::matrix::Csr< ValueType, IndexType > > | triangular_factor_u |
The local upper triangular factor used for the triangular solves. | |
std::shared_ptr< gko::matrix::Csr< ValueType, IndexType > > | interface_matrix |
The local interface matrix. | |
std::shared_ptr< gko::matrix::Csr< ValueType, IndexType > > | global_matrix |
The global matrix. | |
std::shared_ptr< gko::matrix::Dense< ValueType > > | local_rhs |
The local right hand side. | |
std::shared_ptr< gko::matrix::Dense< ValueType > > | global_rhs |
The global right hand side. | |
std::shared_ptr< gko::matrix::Dense< ValueType > > | local_solution |
The local solution vector. | |
std::shared_ptr< gko::matrix::Dense< ValueType > > | global_solution |
The global solution vector. | |
std::vector< ValueType > | local_residual_vector_out |
The global residual vector. | |
std::vector< std::vector< ValueType > > | global_residual_vector_out |
The local residual vector. | |
Public Attributes inherited from schwz::Initialize< ValueType, IndexType > | |
std::vector< unsigned int > | partition_indices |
The partition indices containing the subdomains to which each row(vertex) of the matrix(graph) belongs to. | |
std::vector< unsigned int > | cell_weights |
The cell weights for the partition algorithm. | |
Public Attributes inherited from schwz::Settings | |
std::string | executor_string |
The string that contains the ginkgo executor paradigm. | |
std::shared_ptr< gko::Executor > | executor = gko::ReferenceExecutor::create() |
The ginkgo executor the code is to be executed on. | |
std::shared_ptr< device_guard > | cuda_device_guard |
The ginkgo executor the code is to be executed on. | |
partition_settings | partition = partition_settings::partition_regular |
gko::int32 | overlap = 2 |
The overlap between the subdomains. | |
std::string | matrix_filename = "null" |
The string that contains the matrix file name to read from . | |
bool | explicit_laplacian = true |
Flag if the laplacian matrix should be generated within the library. More... | |
bool | use_mixed_precision = false |
Flag if mixed precision should be used. | |
bool | enable_random_rhs = false |
Flag to enable a random rhs. | |
bool | print_matrices = false |
Flag to enable printing of matrices. | |
bool | debug_print = false |
Flag to enable some debug printing. | |
local_solver_settings | local_solver |
bool | non_symmetric_matrix = false |
Is the matrix non-symmetric ? , Use GMRES for local solves. | |
unsigned int | restart_iter = 1u |
The restart iter for the GMRES solver. | |
int | reset_local_crit_iter = -1 |
The global iter at which to reset the local solver criterion. | |
bool | naturally_ordered_factor = false |
Disables the re-ordering of the matrix before computing the triangular factors during the CHOLMOD factorization. More... | |
std::string | metis_objtype |
This setting defines the objective type for the metis partitioning. | |
bool | use_precond = false |
Enable the block jacobi local preconditioner for the local solver. | |
bool | write_debug_out = false |
Enable the writing of debug out to file. | |
bool | write_iters_and_residuals = false |
Enable writing the iters and residuals to a file. | |
bool | enable_logging = false |
Flag to enable logging for local iterative solvers. More... | |
bool | write_perm_data = false |
Enable the local permutations from CHOLMOD to a file. | |
int | shifted_iter = 1 |
Iteration shift for node local communication. | |
comm_settings | comm_settings |
convergence_settings | convergence_settings |
std::string | factorization = "cholmod" |
The factorization for the local direct solver. | |
std::string | reorder |
The reordering for the local solve. | |
Public Attributes inherited from schwz::Metadata< ValueType, IndexType > | |
MPI_Comm | mpi_communicator |
The MPI communicator. | |
gko::size_type | global_size = 0 |
The size of the global matrix. | |
gko::size_type | oned_laplacian_size = 0 |
The size of the 1 dimensional laplacian grid. | |
gko::size_type | local_size = 0 |
The size of the local subdomain matrix. | |
gko::size_type | local_size_x = 0 |
The size of the local subdomain matrix + the overlap. | |
gko::size_type | local_size_o = 0 |
The size of the local subdomain matrix + the overlap. | |
gko::size_type | overlap_size = 0 |
The size of the overlap between the subdomains. | |
gko::size_type | num_subdomains = 1 |
The number of subdomains used within the solver. | |
int | my_rank |
The rank of the subdomain. | |
int | my_local_rank |
The local rank of the subdomain. | |
int | local_num_procs |
The local number of procs in the subdomain. | |
int | comm_size |
The number of subdomains used within the solver, size of the communicator. | |
int | num_threads |
The number of threads used within the solver for each subdomain. | |
IndexType | iter_count |
The iteration count of the solver. | |
ValueType | tolerance |
The tolerance of the complete solver. More... | |
ValueType | local_solver_tolerance |
The tolerance of the local solver in case of an iterative solve. More... | |
IndexType | max_iters |
The maximum iteration count of the Schwarz solver. | |
IndexType | local_max_iters |
The maximum iteration count of the local iterative solver. | |
IndexType | updated_max_iters |
The updated maximum iteration count of the local iterative solver. | |
std::string | local_precond |
Local preconditioner. | |
unsigned int | precond_max_block_size |
The maximum block size for the preconditioner. | |
ValueType | current_residual_norm = -1.0 |
The current residual norm of the subdomain. | |
ValueType | min_residual_norm = -1.0 |
The minimum residual norm of the subdomain. | |
std::vector< std::tuple< int, int, int, std::string, std::vector< ValueType > > > | time_struct |
The struct used to measure the timings of each function within the solver loop. | |
std::vector< std::tuple< int, std::vector< std::tuple< int, int > >, std::vector< std::tuple< int, int > >, int, int > > | comm_data_struct |
The struct used to measure the timings of each function within the solver loop. | |
post_process_data | post_process_data |
double | init_mpi_wtime = 0.0 |
std::shared_ptr< gko::Array< IndexType > > | global_to_local |
The mapping containing the global to local indices. | |
std::shared_ptr< gko::Array< IndexType > > | local_to_global |
The mapping containing the local to global indices. | |
gko::Array< IndexType > | overlap_row |
The overlap row indices. | |
std::shared_ptr< gko::Array< IndexType > > | first_row |
The starting row of each subdomain in the matrix. | |
std::shared_ptr< gko::Array< IndexType > > | permutation |
The permutation used for the re-ordering. | |
std::shared_ptr< gko::Array< IndexType > > | i_permutation |
The inverse permutation used for the re-ordering. | |
Public Attributes inherited from schwz::Communicate< ValueType, IndexType, MixedValueType > | |
comm_struct | comm_struct |
An implementation of the solver interface using the RAS solver.
ValueType | The type of the floating point values. |
IndexType | The type of the index type values. |
schwz::SolverRAS< ValueType, IndexType, MixedValueType >::SolverRAS | ( | Settings & | settings, |
Metadata< ValueType, IndexType > & | metadata | ||
) |
The constructor that takes in the user settings and a metadata struct containing the solver metadata.
settings | The settings struct. |
metadata | The metadata struct. |
data | The additional data struct. |
|
overridevirtual |
Exchanges the elements of the solution vector.
settings | The settings struct. |
metadata | The metadata struct. |
global_solution | The solution vector being exchanged between the subdomains. |
Implements schwz::Communicate< ValueType, IndexType, MixedValueType >.
References schwz::Settings::comm_settings::enable_onesided, and schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::global_solution.
|
overridevirtual |
Sets up the local and the interface matrices from the global matrix and the partition indices.
settings | The settings struct. |
metadata | The metadata struct. |
partition_indices | The array containing the partition indices. |
global_matrix | The global system matrix. |
local_matrix | The local system matrix. |
interface_matrix | The interface matrix containing the interface and the overlap data mainly used for exchanging values between different sub-domains. |
local_perm | The local permutation, obtained through RCM or METIS. |
Implements schwz::Initialize< ValueType, IndexType >.
References schwz::Metadata< ValueType, IndexType >::comm_size, schwz::Settings::executor, schwz::Metadata< ValueType, IndexType >::first_row, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::global_matrix, schwz::Metadata< ValueType, IndexType >::global_size, schwz::Metadata< ValueType, IndexType >::global_to_local, schwz::Metadata< ValueType, IndexType >::i_permutation, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::interface_matrix, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::local_matrix, schwz::Metadata< ValueType, IndexType >::local_size, schwz::Metadata< ValueType, IndexType >::local_size_o, schwz::Metadata< ValueType, IndexType >::local_size_x, schwz::Metadata< ValueType, IndexType >::local_to_global, schwz::Metadata< ValueType, IndexType >::my_rank, schwz::Metadata< ValueType, IndexType >::num_subdomains, schwz::Settings::overlap, schwz::Metadata< ValueType, IndexType >::overlap_row, schwz::Metadata< ValueType, IndexType >::overlap_size, and schwz::Metadata< ValueType, IndexType >::permutation.
|
overridevirtual |
Sets up the windows needed for the asynchronous communication.
settings | The settings struct. |
metadata | The metadata struct. |
main_buffer | The main buffer being exchanged between the subdomains. |
Implements schwz::Communicate< ValueType, IndexType, MixedValueType >.
References schwz::Settings::comm_settings::enable_get, schwz::Settings::comm_settings::enable_lock_all, schwz::Settings::comm_settings::enable_one_by_one, schwz::Settings::comm_settings::enable_onesided, schwz::Settings::comm_settings::enable_overlap, schwz::Settings::comm_settings::enable_put, schwz::Settings::executor, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::get_displacements, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::get_request, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::global_get, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::global_put, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::global_solution, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::is_local_neighbor, schwz::Metadata< ValueType, IndexType >::iter_count, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::local_get, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::local_neighbors_in, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::local_neighbors_out, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::local_num_neighbors_in, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::local_num_neighbors_out, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::local_put, schwz::Metadata< ValueType, IndexType >::local_size_o, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::mixedt_recv_buffer, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::mixedt_send_buffer, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::neighbors_in, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::neighbors_out, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::num_neighbors_in, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::num_neighbors_out, schwz::Metadata< ValueType, IndexType >::num_subdomains, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::put_displacements, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::put_request, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::recv_buffer, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::send_buffer, schwz::Settings::comm_settings::stage_through_host, schwz::Settings::use_mixed_precision, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::window_recv_buffer, schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::window_send_buffer, and schwz::Communicate< ValueType, IndexType, MixedValueType >::comm_struct::window_x.
|
overridevirtual |
Update the values into local vector from obtained from the neighboring sub-domains using the interface matrix.
settings | The settings struct. |
metadata | The metadata struct. |
local_solution | The local solution vector in the subdomain. |
local_rhs | The local right hand side vector in the subdomain. |
global_solution | The workspace solution vector. |
global_old_solution | The global solution vector of the previous iteration. |
interface_matrix | The interface matrix containing the interface and the overlap data mainly used for exchanging values between different sub-domains. |
Implements schwz::Communicate< ValueType, IndexType, MixedValueType >.
References schwz::Settings::executor, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::global_solution, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::interface_matrix, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::local_rhs, schwz::Metadata< ValueType, IndexType >::local_size_x, schwz::SchwarzBase< ValueType, IndexType, MixedValueType >::local_solution, schwz::Metadata< ValueType, IndexType >::num_subdomains, and schwz::Settings::overlap.