8.0
general documentation
Loading...
Searching...
No Matches
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-2023 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 * cuda (CUDA-accelerated)
89 * cusparse (with cuSPARSE)
90 *
91 * CS_MATRIX_MSR
92 * default
93 * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
94 * mkl (with MKL, for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
95 * cuda (CUDA-accelerated)
96 * cusparse (with cuSPARSE)
97 *
98 * CS_MATRIX_DIST
99 * default
100 * omp_sched (Improved OpenMP scheduling, for CS_MATRIX_SCALAR*)
101 * mkl (with MKL, for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
102 *
103 * parameters:
104 * m_type <-- Matrix type
105 * fill type <-- matrix fill type to merge from
106 * spmv_type <-- SpMV operation type (full or sub-matrix)
107 * (all types if CS_MATRIX_SPMV_N_TYPES)
108 * numbering <-- mesh numbering structure, or NULL
109 * func_name <-- function type name, or NULL for default
110 * spmv <-> multiplication function array
111 * spmv_xy_hd <-> multiplication function x and y host/device location
112 *
113 * returns:
114 * 0 for success, 1 for incompatible function, 2 for compatible
115 * function not available in current build
116 *----------------------------------------------------------------------------*/
117
118int
120 cs_matrix_fill_type_t fill_type,
121 cs_matrix_spmv_type_t spmv_type,
122 const cs_numbering_t *numbering,
123 const char *func_name,
124 cs_matrix_vector_product_t *spmv[CS_MATRIX_SPMV_N_TYPES],
125 char spmv_xy_hd[CS_MATRIX_SPMV_N_TYPES]);
126
127/*======================================à=======================================
128 * Public function prototypes
129 *============================================================================*/
130
131/*----------------------------------------------------------------------------*/
132
134
135#endif /* __CS_MATRIX_SPMV_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:509
#define END_C_DECLS
Definition cs_defs.h:510
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.c:3111
void cs_matrix_spmv_set_defaults(cs_matrix_t *m)
Definition cs_matrix_spmv.c:3033
Definition cs_numbering.h:87