Documentation 6b54b78464
Loading...
Searching...
No Matches
CPreconditioner.hpp
Go to the documentation of this file.
1/*!
2 * \file CPreconditioner.hpp
3 * \brief Classes related to linear preconditioner wrappers.
4 * The actual operations are currently implemented mostly by CSysMatrix.
5 * \author F. Palacios, J. Hicken, T. Economon
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#include <functional>
32#include "../CConfig.hpp"
33#include "../geometry/CGeometry.hpp"
34#include "CSysVector.hpp"
35#include "CSysMatrix.hpp"
36
37/// \addtogroup SpLinSys
38/// @{
39
40/*!
41 * \brief Applies a preconditioner that only has a host implementation to vectors that live
42 * on the device: bring the input down, apply, put the result back.
43 * \note This is what keeps LU-SGS, Linelet and PaStiX usable on the GPU path. The
44 * transfers are issued by one thread with the team synchronized around them, the apply
45 * itself is the normal OpenMP parallel host code.
46 */
47template <class ScalarType, class Apply>
49#ifdef SU2_ENABLE_CUDA_KERNELS
50 if constexpr (su2_gpu_capable_v<ScalarType>) {
52 /*--- The host code must not see the device pointers of any expression it builds, so
53 * the switch is flipped for the duration of the apply. It is written inside the
54 * regions, by one thread, and published to the team by the trailing barrier. ---*/
56
57 apply();
58
60 return;
61 }
62 }
63#endif
64 apply();
65}
66
67/*!
68 * \brief Mirror of ApplyPreconditionerOnHost: applies a device preconditioner to host vectors.
69 * \note For callers that drive the Krylov solvers themselves and so never went through
70 * CSysSolve::Solve, which is what normally leaves the vectors on the device (Newton-Krylov).
71 * Device expressions are on for the duration so that a nested solve also uses the device copies.
72 * Only \p u is uploaded, \p v is always overwritten by the apply.
73 */
74template <class ScalarType, class Apply>
76 Apply&& apply) {
77#ifdef SU2_ENABLE_CUDA_KERNELS
78 if constexpr (su2_gpu_capable_v<ScalarType>) {
79 if (useCuda && !VecExpr::UseDeviceExpressions()) {
81
82 apply();
83
85 return;
86 }
87 }
88#else
89 (void)useCuda;
90#endif
91 apply();
92}
93
94/*!
95 * \class CPreconditioner
96 * \brief Abstract base class for defining a preconditioning operation.
97 * \author J. Hicken.
98 *
99 * See the remarks regarding the CMatrixVectorProduct class. The same
100 * idea applies here to the preconditioning operation.
101 */
102template <class ScalarType>
104 public:
105 /*!
106 * \brief Destructor of the class
107 */
108 virtual ~CPreconditioner() = 0;
109
110 /*!
111 * \brief Overload of operator (), applies the preconditioner to "u" storing the result in "v".
112 */
113 virtual void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const = 0;
114
115 /*!
116 * \brief Generic "preprocessing" hook derived classes may implement to build the preconditioner.
117 */
118 virtual void Build() {}
119
120 /*!
121 * \brief Return true to identify the identity preconditioner, may allow some solvers to be more efficient.
122 */
123 virtual bool IsIdentity() const { return false; }
124
125 /*!
126 * \brief Factory method.
127 */
129 const CConfig* config);
130};
131template <class ScalarType>
133
134/*!
135 * \class CIdentityPreconditioner
136 * \brief No-op preconditioner used when Krylov solvers run without preconditioning.
137 * \note Also serves Q_IDENTITY: Build() requests quantization of the diagonal blocks, needed by
138 * the matrix-vector product shared with the Krylov solver even though this preconditioner's own
139 * operation is a no-op. CSysMatrix::QuantizeDiagonalBlocks() when quantization is off.
140 */
141template <class ScalarType>
142class CIdentityPreconditioner final : public CPreconditioner<ScalarType> {
143 private:
144 CSysMatrix<ScalarType>& sparse_matrix;
145
146 public:
147 inline explicit CIdentityPreconditioner(CSysMatrix<ScalarType>& matrix_ref) : sparse_matrix(matrix_ref) {}
148
150
151 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override { v = u; }
152
153 inline bool IsIdentity() const override { return true; }
154
155 inline void Build() override { sparse_matrix.QuantizeDiagonalBlocks(); }
156};
157
158/*!
159 * \class CJacobiPreconditioner
160 * \brief Specialization of preconditioner that uses CSysMatrix class.
161 */
162template <class ScalarType>
163class CJacobiPreconditioner final : public CPreconditioner<ScalarType> {
164 private:
165 CSysMatrix<ScalarType>& sparse_matrix; /*!< \brief Pointer to matrix that defines the preconditioner. */
166 CGeometry* geometry; /*!< \brief Pointer to geometry associated with the matrix. */
167 const CConfig* config; /*!< \brief Pointer to problem configuration. */
168
169 public:
170 /*!
171 * \brief Constructor of the class.
172 * \param[in] matrix_ref - Matrix reference that will be used to define the preconditioner.
173 * \param[in] geometry_ref - Geometry associated with the problem.
174 * \param[in] config_ref - Config of the problem.
175 */
176 inline CJacobiPreconditioner(CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref, const CConfig* config_ref)
177 : sparse_matrix(matrix_ref) {
178 if ((geometry_ref == nullptr) || (config_ref == nullptr))
179 SU2_MPI::Error("Preconditioner needs to be built with valid references.", CURRENT_FUNCTION);
180 geometry = geometry_ref;
181 config = config_ref;
182 }
183
184 /*!
185 * \note This class cannot be default constructed as that would leave us with invalid Pointers.
186 */
188
189 /*!
190 * \brief operator that defines the preconditioner operation
191 * \param[in] u - CSysVector that is being preconditioned
192 * \param[out] v - CSysVector that is the result of the preconditioning
193 */
194 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
195 sparse_matrix.ComputeJacobiPreconditioner(u, v, geometry, config);
196 }
197
198 /*!
199 * \note Request the associated matrix to build the preconditioner. Also serves Q_JACOBI:
200 * BuildJacobiPreconditioner() quantizes the diagonal blocks itself when the matrix was
201 * set up for it.
202 */
203 inline void Build() override { sparse_matrix.BuildJacobiPreconditioner(); }
204};
205
206/*!
207 * \class CILUPreconditioner
208 * \brief Specialization of preconditioner that uses CSysMatrix class
209 */
210template <class ScalarType>
211class CILUPreconditioner final : public CPreconditioner<ScalarType> {
212 private:
213 CSysMatrix<ScalarType>& sparse_matrix; /*!< \brief Pointer to matrix that defines the preconditioner. */
214 CGeometry* geometry; /*!< \brief Pointer to geometry associated with the matrix. */
215 const CConfig* config; /*!< \brief Pointer to problem configuration. */
216
217 public:
218 /*!
219 * \brief Constructor of the class.
220 * \param[in] matrix_ref - Matrix reference that will be used to define the preconditioner.
221 * \param[in] geometry_ref - Geometry associated with the problem.
222 * \param[in] config_ref - Config of the problem.
223 */
224 inline CILUPreconditioner(CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref, const CConfig* config_ref)
225 : sparse_matrix(matrix_ref) {
226 if ((geometry_ref == nullptr) || (config_ref == nullptr))
227 SU2_MPI::Error("Preconditioner needs to be built with valid references.", CURRENT_FUNCTION);
228 geometry = geometry_ref;
229 config = config_ref;
230 }
231
232 /*!
233 * \note This class cannot be default constructed as that would leave us with invalid Pointers.
234 */
236
237 /*!
238 * \brief Operator that defines the preconditioner operation.
239 * \param[in] u - CSysVector that is being preconditioned.
240 * \param[out] v - CSysVector that is the result of the preconditioning.
241 */
242 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
243 /*--- No host bracket, ILU has a device implementation and ComputeILUPreconditioner dispatches to it. ---*/
244 sparse_matrix.ComputeILUPreconditioner(u, v, geometry, config);
245 }
246
247 /*!
248 * \note Request the associated matrix to build the preconditioner.
249 */
250 inline void Build() override { sparse_matrix.BuildILUPreconditioner(); }
251};
252
253/*!
254 * \class CLU_SGSPreconditioner
255 * \brief Specialization of preconditioner that uses CSysMatrix class.
256 */
257template <class ScalarType>
258class CLU_SGSPreconditioner final : public CPreconditioner<ScalarType> {
259 private:
260 CSysMatrix<ScalarType>& sparse_matrix; /*!< \brief Pointer to matrix that defines the preconditioner. */
261 CGeometry* geometry; /*!< \brief Pointer to geometry associated with the matrix. */
262 const CConfig* config; /*!< \brief Pointer to problem configuration. */
263
264 public:
265 /*!
266 * \brief Constructor of the class.
267 * \param[in] matrix_ref - Matrix reference that will be used to define the preconditioner.
268 * \param[in] geometry_ref - Geometry associated with the problem.
269 * \param[in] config_ref - Config of the problem.
270 */
271 inline CLU_SGSPreconditioner(CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref, const CConfig* config_ref)
272 : sparse_matrix(matrix_ref) {
273 if ((geometry_ref == nullptr) || (config_ref == nullptr))
274 SU2_MPI::Error("Preconditioner needs to be built with valid references.", CURRENT_FUNCTION);
275 geometry = geometry_ref;
276 config = config_ref;
277 }
278
279 /*!
280 * \note This class cannot be default constructed as that would leave us with invalid Pointers.
281 */
283
284 /*!
285 * \brief operator that defines the preconditioner operation.
286 * \param[in] u - CSysVector that is being preconditioned.
287 * \param[out] v - CSysVector that is the result of the preconditioning.
288 */
289 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
290 sparse_matrix.ComputeLU_SGSPreconditioner(u, v, geometry, config);
291 }
292
293 /*!
294 * \note Also serves Q_LU_SGS: quantizes the diagonal blocks, no-op for plain LU_SGS.
295 */
296 inline void Build() override { sparse_matrix.BuildLU_SGSPreconditioner(); }
297};
298
299/*!
300 * \class CLineletPreconditioner
301 * \brief Specialization of preconditioner that uses CSysMatrix class.
302 */
303template <class ScalarType>
304class CLineletPreconditioner final : public CPreconditioner<ScalarType> {
305 private:
306 CSysMatrix<ScalarType>& sparse_matrix; /*!< \brief Pointer to matrix that defines the preconditioner. */
307 CGeometry* geometry; /*!< \brief Pointer to geometry associated with the matrix. */
308 const CConfig* config; /*!< \brief Pointer to problem configuration. */
309
310 public:
311 /*!
312 * \brief Constructor of the class.
313 * \param[in] matrix_ref - Matrix reference that will be used to define the preconditioner.
314 * \param[in] geometry_ref - Geometry associated with the problem.
315 * \param[in] config_ref - Config of the problem.
316 */
317 inline CLineletPreconditioner(CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref, const CConfig* config_ref)
318 : sparse_matrix(matrix_ref) {
319 if ((geometry_ref == nullptr) || (config_ref == nullptr))
320 SU2_MPI::Error("Preconditioner needs to be built with valid references.", CURRENT_FUNCTION);
321 geometry = geometry_ref;
322 config = config_ref;
323 }
324
325 /*!
326 * \note This class cannot be default constructed as that would leave us with invalid Pointers.
327 */
329
330 /*!
331 * \brief Operator that defines the preconditioner operation.
332 * \param[in] u - CSysVector that is being preconditioned.
333 * \param[out] v - CSysVector that is the result of the preconditioning.
334 */
335 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
336 ApplyPreconditionerOnHost(u, v, [&] { sparse_matrix.ComputeLineletPreconditioner(u, v, geometry, config); });
337 }
338
339 /*!
340 * \note Request the associated matrix to build the preconditioner.
341 */
342 inline void Build() override { sparse_matrix.BuildLineletPreconditioner(geometry, config); }
343};
344
345/*!
346 * \class CPastixPreconditioner
347 * \brief Specialization of preconditioner that uses PaStiX to factorize a CSysMatrix.
348 */
349template <class ScalarType>
350class CPastixPreconditioner final : public CPreconditioner<ScalarType> {
351 private:
352 CSysMatrix<ScalarType>& sparse_matrix; /*!< \brief Pointer to the matrix. */
353 CGeometry* geometry; /*!< \brief Geometry associated with the problem. */
354 const CConfig* config; /*!< \brief Configuration of the problem. */
355 unsigned short kind_fact; /*!< \brief The type of factorization desired. */
356
357 public:
358 /*!
359 * \brief Constructor of the class
360 * \param[in] matrix_ref - Matrix reference that will be used to define the preconditioner.
361 * \param[in] geometry_ref - Associated geometry.
362 * \param[in] config_ref - Problem configuration.
363 * \param[in] kind_factorization - Type of factorization required.
364 */
365 inline CPastixPreconditioner(CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref, const CConfig* config_ref,
366 unsigned short kind_factorization)
367 : sparse_matrix(matrix_ref) {
368 if ((geometry_ref == nullptr) || (config_ref == nullptr))
369 SU2_MPI::Error("Preconditioner needs to be built with valid references.", CURRENT_FUNCTION);
370 geometry = geometry_ref;
371 config = config_ref;
372 kind_fact = kind_factorization;
373 }
374
375 /*!
376 * \note This class cannot be default constructed as that would leave us with invalid Pointers.
377 */
379
380 /*!
381 * \brief Operator that defines the preconditioner operation.
382 * \param[in] u - CSysVector that is being preconditioned.
383 * \param[out] v - CSysVector that is the result of the preconditioning.
384 */
385 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
386 ApplyPreconditionerOnHost(u, v, [&] { sparse_matrix.ComputePastixPreconditioner(u, v, geometry, config); });
387 }
388
389 /*!
390 * \note Request the associated matrix to build the preconditioner.
391 */
392 inline void Build() override { sparse_matrix.BuildPastixPreconditioner(geometry, config, kind_fact); }
393};
394
395/*!
396 * \class CAbstractPreconditioner
397 * \brief Applies a std::function as the preconditioning operation.
398 * \note This can be used to treat almost anything as a preconditioner.
399 */
400template <class ScalarType>
401class CAbstractPreconditioner final : public CPreconditioner<ScalarType> {
402 private:
403 std::function<void(const CSysVector<ScalarType>&, CSysVector<ScalarType>&)> impl;
404
405 public:
407
408 template <class F>
409 explicit CAbstractPreconditioner(const F& function) : impl(function) {}
410
411 inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override { impl(u, v); }
412};
413
414template <class ScalarType>
416 CSysMatrix<ScalarType>& jacobian, CGeometry* geometry,
417 const CConfig* config) {
418 CPreconditioner<ScalarType>* prec = nullptr;
419
420 switch (kind) {
421 case IDENTITY:
422 case Q_IDENTITY:
423 prec = new CIdentityPreconditioner<ScalarType>(jacobian);
424 break;
425 case JACOBI:
426 case Q_JACOBI:
427 prec = new CJacobiPreconditioner<ScalarType>(jacobian, geometry, config);
428 break;
429 case LINELET:
430 prec = new CLineletPreconditioner<ScalarType>(jacobian, geometry, config);
431 break;
432 case LU_SGS:
433 case Q_LU_SGS:
434 prec = new CLU_SGSPreconditioner<ScalarType>(jacobian, geometry, config);
435 break;
436 case ILU:
437 prec = new CILUPreconditioner<ScalarType>(jacobian, geometry, config);
438 break;
439 case PASTIX_ILU:
440 case PASTIX_LU_P:
441 case PASTIX_LDLT_P:
442 prec = new CPastixPreconditioner<ScalarType>(jacobian, geometry, config, kind);
443 break;
444 }
445
446 return prec;
447}
448
449/// @}
Declaration of the block-sparse matrix class. The implemtation is in CSysMatrix.cpp.
Declararion and inlines of the vector class used in the solution of large, distributed,...
#define SU2_DEVICE_REGION(...)
Brackets device work so that it is issued by a single thread with the whole team synchronized before ...
Definition CSysVector.hpp:100
Applies a std::function as the preconditioning operation.
Definition CPreconditioner.hpp:401
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Overload of operator (), applies the preconditioner to "u" storing the result in "v".
Definition CPreconditioner.hpp:411
CAbstractPreconditioner(const F &function)
Definition CPreconditioner.hpp:409
CAbstractPreconditioner()=delete
static void Error(const std::string &ErrorMsg, const std::string &FunctionName)
Definition mpi_structure.cpp:131
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:211
CILUPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:224
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:242
void Build() override
Definition CPreconditioner.hpp:250
CILUPreconditioner()=delete
No-op preconditioner used when Krylov solvers run without preconditioning.
Definition CPreconditioner.hpp:142
bool IsIdentity() const override
Return true to identify the identity preconditioner, may allow some solvers to be more efficient.
Definition CPreconditioner.hpp:153
void Build() override
Generic "preprocessing" hook derived classes may implement to build the preconditioner.
Definition CPreconditioner.hpp:155
CIdentityPreconditioner()=delete
CIdentityPreconditioner(CSysMatrix< ScalarType > &matrix_ref)
Definition CPreconditioner.hpp:147
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Overload of operator (), applies the preconditioner to "u" storing the result in "v".
Definition CPreconditioner.hpp:151
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:163
void Build() override
Definition CPreconditioner.hpp:203
CJacobiPreconditioner()=delete
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
operator that defines the preconditioner operation
Definition CPreconditioner.hpp:194
CJacobiPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:176
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:258
CLU_SGSPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:271
CLU_SGSPreconditioner()=delete
void Build() override
Definition CPreconditioner.hpp:296
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:289
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:304
void Build() override
Definition CPreconditioner.hpp:342
CLineletPreconditioner()=delete
CLineletPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:317
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:335
Specialization of preconditioner that uses PaStiX to factorize a CSysMatrix.
Definition CPreconditioner.hpp:350
void Build() override
Definition CPreconditioner.hpp:392
CPastixPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref, unsigned short kind_factorization)
Constructor of the class.
Definition CPreconditioner.hpp:365
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:385
CPastixPreconditioner()=delete
Abstract base class for defining a preconditioning operation.
Definition CPreconditioner.hpp:103
virtual void Build()
Generic "preprocessing" hook derived classes may implement to build the preconditioner.
Definition CPreconditioner.hpp:118
virtual void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const =0
Overload of operator (), applies the preconditioner to "u" storing the result in "v".
virtual bool IsIdentity() const
Return true to identify the identity preconditioner, may allow some solvers to be more efficient.
Definition CPreconditioner.hpp:123
Main class for defining block-compressed-row-storage sparse matrices.
Definition CSysMatrix.hpp:256
void ComputeLineletPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1484
void BuildLineletPreconditioner(const CGeometry *geometry, const CConfig *config)
Build the Linelet preconditioner.
Definition CSysMatrix.cpp:1454
void BuildILUPreconditioner()
Build the ILU preconditioner.
Definition CSysMatrix.cpp:1064
void ComputeILUPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1207
void ComputePastixPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Apply the PaStiX factorization to CSysVec.
Definition CSysMatrix.cpp:1831
void BuildLU_SGSPreconditioner()
Build the LU-SGS preconditioner.
Definition CSysMatrix.cpp:1302
void BuildJacobiPreconditioner()
Build the Jacobi preconditioner.
Definition CSysMatrix.cpp:1004
void BuildPastixPreconditioner(CGeometry *geometry, const CConfig *config, unsigned short kind_fact)
Factorize matrix using PaStiX.
Definition CSysMatrix.cpp:1815
void ComputeLU_SGSPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1324
void QuantizeDiagonalBlocks()
Compresses off-diagonal blocks into quantized form for use with USE_QUANTIZATION.
Definition CSysMatrix.cpp:779
void ComputeJacobiPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1033
Class for holding and manipulating vectors needed by linear solvers.
Definition CSysVector.hpp:195
void DtHTransfer(bool trigger=true) const
Performs the memory copy from device to host.
Definition CSysVectorGPU.cu:200
void HtDTransfer(bool trigger=true) const
Performs the memory copy from host to device.
Definition CSysVectorGPU.cu:193
static CPreconditioner * Create(ENUM_LINEAR_SOLVER_PREC kind, CSysMatrix< ScalarType > &jacobian, CGeometry *geometry, const CConfig *config)
Factory method.
Definition CPreconditioner.hpp:415
void ApplyPreconditionerOnHost(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v, Apply &&apply)
Applies a preconditioner that only has a host implementation to vectors that live on the device: brin...
Definition CPreconditioner.hpp:48
virtual ~CPreconditioner()=0
Destructor of the class.
Definition CPreconditioner.hpp:132
void ApplyPreconditionerOnDevice(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v, bool useCuda, Apply &&apply)
Mirror of ApplyPreconditionerOnHost: applies a device preconditioner to host vectors.
Definition CPreconditioner.hpp:75
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59
bool UseDeviceExpressions()
Whether vector expressions are currently evaluated on the device.
Definition CSysVector.hpp:119
void SetUseDeviceExpressions(bool)
Definition CSysVector.hpp:120
ENUM_LINEAR_SOLVER_PREC
Types of preconditioners for the linear solver.
Definition option_structure.hpp:2658
@ JACOBI
Jacobi preconditioner.
Definition option_structure.hpp:2660
@ LINELET
Line implicit preconditioner.
Definition option_structure.hpp:2662
@ ILU
ILU(k) preconditioner.
Definition option_structure.hpp:2663
@ Q_IDENTITY
No preconditioner, but the matrix-vector product still uses quantized (int8) off-diagonal storage,...
Definition option_structure.hpp:2667
@ PASTIX_ILU
PaStiX ILU(k) preconditioner.
Definition option_structure.hpp:2669
@ Q_JACOBI
Jacobi with quantized (int8) off-diagonal storage; same matvec quantization as Q_LU_SGS,...
Definition option_structure.hpp:2665
@ PASTIX_LDLT_P
PaStiX LDLT as preconditioner.
Definition option_structure.hpp:2671
@ PASTIX_LU_P
PaStiX LU as preconditioner.
Definition option_structure.hpp:2670
@ Q_LU_SGS
LU-SGS with quantized (int8) off-diagonal storage; L/U are never allocated as ScalarType.
Definition option_structure.hpp:2664
@ IDENTITY
No preconditioner.
Definition option_structure.hpp:2659
@ LU_SGS
LU SGS preconditioner.
Definition option_structure.hpp:2661