Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
cuda_precondition.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2018 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_cuda_precondition_h
16#define dealii_cuda_precondition_h
17
18#include <deal.II/base/config.h>
19
20#include <deal.II/base/cuda.h>
22
23#include <memory>
24
25#ifdef DEAL_II_WITH_CUDA
26
28
29// forward-definition
30# ifndef DOXYGEN
31namespace LinearAlgebra
32{
33 namespace CUDAWrappers
34 {
35 template <typename Number>
36 class Vector;
37 }
38} // namespace LinearAlgebra
39# endif
40
41namespace CUDAWrappers
42{
43 // forward definition
44 template <typename Number>
45 class SparseMatrix;
46
60 template <typename Number>
62 {
63 public:
67 using size_type = int;
68
74 {
81
90 };
91
96
101
107
112
122 void
123 initialize(const SparseMatrix<Number> &matrix,
124 const AdditionalData &additional_data = AdditionalData());
125
129 void
132
137 void
140
149 m() const;
150
159 n() const;
160
161 private:
165 cusparseHandle_t cusparse_handle;
166
170 cusparseMatDescr_t descr_M;
171
175 cusparseMatDescr_t descr_L;
176
180 csric02Info_t info_M;
181
185 csrsv2Info_t info_L;
186
190 csrsv2Info_t info_Lt;
191
196
201 std::unique_ptr<Number[], void (*)(Number *)> P_val_dev;
202
207 const int *P_row_ptr_dev;
208
214
219 std::unique_ptr<Number[], void (*)(Number *)> tmp_dev;
220
225 std::unique_ptr<void, void (*)(void *)> buffer_dev;
226
232 cusparseSolvePolicy_t policy_L;
233
239 cusparseSolvePolicy_t policy_Lt;
240
245 cusparseSolvePolicy_t policy_M;
246
252
258 };
259
273 template <typename Number>
275 {
276 public:
280 using size_type = int;
281
287 {
294
303 };
304
309
314
320
325
335 void
336 initialize(const SparseMatrix<Number> &matrix,
337 const AdditionalData &additional_data = AdditionalData());
338
342 void
345
349 void
352
361 m() const;
362
371 n() const;
372
373 private:
377 cusparseHandle_t cusparse_handle;
378
382 cusparseMatDescr_t descr_M;
383
387 cusparseMatDescr_t descr_L;
388
392 cusparseMatDescr_t descr_U;
393
397 csrilu02Info_t info_M;
398
402 csrsv2Info_t info_L;
403
407 csrsv2Info_t info_U;
408
413
418 std::unique_ptr<Number[], void (*)(Number *)> P_val_dev;
419
424 const int *P_row_ptr_dev;
425
431
436 std::unique_ptr<Number[], void (*)(Number *)> tmp_dev;
437
442 std::unique_ptr<void, void (*)(void *)> buffer_dev;
443
449 cusparseSolvePolicy_t policy_L;
450
456 cusparseSolvePolicy_t policy_U;
457
462 cusparseSolvePolicy_t policy_M;
463
469
475 };
476
477 /*--------------------------- inline functions ----------------------------*/
478
479# ifndef DOXYGEN
480 template <typename Number>
483 {
484 return n_rows;
485 }
486
487
488
489 template <typename Number>
492 {
493 return n_rows;
494 }
495
496
497
498 template <typename Number>
501 {
502 return n_rows;
503 }
504
505
506
507 template <typename Number>
510 {
511 return n_rows;
512 }
513# endif // DOXYGEN
514
515} // namespace CUDAWrappers
516
518
519#endif // DEAL_II_WITH_CUDA
520
521#endif // dealii_cuda_precondition_h
cusparseSolvePolicy_t policy_M
std::unique_ptr< Number[], void(*)(Number *)> P_val_dev
void Tvmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
std::unique_ptr< Number[], void(*)(Number *)> tmp_dev
PreconditionIC & operator=(const PreconditionIC< Number > &)=delete
void initialize(const SparseMatrix< Number > &matrix, const AdditionalData &additional_data=AdditionalData())
cusparseSolvePolicy_t policy_Lt
cusparseSolvePolicy_t policy_L
void vmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
PreconditionIC(const Utilities::CUDA::Handle &handle)
SmartPointer< const SparseMatrix< Number > > matrix_pointer
std::unique_ptr< void, void(*)(void *)> buffer_dev
PreconditionIC(const PreconditionIC< Number > &)=delete
void vmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
PreconditionILU(const PreconditionILU< Number > &)=delete
std::unique_ptr< void, void(*)(void *)> buffer_dev
void initialize(const SparseMatrix< Number > &matrix, const AdditionalData &additional_data=AdditionalData())
SmartPointer< const SparseMatrix< Number > > matrix_pointer
PreconditionILU(const Utilities::CUDA::Handle &handle)
std::unique_ptr< Number[], void(*)(Number *)> P_val_dev
std::unique_ptr< Number[], void(*)(Number *)> tmp_dev
PreconditionILU & operator=(const PreconditionILU< Number > &)=delete
void Tvmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504