9.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-2026 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#include "base/cs_halo.h"
37#include "base/cs_numbering.h"
38#include "alge/cs_matrix_priv.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
68void
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 * cuda (CUDA-accelerated)
84 * hip (HIP-accelerated)
85 *
86 * CS_MATRIX_CSR (for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
87 * default
88 * mkl (with MKL)
89 * mkl_sycl (with MKL, using SYCL offload)
90 * cuda (CUDA-accelerated)
91 * cusparse (with cuSPARSE)
92 * hip (HIP-accelerated)
93 * rocsparse (with rocSPARSE)
94 *
95 * CS_MATRIX_MSR
96 * default
97 * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
98 * mkl (with MKL)
99 * mkl_sycl (with MKL, using SYCL offload)
100 * cuda (CUDA-accelerated)
101 * cusparse (with cuSPARSE)
102 * hip (HIP-accelerated)
103 * rocsparse (with rocSPARSE)
104 *
105 * CS_MATRIX_DIST
106 * default
107 * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
108 * mkl (with MKL)
109 * mkl_sycl (with MKL, using SYCL offload)
110 *
111 * parameters:
112 * m_type <-- Matrix type
113 * fill type <-- matrix fill type to merge from
114 * spmv_type <-- SpMV operation type (full or sub-matrix)
115 * (all types if CS_MATRIX_SPMV_N_TYPES)
116 * numbering <-- mesh numbering structure, or nullptr
117 * func_name <-- function type name, or nullptr for default
118 * spmv <-> multiplication function array
119 * spmv_xy_hd <-> multiplication function x and y host/device location
120 *
121 * returns:
122 * 0 for success, 1 for incompatible function, 2 for compatible
123 * function not available in current build
124 *----------------------------------------------------------------------------*/
125
126int
128 cs_matrix_fill_type_t fill_type,
129 cs_matrix_spmv_type_t spmv_type,
130 const cs_numbering_t *numbering,
131 const char *func_name,
132 cs_matrix_vector_product_t *spmv[CS_MATRIX_SPMV_N_TYPES],
133 char spmv_xy_hd[CS_MATRIX_SPMV_N_TYPES]);
134
135/*======================================à=======================================
136 * Public function prototypes
137 *============================================================================*/
138
139/*----------------------------------------------------------------------------*/
140
142
143#endif /* CS_MATRIX_SPMV_H */
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
#define END_C_DECLS
Definition: cs_defs.h:529
cs_matrix_spmv_type_t
Definition: cs_matrix.h:93
@ CS_MATRIX_SPMV_N_TYPES
Definition: cs_matrix.h:98
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:108
cs_matrix_fill_type_t
Definition: cs_matrix.h:70
cs_matrix_type_t
Definition: cs_matrix.h:52
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.cpp:3980
void cs_matrix_spmv_set_defaults(cs_matrix_t *m)
Definition: cs_matrix_spmv.cpp:3891
Definition: cs_numbering.h:91