33#ifndef STRUMPACK_SPARSE_SOLVER_BASE_HPP
34#define STRUMPACK_SPARSE_SOLVER_BASE_HPP
41#include "StrumpackConfig.hpp"
77 template<
typename scalar_t,
typename integer_t=
int>
101 bool verbose=
true,
bool root=
true);
157 int components=1,
int width=1);
219 bool use_initial_guess=
false);
247 bool use_initial_guess=
false);
278 scalar_t* x,
int ldx,
279 bool use_initial_guess=
false);
378 void draw(
const std::string& name)
const;
389 virtual void setup_tree() = 0;
390 virtual void setup_reordering() = 0;
392 int compute_reordering(
const int* p,
int base,
393 int nx,
int ny,
int nz,
394 int components,
int width) = 0;
395 virtual void separator_reordering() = 0;
398 virtual std::unique_ptr<SpMat_t> matrix_nonzero_diag() = 0;
399 virtual Reord_t* reordering() = 0;
400 virtual Tree_t* tree() = 0;
401 virtual const SpMat_t* matrix()
const = 0;
402 virtual const Reord_t* reordering()
const = 0;
403 virtual const Tree_t* tree()
const = 0;
405 virtual void perf_counters_start();
406 virtual void perf_counters_stop(
const std::string& s);
408 virtual void synchronize() {}
409 virtual void communicate_ordering() {}
410 virtual double max_peak_memory()
const
411 {
return double(params::peak_memory); }
412 virtual double min_peak_memory()
const
413 {
return double(params::peak_memory); }
415 void papi_initialize();
416 long long dense_factor_nonzeros()
const;
417 void print_solve_stats(TaskTimer& t)
const;
419 virtual void reduce_flop_counters()
const {}
420 void print_flop_breakdown_HSS()
const;
421 void print_flop_breakdown_HODLR()
const;
422 void flop_breakdown_reset()
const;
424 void print_wrong_sparsity_error();
426 SPOptions<scalar_t> opts_;
429 MatchingData<scalar_t,integer_t> matching_;
430 Equilibration<scalar_t> equil_;
432 std::new_handler old_handler_;
433 std::ostream* rank_out_ =
nullptr;
434 bool factored_ =
false;
435 bool reordered_ =
false;
438#if defined(STRUMPACK_USE_PAPI)
439 float rtime_ = 0., ptime_ = 0.;
440 long_long _flpops = 0;
442#if defined(STRUMPACK_COUNT_FLOPS)
443 long long int f0_ = 0, ftot_ = 0, fmin_ = 0, fmax_ = 0;
444 long long int b0_ = 0, btot_ = 0, bmin_ = 0, bmax_ = 0;
445 long long int m0_ = 0, mtot_ = 0, mmin_ = 0, mmax_ = 0;
446 long long int ptot_ = 0, pmin_ = 0, pmax_ = 0;
447 long long int dm0_ = 0, dmtot_ = 0, dmmin_ = 0, dmmax_ = 0;
448 long long int dptot_ = 0, dpmin_ = 0, dpmax_ = 0;
452 ReturnCode reorder_internal(
const int* p,
int base,
453 int nx,
int ny,
int nz,
454 int components,
int width);
457 ReturnCode solve_internal(
const scalar_t* b, scalar_t* x,
458 bool use_initial_guess=
false) = 0;
460 ReturnCode solve_internal(
const DenseM_t& b, DenseM_t& x,
461 bool use_initial_guess=
false) = 0;
464 ReturnCode solve_internal(
int nrhs,
const scalar_t* b,
int ldb,
465 scalar_t* x,
int ldx,
466 bool use_initial_guess=
false);
468 virtual void delete_factors_internal() = 0;
471 template<
typename scalar_t,
typename integer_t>
472 using StrumpackSparseSolverBase =
473 SparseSolverBase<scalar_t,integer_t>;
Contains the compressed sparse row matrix storage class.
Contains the DenseMatrix and DenseMatrixWrapper classes, simple wrappers around BLAS/LAPACK style den...
Holds options for the sparse solver.
Abstract base class for compressed sparse matrix storage.
Definition: CompressedSparseMatrix.hpp:149
Like DenseMatrix, this class represents a matrix, stored in column major format, to allow direct use ...
Definition: DenseMatrix.hpp:1015
This class represents a matrix, stored in column major format, to allow direct use of BLAS/LAPACK rou...
Definition: DenseMatrix.hpp:138
Definition: SparseSolverBase.hpp:53
Definition: SparseSolverBase.hpp:52
Options for the sparse solver.
Definition: StrumpackOptions.hpp:216
SparseSolverBase is the virtual base for both the sequential/multithreaded and distributed sparse sol...
Definition: SparseSolverBase.hpp:78
int Krylov_iterations() const
virtual ~SparseSolverBase()
ReturnCode solve(int nrhs, const scalar_t *b, int ldb, scalar_t *x, int ldx, bool use_initial_guess=false)
SparseSolverBase(int argc, char *argv[], bool verbose=true, bool root=true)
void set_from_options(int argc, char *argv[])
const SPOptions< scalar_t > & options() const
ReturnCode solve(const DenseM_t &b, DenseM_t &x, bool use_initial_guess=false)
ReturnCode inertia(integer_t &neg, integer_t &zero, integer_t &pos)
ReturnCode solve(const scalar_t *b, scalar_t *x, bool use_initial_guess=false)
std::size_t factor_nonzeros() const
std::size_t factor_memory() const
void draw(const std::string &name) const
SPOptions< scalar_t > & options()
SparseSolverBase(bool verbose=true, bool root=true)
ReturnCode reorder(int nx=1, int ny=1, int nz=1, int components=1, int width=1)
ReturnCode reorder(const int *p, int base=0)
Definition: StrumpackOptions.hpp:43
ReturnCode
Enumeration for the possible return codes.
Definition: StrumpackParameters.hpp:50