9.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-2025 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 "base/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
67void
69
70#if defined(__CUDACC__)
71
72/*----------------------------------------------------------------------------*/
83/*----------------------------------------------------------------------------*/
84
85void
86cs_matrix_spmv_cuda_set_stream(cudaStream_t stream);
87
88/*----------------------------------------------------------------------------*/
94/*----------------------------------------------------------------------------*/
95
96cudaStream_t
97cs_matrix_spmv_cuda_get_stream(void);
98
99#endif /* defined(__CUDACC__) */
100
101/*----------------------------------------------------------------------------*/
111/*----------------------------------------------------------------------------*/
112
113void
115 bool exclude_diag,
116 bool sync,
117 cs_real_t d_x[],
118 cs_real_t d_y[]);
119
120/*----------------------------------------------------------------------------*/
130/*----------------------------------------------------------------------------*/
131
132void
134 bool exclude_diag,
135 bool sync,
136 cs_real_t d_x[],
137 cs_real_t d_y[]);
138
139#if defined(HAVE_CUSPARSE)
140
141/*----------------------------------------------------------------------------*/
151/*----------------------------------------------------------------------------*/
152
153void
154cs_matrix_spmv_cuda_csr_cusparse(cs_matrix_t *matrix,
155 bool exclude_diag,
156 bool sync,
157 cs_real_t d_x[],
158 cs_real_t d_y[]);
159
160#endif /* defined(HAVE_CUSPARSE) */
161
162/*----------------------------------------------------------------------------*/
172/*----------------------------------------------------------------------------*/
173
174void
176 bool exclude_diag,
177 bool sync,
178 cs_real_t d_x[],
179 cs_real_t d_y[]);
180
181#if defined(HAVE_CUSPARSE)
182
183/*----------------------------------------------------------------------------*/
193/*----------------------------------------------------------------------------*/
194
195void
196cs_matrix_spmv_cuda_msr_cusparse(cs_matrix_t *matrix,
197 bool exclude_diag,
198 bool sync,
199 cs_real_t d_x[],
200 cs_real_t d_y[]);
201
202#endif /* defined(HAVE_CUSPARSE) */
203
204/*----------------------------------------------------------------------------*/
215/*----------------------------------------------------------------------------*/
216
217void
219 bool exclude_diag,
220 bool sync,
221 cs_real_t d_x[],
222 cs_real_t d_y[]);
223
224#if defined(HAVE_CUSPARSE)
225
226/*----------------------------------------------------------------------------*/
242/*----------------------------------------------------------------------------*/
243
244void
245cs_matrix_spmv_cuda_msr_b_cusparse(cs_matrix_t *matrix,
246 bool exclude_diag,
247 bool sync,
248 cs_real_t d_x[],
249 cs_real_t d_y[]);
250
251#endif /* defined(HAVE_CUSPARSE) */
252
253/*----------------------------------------------------------------------------*/
269/*----------------------------------------------------------------------------*/
270
271void
273 bool exclude_diag,
274 bool sync,
275 cs_real_t d_x[],
276 cs_real_t d_y[]);
277
278/*----------------------------------------------------------------------------*/
279
281
282#endif /* __CS_MATRIX_SPMV__CUDA_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
double cs_real_t
Floating-point value.
Definition: cs_defs.h:357
#define END_C_DECLS
Definition: cs_defs.h:555
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:114
void cs_matrix_spmv_cuda_msr_bb_cusparse(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[], cs_real_t d_y[])
Matrix.vector product y = A.x with MSR matrix, block cuSPARSE version.
void cs_matrix_spmv_cuda_csr(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[], cs_real_t d_y[])
Matrix.vector product y = A.x with CSR matrix, scalar CUDA version.
void cs_matrix_spmv_cuda_native(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[], cs_real_t d_y[])
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(cs_matrix_t *matrix, bool exclude_diag, bool sync, cs_real_t d_x[], cs_real_t d_y[])
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[], cs_real_t d_y[])
Matrix.vector product y = A.x with MSR matrix, block diagonal CUDA version.