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_);
36
37 void upload(Scalar *vals,
38 int *cols,
39 int *rows,
40 hipStream_t stream);
41
42 void upload(Matrix<Scalar> *matrix,
43 hipStream_t stream);
44
46 hipStream_t stream);
47
48 Scalar* nnzValues;
51 int Nb, Mb;
52 int nnzbs;
53 unsigned int block_size;
54};
55
56template <typename Scalar>
58public:
59
60 RocmVector(int N);
61
62 void upload(Scalar *vals,
63 hipStream_t stream);
64
65 void upload(Matrix<Scalar> *matrix,
66 hipStream_t stream);
67
68 Scalar* nnzValues;
69 int size;
70};
71} // namespace Opm
72
73#endif
Definition: BlockedMatrix.hpp:29
Definition: Matrix.hpp:34
This struct resembles a csr matrix.
Definition: rocsparseMatrix.hpp:32
int * colIndices
Definition: rocsparseMatrix.hpp:49
int nnzbs
Definition: rocsparseMatrix.hpp:52
int Nb
Definition: rocsparseMatrix.hpp:51
int * rowPointers
Definition: rocsparseMatrix.hpp:50
void upload(Matrix< Scalar > *matrix, hipStream_t stream)
Scalar * nnzValues
Definition: rocsparseMatrix.hpp:48
unsigned int block_size
Definition: rocsparseMatrix.hpp:53
int Mb
Definition: rocsparseMatrix.hpp:51
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:57
void upload(Scalar *vals, hipStream_t stream)
int size
Definition: rocsparseMatrix.hpp:69
Scalar * nnzValues
Definition: rocsparseMatrix.hpp:68
void upload(Matrix< Scalar > *matrix, hipStream_t stream)
Definition: amgclSolverBackend.hpp:44