7.2
general documentation
cs_matrix_spmv.h
Go to the documentation of this file.
1 #ifndef __CS_MATRIX_SPMV_H__
2 #define __CS_MATRIX_SPMV_H__
3 
4 /*============================================================================
5  * Sparse Matrix-vector multiplication functions and kernels.
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 #include "cs_halo.h"
37 #include "cs_numbering.h"
38 #include "cs_matrix_priv.h"
39 #include "cs_matrix_assembler.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Global variables
55  *============================================================================*/
56 
57 /*=============================================================================
58  * Semi-private function prototypes
59  *============================================================================*/
60 
61 /*----------------------------------------------------------------------------
62  * Assign default sparse matrix-vector product functions for a given matrix.
63  *
64  * parameters:
65  * m <-> pointer to matrix structure
66  *----------------------------------------------------------------------------*/
67 
68 void
70 
71 /*----------------------------------------------------------------------------
72  * Select the sparse matrix-vector product function to be used by a
73  * matrix or variant for a given fill type.
74  *
75  * Currently, possible variant functions are:
76  *
77  * CS_MATRIX_NATIVE (all fill types)
78  * default
79  * baseline
80  * omp (for OpenMP with compatible numbering)
81  * omp_atomic (for OpenMP with atomic add)
82  * vector (For vector machine with compatible numbering)
83  *
84  * CS_MATRIX_CSR (for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
85  * default
86  * mkl (with MKL)
87  * cuda (CUDA-accelerated)
88  * cusparse (with cuSPARSE)
89  *
90  * CS_MATRIX_MSR
91  * default
92  * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
93  * mkl (with MKL, for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
94  * cuda (CUDA-accelerated)
95  * cusparse (with cuSPARSE)
96  *
97  * CS_MATRIX_DIST
98  * default
99  * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
100  * mkl (with MKL, for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
101  *
102  * parameters:
103  * m_type <-- Matrix type
104  * fill type <-- matrix fill type to merge from
105  * spmv_type <-- SpMV operation type (full or sub-matrix)
106  * (all types if CS_MATRIX_SPMV_N_TYPES)
107  * numbering <-- mesh numbering structure, or NULL
108  * func_name <-- function type name, or NULL for default
109  * spmv <-> multiplication function array
110  * spmv_xy_hd <-> multiplication function x and y host/device location
111  *
112  * returns:
113  * 0 for success, 1 for incompatible function, 2 for compatible
114  * function not available in current build
115  *----------------------------------------------------------------------------*/
116 
117 int
119  cs_matrix_fill_type_t fill_type,
120  cs_matrix_spmv_type_t spmv_type,
121  const cs_numbering_t *numbering,
122  const char *func_name,
123  cs_matrix_vector_product_t *spmv[CS_MATRIX_SPMV_N_TYPES],
124  char spmv_xy_hd[CS_MATRIX_SPMV_N_TYPES]);
125 
126 /*======================================à=======================================
127  * Public function prototypes
128  *============================================================================*/
129 
130 /*----------------------------------------------------------------------------*/
131 
133 
134 #endif /* __CS_MATRIX_SPMV_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
int cs_matrix_spmv_set_func(cs_matrix_type_t m_type, cs_matrix_fill_type_t fill_type, cs_matrix_spmv_type_t spmv_type, const cs_numbering_t *numbering, const char *func_name, cs_matrix_vector_product_t *spmv[CS_MATRIX_SPMV_N_TYPES], char spmv_xy_hd[CS_MATRIX_SPMV_N_TYPES])
Definition: cs_matrix_spmv.c:3101
cs_matrix_spmv_type_t
Definition: cs_matrix.h:95
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
Definition: cs_matrix.h:100
void cs_matrix_spmv_set_defaults(cs_matrix_t *m)
Definition: cs_matrix_spmv.c:3024
cs_matrix_type_t
Definition: cs_matrix.h:54
#define END_C_DECLS
Definition: cs_defs.h:511
Definition: cs_numbering.h:87
cs_matrix_fill_type_t
Definition: cs_matrix.h:72