7.2
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-2022 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 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 void
192  bool exclude_diag,
193  bool sync,
194  cs_real_t d_x[restrict],
195  cs_real_t d_y[restrict]);
196 
197 #if defined(HAVE_CUSPARSE_GENERIC_API)
198 
199 /*----------------------------------------------------------------------------*/
210 /*----------------------------------------------------------------------------*/
211 
212 void
213 cs_matrix_spmv_cuda_msr_b_cusparse(cs_matrix_t *matrix,
214  bool exclude_diag,
215  bool sync,
216  cs_real_t d_x[restrict],
217  cs_real_t d_y[restrict]);
218 
219 #endif /* defined(HAVE_CUSPARSE_GENERIC_API) */
220 
221 /*----------------------------------------------------------------------------*/
237 /*----------------------------------------------------------------------------*/
238 
239 void
241  bool exclude_diag,
242  bool sync,
243  cs_real_t d_x[restrict],
244  cs_real_t d_y[restrict]);
245 
246 /*----------------------------------------------------------------------------*/
247 
249 
250 #endif /* __CS_MATRIX_SPMV__CUDA_H__ */
#define restrict
Definition: cs_defs.h:142
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.
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
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[])
Definition: cs_matrix_building.c:111
void cs_matrix_spmv_cuda_csr(const 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.
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
void cs_matrix_spmv_cuda_finalize(void)
Finalize CUDA matrix API.
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_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.
#define END_C_DECLS
Definition: cs_defs.h:511
void cs_matrix_spmv_cuda_msr(const 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_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.