8.3
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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-2024 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
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 *
85 * CS_MATRIX_CSR (for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
86 * default
87 * mkl (with MKL)
88 * mkl_sycl (with MKL, using SYCL offload)
89 * cuda (CUDA-accelerated)
90 * cusparse (with cuSPARSE)
91 *
92 * CS_MATRIX_MSR
93 * default
94 * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
95 * mkl (with MKL)
96 * mkl_sycl (with MKL, using SYCL offload)
97 * cuda (CUDA-accelerated)
98 * cusparse (with cuSPARSE)
99 *
100 * CS_MATRIX_DIST
101 * default
102 * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
103 * mkl (with MKL)
104 * mkl_sycl (with MKL, using SYCL offload)
105 *
106 * parameters:
107 * m_type <-- Matrix type
108 * fill type <-- matrix fill type to merge from
109 * spmv_type <-- SpMV operation type (full or sub-matrix)
110 * (all types if CS_MATRIX_SPMV_N_TYPES)
111 * numbering <-- mesh numbering structure, or nullptr
112 * func_name <-- function type name, or nullptr for default
113 * spmv <-> multiplication function array
114 * spmv_xy_hd <-> multiplication function x and y host/device location
115 *
116 * returns:
117 * 0 for success, 1 for incompatible function, 2 for compatible
118 * function not available in current build
119 *----------------------------------------------------------------------------*/
120
121int
123 cs_matrix_fill_type_t fill_type,
124 cs_matrix_spmv_type_t spmv_type,
125 const cs_numbering_t *numbering,
126 const char *func_name,
127 cs_matrix_vector_product_t *spmv[CS_MATRIX_SPMV_N_TYPES],
128 char spmv_xy_hd[CS_MATRIX_SPMV_N_TYPES]);
129
130/*======================================à=======================================
131 * Public function prototypes
132 *============================================================================*/
133
134/*----------------------------------------------------------------------------*/
135
137
138#endif /* __CS_MATRIX_SPMV_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
cs_matrix_spmv_type_t
Definition: cs_matrix.h:95
@ CS_MATRIX_SPMV_N_TYPES
Definition: cs_matrix.h:100
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
cs_matrix_fill_type_t
Definition: cs_matrix.h:72
cs_matrix_type_t
Definition: cs_matrix.h:54
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:3960
void cs_matrix_spmv_set_defaults(cs_matrix_t *m)
Definition: cs_matrix_spmv.cpp:3881
Definition: cs_numbering.h:87