rocsparseMatrix.hpp
Go to the documentation of this file.
1/*
2 Copyright 2024 Equinor ASA
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_ROCMMATRIX_HEADER_INCLUDED
21#define OPM_ROCMMATRIX_HEADER_INCLUDED
22
23#include <hip/hip_runtime_api.h>
24
25namespace Opm::Accelerator {
26
27template<class Scalar> class Matrix;
28template<class Scalar> class BlockedMatrix;
29
31template<class Scalar>
33public:
34
35 RocmMatrix(int Nb_, int Mb_, int nnzbs_, unsigned int block_size_);
37
38 void upload(Scalar *vals,
39 int *cols,
40 int *rows,
41 hipStream_t stream);
42
43 void upload(Matrix<Scalar> *matrix,
44 hipStream_t stream);
45
47 hipStream_t stream);
48
49 Scalar* nnzValues;
52 int Nb, Mb;
53 int nnzbs;
54 unsigned int block_size;
55};
56
57template <typename Scalar>
59public:
60
61 RocmVector(int N);
63
64 void upload(Scalar *vals,
65 hipStream_t stream);
66
67 void upload(Matrix<Scalar> *matrix,
68 hipStream_t stream);
69
70 Scalar* nnzValues;
71 int size;
72};
73} // namespace Opm
74
75#endif
Definition: BlockedMatrix.hpp:29
Definition: Matrix.hpp:34
This struct resembles a csr matrix.
Definition: rocsparseMatrix.hpp:32
int * colIndices
Definition: rocsparseMatrix.hpp:50
int nnzbs
Definition: rocsparseMatrix.hpp:53
int Nb
Definition: rocsparseMatrix.hpp:52
int * rowPointers
Definition: rocsparseMatrix.hpp:51
void upload(Matrix< Scalar > *matrix, hipStream_t stream)
Scalar * nnzValues
Definition: rocsparseMatrix.hpp:49
unsigned int block_size
Definition: rocsparseMatrix.hpp:54
int Mb
Definition: rocsparseMatrix.hpp:52
void upload(BlockedMatrix< Scalar > *matrix, hipStream_t stream)
void upload(Scalar *vals, int *cols, int *rows, hipStream_t stream)
RocmMatrix(int Nb_, int Mb_, int nnzbs_, unsigned int block_size_)
Definition: rocsparseMatrix.hpp:58
void upload(Scalar *vals, hipStream_t stream)
int size
Definition: rocsparseMatrix.hpp:71
Scalar * nnzValues
Definition: rocsparseMatrix.hpp:70
void upload(Matrix< Scalar > *matrix, hipStream_t stream)
Definition: amgclSolverBackend.hpp:44