8.0
general documentation
cs_sles_it_cuda.h
Go to the documentation of this file.
1 #ifndef __CS_SLES_IT_CUDA_H__
2 #define __CS_SLES_IT_CUDA_H__
3 
4 /*============================================================================
5  * Sparse Linear Equation Solvers using CUDA
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_matrix.h"
36 #include "cs_sles.h"
37 #include "cs_sles_pc.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
47 /*============================================================================
48  * Type definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Global variables
53  *============================================================================*/
54 
55 /*=============================================================================
56  * User function prototypes
57  *============================================================================*/
58 
59 /*=============================================================================
60  * Public function prototypes
61  *============================================================================*/
62 
63 /*----------------------------------------------------------------------------
64  * Solution of A.vx = Rhs using Jacobi.
65  *
66  * On entry, vx is considered initialized.
67  *
68  * parameters:
69  * c <-- pointer to solver context info
70  * a <-- linear equation matrix
71  * diag_block_size <-- diagonal block size
72  * rotation_mode <-- halo update option for rotational periodicity
73  * convergence <-- convergence information structure
74  * rhs <-- right hand side
75  * vx <-> system solution
76  * aux_size <-- number of elements in aux_vectors (in bytes)
77  * aux_vectors --- optional working area (allocation otherwise)
78  *
79  * returns:
80  * convergence state
81  *----------------------------------------------------------------------------*/
82 
85  const cs_matrix_t *a,
86  cs_lnum_t diag_block_size,
87  cs_sles_it_convergence_t *convergence,
88  const cs_real_t *rhs,
89  cs_real_t *restrict vx,
90  size_t aux_size,
91  void *aux_vectors);
92 
93 /*----------------------------------------------------------------------------
94  * Solution of A.vx = Rhs using block Jacobi.
95  *
96  * On entry, vx is considered initialized.
97  *
98  * parameters:
99  * c <-- pointer to solver context info
100  * a <-- linear equation matrix
101  * diag_block_size <-- diagonal block size
102  * rotation_mode <-- halo update option for rotational periodicity
103  * convergence <-- convergence information structure
104  * rhs <-- right hand side
105  * vx <-> system solution
106  * aux_size <-- number of elements in aux_vectors (in bytes)
107  * aux_vectors --- optional working area (allocation otherwise)
108  *
109  * returns:
110  * convergence state
111  *----------------------------------------------------------------------------*/
112 
115  const cs_matrix_t *a,
116  cs_lnum_t diag_block_size,
117  cs_sles_it_convergence_t *convergence,
118  const cs_real_t *rhs,
119  cs_real_t *restrict vx,
120  size_t aux_size,
121  void *aux_vectors);
122 
123 /*----------------------------------------------------------------------------
124  * Solution of A.vx = Rhs using flexible preconditioned conjugate gradient.
125  *
126  * Compared to standard PCG, FCG supports variable preconditioners.
127  *
128  * This variant, described in \cite Notay:2015, allows computing the
129  * required inner products with a single global communication.
130  *
131  * On entry, vx is considered initialized.
132  *
133  * parameters:
134  * c <-- pointer to solver context info
135  * a <-- matrix
136  * diag_block_size <-- diagonal block size
137  * convergence <-- convergence information structure
138  * rhs <-- right hand side
139  * vx <-> system solution
140  * aux_size <-- number of elements in aux_vectors (in bytes)
141  * aux_vectors --- optional working area (allocation otherwise)
142  *
143  * returns:
144  * convergence state
145  *----------------------------------------------------------------------------*/
146 
149  const cs_matrix_t *a,
150  cs_lnum_t diag_block_size,
151  cs_sles_it_convergence_t *convergence,
152  const cs_real_t *rhs,
153  cs_real_t *restrict vx,
154  size_t aux_size,
155  void *aux_vectors);
156 
157 /*----------------------------------------------------------------------------
158  * Solution of A.vx = Rhs using optimised preconditioned GCR (CUDA version).
159  *
160  * On entry, vx is considered initialized.
161  *
162  * parameters:
163  * c <-- pointer to solver context info
164  * a <-- matrix
165  * diag_block_size <-- diagonal block size (unused here)
166  * convergence <-- convergence information structure
167  * rhs <-- right hand side
168  * vx <-> system solution
169  * aux_size <-- number of elements in aux_vectors (in bytes)
170  * aux_vectors --- optional working area (allocation otherwise)
171  *
172  * returns:
173  * convergence state
174  *----------------------------------------------------------------------------*/
175 
178  const cs_matrix_t *a,
179  cs_lnum_t diag_block_size,
180  cs_sles_it_convergence_t *convergence,
181  const cs_real_t *rhs,
182  cs_real_t *restrict vx,
183  size_t aux_size,
184  void *aux_vectors);
185 
186 /*----------------------------------------------------------------------------*/
187 
189 
190 #endif /* __CS_SLES_IT_CUDA_H__ */
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
cs_sles_convergence_state_t
Definition: cs_sles.h:56
struct _cs_sles_it_t cs_sles_it_t
Definition: cs_sles_it.h:86
struct _cs_sles_it_convergence_t cs_sles_it_convergence_t
Definition: cs_sles_it.h:90
cs_sles_convergence_state_t cs_sles_it_cuda_gcr(cs_sles_it_t *c, const cs_matrix_t *a, cs_lnum_t diag_block_size, cs_sles_it_convergence_t *convergence, const cs_real_t *rhs, cs_real_t *restrict vx, size_t aux_size, void *aux_vectors)
cs_sles_convergence_state_t cs_sles_it_cuda_jacobi(cs_sles_it_t *c, const cs_matrix_t *a, cs_lnum_t diag_block_size, cs_sles_it_convergence_t *convergence, const cs_real_t *rhs, cs_real_t *restrict vx, size_t aux_size, void *aux_vectors)
cs_sles_convergence_state_t cs_sles_it_cuda_fcg(cs_sles_it_t *c, const cs_matrix_t *a, cs_lnum_t diag_block_size, cs_sles_it_convergence_t *convergence, const cs_real_t *rhs, cs_real_t *restrict vx, size_t aux_size, void *aux_vectors)
cs_sles_convergence_state_t cs_sles_it_cuda_block_jacobi(cs_sles_it_t *c, const cs_matrix_t *a, cs_lnum_t diag_block_size, cs_sles_it_convergence_t *convergence, const cs_real_t *rhs, cs_real_t *restrict vx, size_t aux_size, void *aux_vectors)
double precision, save a
Definition: cs_fuel_incl.f90:148