My Project
Loading...
Searching...
No Matches
rocsparseMatrix.hpp
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
45 void upload(BlockedMatrix<Scalar> *matrix,
46 hipStream_t stream);
47
48 Scalar* nnzValues;
49 int* colIndices;
50 int* rowPointers;
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
This struct resembles a blocked csr matrix, like Dune::BCRSMatrix.
Definition rocsparsePreconditioner.hpp:29
This struct resembles a csr matrix, only doubles are supported The data is stored in contiguous memor...
Definition rocsparseMatrix.hpp:27
This struct resembles a csr matrix.
Definition rocsparseMatrix.hpp:32
Definition rocsparseMatrix.hpp:57