8.1
general documentation
cs_matrix_spmv_cuda.h
Go to the documentation of this file.
1 #ifndef __CS_MATRIX_SPMV_CUDA_H__
2 #define __CS_MATRIX_SPMV_CUDA_H__
3 
4 /*============================================================================
5  * Sparse Matrix-vector multiplication kernels 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_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*----------------------------------------------------------------------------*/
45 /*----------------------------------------------------------------------------*/
46 
47 /*============================================================================
48  * Public CUDA kernel prototypes
49  *============================================================================*/
50 
51 #if defined(__CUDACC__)
52 
53 #endif /* defined(__CUDACC__) */
54 
55 /*============================================================================
56  * Public function prototypes
57  *============================================================================*/
58 
59 /*----------------------------------------------------------------------------*/
65 /*----------------------------------------------------------------------------*/
66 
67 void
69 
70 #if defined(__CUDACC__)
71 
72 /*----------------------------------------------------------------------------*/
83 /*----------------------------------------------------------------------------*/
84 
85 void
86 cs_matrix_spmv_cuda_set_stream(cudaStream_t stream);
87 
88 /*----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------*/
95 
96 cudaStream_t
97 cs_matrix_spmv_cuda_get_stream(void);
98 
99 #endif /* defined(__CUDACC__) */
100 
101 /*----------------------------------------------------------------------------*/
111 /*----------------------------------------------------------------------------*/
112 
113 void
115  bool exclude_diag,
116  bool sync,
117  cs_real_t d_x[restrict],
118  cs_real_t d_y[restrict]);
119 
120 /*----------------------------------------------------------------------------*/
130 /*----------------------------------------------------------------------------*/
131 
132 void
134  bool exclude_diag,
135  bool sync,
136  cs_real_t d_x[restrict],
137  cs_real_t d_y[restrict]);
138 
139 /*----------------------------------------------------------------------------*/
149 /*----------------------------------------------------------------------------*/
150 
151 void
153  bool exclude_diag,
154  bool sync,
155  cs_real_t d_x[restrict],
156  cs_real_t d_y[restrict]);
157 
158 /*----------------------------------------------------------------------------*/
168 /*----------------------------------------------------------------------------*/
169 
170 void
172  bool exclude_diag,
173  bool sync,
174  cs_real_t d_x[restrict],
175  cs_real_t d_y[restrict]);
176 
177 /*----------------------------------------------------------------------------*/
187 /*----------------------------------------------------------------------------*/
188 
189 void
191  bool exclude_diag,
192  bool sync,
193  cs_real_t d_x[restrict],
194  cs_real_t d_y[restrict]);
195 
196 /*----------------------------------------------------------------------------*/
207 /*----------------------------------------------------------------------------*/
208 
209 void
211  bool exclude_diag,
212  bool sync,
213  cs_real_t d_x[restrict],
214  cs_real_t d_y[restrict]);
215 
216 #if defined(HAVE_CUSPARSE_GENERIC_API)
217 
218 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
237 cs_matrix_spmv_cuda_msr_b_cusparse(cs_matrix_t *matrix,
238  bool exclude_diag,
239  bool sync,
240  cs_real_t d_x[restrict],
241  cs_real_t d_y[restrict]);
242 
243 #endif /* defined(HAVE_CUSPARSE_GENERIC_API) */
244 
245 /*----------------------------------------------------------------------------*/
261 /*----------------------------------------------------------------------------*/
262 
263 void
265  bool exclude_diag,
266  bool sync,
267  cs_real_t d_x[restrict],
268  cs_real_t d_y[restrict]);
269 
270 /*----------------------------------------------------------------------------*/
271 
273 
274 #endif /* __CS_MATRIX_SPMV__CUDA_H__ */
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
void matrix(const int *iconvp, const int *idiffp, const int *ndircp, const int *isym, const cs_real_t *thetap, const int *imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
void cs_matrix_spmv_cuda_csr(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with CSR matrix, scalar CUDA version.
void cs_matrix_spmv_cuda_msr(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with MSR matrix, scalar CUDA version.
void cs_matrix_spmv_cuda_finalize(void)
Finalize CUDA matrix API.
void cs_matrix_spmv_cuda_msr_cusparse(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with MSR matrix, scalar cuSPARSE version.
void cs_matrix_spmv_cuda_msr_bb_cusparse(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with MSR matrix, block cuSPARSE version.
void cs_matrix_spmv_cuda_native(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with MSR matrix, scalar CUDA version.
void cs_matrix_spmv_cuda_msr_b(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with MSR matrix, block diagonal CUDA version.
void cs_matrix_spmv_cuda_csr_cusparse(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[restrict], cs_real_t d_y[restrict])
Matrix.vector product y = A.x with CSR matrix, scalar cuSPARSE version.