8.2
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-2024 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_ini <-- initial system solution
76  * (vx if nonzero, nullptr if zero)
77  * vx <-> system solution
78  * aux_size <-- number of elements in aux_vectors (in bytes)
79  * aux_vectors --- optional working area (allocation otherwise)
80  *
81  * returns:
82  * convergence state
83  *----------------------------------------------------------------------------*/
84 
87  const cs_matrix_t *a,
88  cs_lnum_t diag_block_size,
89  cs_sles_it_convergence_t *convergence,
90  const cs_real_t *rhs,
91  cs_real_t *vx_ini,
92  cs_real_t *vx,
93  size_t aux_size,
94  void *aux_vectors);
95 
96 /*----------------------------------------------------------------------------
97  * Solution of A.vx = Rhs using block Jacobi.
98  *
99  * On entry, vx is considered initialized.
100  *
101  * parameters:
102  * c <-- pointer to solver context info
103  * a <-- linear equation matrix
104  * diag_block_size <-- diagonal block size
105  * rotation_mode <-- halo update option for rotational periodicity
106  * convergence <-- convergence information structure
107  * rhs <-- right hand side
108  * vx_ini <-- initial system solution
109  * (vx if nonzero, nullptr if zero)
110  * vx <-> system solution
111  * aux_size <-- number of elements in aux_vectors (in bytes)
112  * aux_vectors --- optional working area (allocation otherwise)
113  *
114  * returns:
115  * convergence state
116  *----------------------------------------------------------------------------*/
117 
120  const cs_matrix_t *a,
121  cs_lnum_t diag_block_size,
122  cs_sles_it_convergence_t *convergence,
123  const cs_real_t *rhs,
124  cs_real_t *vx_ini,
125  cs_real_t *vx,
126  size_t aux_size,
127  void *aux_vectors);
128 
129 /*----------------------------------------------------------------------------
130  * Solution of A.vx = Rhs using flexible preconditioned conjugate gradient.
131  *
132  * Compared to standard PCG, FCG supports variable preconditioners.
133  *
134  * This variant, described in \cite Notay:2015, allows computing the
135  * required inner products with a single global communication.
136  *
137  * On entry, vx is considered initialized.
138  *
139  * parameters:
140  * c <-- pointer to solver context info
141  * a <-- matrix
142  * diag_block_size <-- diagonal block size
143  * convergence <-- convergence information structure
144  * rhs <-- right hand side
145  * vx_ini <-- initial system solution
146  * (vx if nonzero, nullptr if zero)
147  * vx <-> system solution
148  * aux_size <-- number of elements in aux_vectors (in bytes)
149  * aux_vectors --- optional working area (allocation otherwise)
150  *
151  * returns:
152  * convergence state
153  *----------------------------------------------------------------------------*/
154 
157  const cs_matrix_t *a,
158  cs_lnum_t diag_block_size,
159  cs_sles_it_convergence_t *convergence,
160  const cs_real_t *rhs,
161  cs_real_t *vx_ini,
162  cs_real_t *vx,
163  size_t aux_size,
164  void *aux_vectors);
165 
166 /*----------------------------------------------------------------------------
167  * Solution of A.vx = Rhs using optimised preconditioned GCR (CUDA version).
168  *
169  * On entry, vx is considered initialized.
170  *
171  * parameters:
172  * c <-- pointer to solver context info
173  * a <-- matrix
174  * diag_block_size <-- diagonal block size (unused here)
175  * convergence <-- convergence information structure
176  * rhs <-- right hand side
177  * vx_ini <-- initial system solution
178  * (vx if nonzero, nullptr if zero)
179  * vx <-> system solution
180  * aux_size <-- number of elements in aux_vectors (in bytes)
181  * aux_vectors --- optional working area (allocation otherwise)
182  *
183  * returns:
184  * convergence state
185  *----------------------------------------------------------------------------*/
186 
189  const cs_matrix_t *a,
190  cs_lnum_t diag_block_size,
191  cs_sles_it_convergence_t *convergence,
192  const cs_real_t *rhs,
193  cs_real_t *vx_ini,
194  cs_real_t *vx,
195  size_t aux_size,
196  void *aux_vectors);
197 
198 /*----------------------------------------------------------------------------*/
199 
201 
202 #endif /* __CS_SLES_IT_CUDA_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
#define END_C_DECLS
Definition: cs_defs.h:529
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
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_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 *vx_ini, cs_real_t *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 *vx_ini, cs_real_t *vx, size_t aux_size, void *aux_vectors)
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 *vx_ini, cs_real_t *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 *vx_ini, cs_real_t *vx, size_t aux_size, void *aux_vectors)