Debian Codegraph @

packages/shylu/shylu_dd/core/src/epetra/shylu.h

raw
1 // @HEADER
2 // *****************************************************************************
3 // ShyLU: Scalable Hybrid LU Preconditioner and Solver
4 //
5 // Copyright 2011 NTESS and the ShyLU contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 /** \file shylu.h
11
12 \brief Main header file of ShyLU (Include main user calls)
13
14 \author Siva Rajamanickam
15 */
16 #ifndef SHYLU_H
17 #define SHYLU_H
18
19 #if defined(ShyLU_DDCore_SHOW_DEPRECATED_WARNINGS)
20 #ifdef __GNUC__
21 #warning "The ShyLU_DDCore package is deprecated"
22 #endif
23 #endif
24
25 // Epetra include
26 #include "Epetra_CrsMatrix.h"
27 #include "Epetra_Map.h"
28 #include "Epetra_MultiVector.h"
29 #include "Epetra_LinearProblem.h"
30 #include "Epetra_SerialComm.h"
31
32 // Amesos includes
33 #include "Amesos_BaseSolver.h"
34
35 // Ifpack includes
36 #include "Ifpack.h"
37 #include "Ifpack_Preconditioner.h"
38
39 // AztecOO includes
40 #include "AztecOO.h"
41
42 // Isorropia includes
43 #include "Isorropia_EpetraProber.hpp"
44
45 // Amesos2 includes
46 #ifdef HAVE_SHYLU_DDCORE_AMESOS2
47 #include <Amesos2.hpp>
48 #endif
49
50 // Tpetra includes
51 #ifdef HAVE_SHYLU_DDCORE_TPETRA
52 #include <Tpetra_CrsMatrix_decl.hpp>
53 #include <Tpetra_CrsMatrix_def.hpp>
54 #endif
55
56 // Zoltan2 includes
57 #if defined(HAVE_SHYLU_DDCORE_ZOLTAN2CORE)
58 #include <Zoltan2_XpetraCrsMatrixAdapter.hpp>
59 #include <Zoltan2_XpetraMultiVectorAdapter.hpp>
60 #include <Zoltan2_PartitioningProblem.hpp>
61 #endif
62
63
64 // Shylu includes
65 #include "shylu_symbolic.h"
66 #include "shylu_config.h"
67 #include "shylu_probing_operator.h"
68 #include "shylu_amesos_schur_operator.h"
69
70 #include <IQRSolver.h>
71
72
73 #define SHYLU_CORE_MIN(a, b) (((a) < (b)) ? a : b)
74 #define SHYLU_CORE_MAX(a, b) (((a) > (b)) ? a : b)
75
76 /** \brief Main data structure holding needed offset and temp variables
77 *
78 * This structur contains ...
79 */
80 typedef struct
81 {
82 int Dnr; // #local rows
83 int Dnc; // #local cols
84 int Snr; // #remote rows
85 int *DRowElems; // local rows
86 int *SRowElems; // remote rows
87 int *DColElems; // Columns in D
88 int *gvals; // O(n) array differentiating local/global
89 // row/col
90 //Epetra_SerialComm *SComm; // Serial comm for block diagonals
91 Teuchos::RCP<Epetra_Map> LDRowMap; // RowMap for block diagonals
92 Teuchos::RCP<Epetra_Map> LGRowMap; // RowMap for G (local)
93 Teuchos::RCP<Epetra_Map> GMap; // Dist Map for G
94
95 Teuchos::RCP<Epetra_Import> BdImporter;
96 Teuchos::RCP<Epetra_Import> DistImporter;
97 Teuchos::RCP<Epetra_Import> BsImporter;
98 Teuchos::RCP<Epetra_Import> XsImporter;
99 Teuchos::RCP<Epetra_Export> XdExporter;
100 Teuchos::RCP<Epetra_Export> XsExporter;
101
102 Teuchos::RCP<Epetra_MultiVector> localrhs;
103 Teuchos::RCP<Epetra_MultiVector> temp1;
104 Teuchos::RCP<Epetra_MultiVector> temp2;
105 Teuchos::RCP<Epetra_MultiVector> Bs;
106 Teuchos::RCP<Epetra_MultiVector> Xs;
107 Teuchos::RCP<Epetra_MultiVector> LocalXs;
108 Teuchos::RCP<Epetra_MultiVector> temp3;
109 Teuchos::RCP<Epetra_MultiVector> locallhs;
110
111 // temp timers
112 //Teuchos::RCP<Teuchos::Time> importExportTime;
113 //Teuchos::RCP<Teuchos::Time> innerIterTime;
114 //Teuchos::RCP<Teuchos::Time> fwdTime;
115 //Teuchos::RCP<Teuchos::Time> amesosSchurTime;
116
117 //Epetra_CrsMatrix *D; // Actual D Matrix, not reqd for Amesos_KLU
118 // but required for Amesos_Pardiso
119 Teuchos::RCP<IQR::IQRSolver> iqrSolver; // Solver object for IQR func.
120 Teuchos::RCP<Epetra_CrsMatrix> Sbar; // Approx Schur complement
121 Teuchos::RCP<Epetra_CrsGraph> localSbargraph; // graph of local Sbar
122 AztecOO *innersolver; // inner solver
123 Teuchos::RCP<Epetra_MultiVector> Sbarlhs;
124 Teuchos::RCP<Epetra_MultiVector> Sbarrhs;
125 Teuchos::RCP<Epetra_LinearProblem> LP2; // Local problem to solve
126 Teuchos::RCP<Epetra_LinearProblem> OrigLP2; // Local problem to solve D
127 Teuchos::RCP<EpetraExt::ViewTransform<Epetra_LinearProblem> > ReIdx_LP2;
128 Amesos_BaseSolver *dsolver; // Local Subdomain solver
129 Teuchos::RCP<Ifpack_Preconditioner> schur_prec;
130 Teuchos::RCP<ShyLU_Probing_Operator> schur_op;
131 int lmax; // May be this is optimizing too much
132 int rmax; // May be this is optimizing too much
133 Teuchos::RCP<Isorropia::Epetra::Prober> guided_prober; // Guided Prober for Sbar
134 int num_compute; // # of times Compute() has been called before
135 // or in otherwords #nonlinear iteration-1
136 } shylu_data;
137
138 /** \brief Main function call into ShylU
139 *
140 * How to use?
141 */
142 int shylu_factor(Epetra_CrsMatrix *A, shylu_symbolic *ssym, shylu_data *data,
143 shylu_config *config);
144
145 /** \brief Call symbolic factorization on matrix
146 *
147 */
148 int shylu_symbolic_factor
149 (
150 Epetra_CrsMatrix *A, // i/p: A matrix
151 shylu_symbolic *ssym, // symbolic structure
152 shylu_data *data, // numeric structure, TODO: Required ?
153 shylu_config *config // i/p: library configuration
154 );
155
156 /** \brief Call solve on multiple RHS
157 *
158 */
159 int shylu_solve(shylu_symbolic *ssym, shylu_data *data, shylu_config *config,
160 const Epetra_MultiVector& X, Epetra_MultiVector& Y);
161
162 /** \brief Compute an approximate Schur Complement (Narrow Sep)
163 *
164 * Computate an approximate Schur Complement either using ...
165 */
166
167 Teuchos::RCP<Epetra_CrsMatrix> computeApproxSchur(shylu_config *config,
168 shylu_symbolic *ssym,
169 Epetra_CrsMatrix *G, Epetra_CrsMatrix *R,
170 Epetra_LinearProblem *LP, Amesos_BaseSolver *solver,
171 Ifpack_Preconditioner *ifSolver, Epetra_CrsMatrix *C,
172 Epetra_Map *localDRowMap);
173
174 /** \brief Compute an approximate Shur Complete (Wide Sep)
175 *
176 * Compute an approximate Schur Complement based on a wide seperator.
177 * Options include ...
178 */
179 Teuchos::RCP<Epetra_CrsMatrix> computeApproxWideSchur(
180 shylu_config *config,
181 shylu_symbolic *ssym, // symbolic structure
182 Epetra_CrsMatrix *G, Epetra_CrsMatrix *R,
183 Epetra_LinearProblem *LP, Amesos_BaseSolver *solver,
184 Ifpack_Preconditioner *ifSolver, Epetra_CrsMatrix *C,
185 Epetra_Map *localDRowMap);
186
187 /** \brief Compute an approximate Schur Complement using the option of Guided Probing
188 *
189 * Compute an approximate Schur Complement based on probing of important nonzero values.
190 */
191 Teuchos::RCP<Epetra_CrsMatrix> computeSchur_GuidedProbing
192 (
193 shylu_config *config,
194 shylu_symbolic *ssym, // symbolic structure
195 shylu_data *data, // numeric structure
196 Epetra_Map *localDRowMap
197 );
198 #endif // SHYLU_H