hipKernels.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_HIPKERNELS_HPP
21#define OPM_HIPKERNELS_HPP
22
23#include <string>
24#include <memory>
25#include <cstddef>
26
27#include <hip/hip_runtime_api.h>
28#include <hip/hip_version.h>
29
30namespace Opm {
31
32template<class Scalar>
34{
35private:
36 static int verbosity;
37 static bool initialized;
38
39 HipKernels();
40
41public:
44 static void init(int verbosity);
45
52 static void full_to_pressure_restriction(const Scalar* fine_y,
53 Scalar* weights,
54 Scalar* coarse_y,
55 int Nb,
56 hipStream_t stream);
57
64 static void add_coarse_pressure_correction(Scalar* coarse_x,
65 Scalar* fine_x,
66 int pressure_idx,
67 int Nb,
68 hipStream_t stream);
69
70
78 static void vmul(const Scalar alpha,
79 Scalar* in1,
80 Scalar* in2,
81 Scalar* out,
82 int N,
83 hipStream_t stream);
84
91 static void prolongate_vector(const Scalar* in,
92 Scalar* out,
93 const int* cols,
94 int N,
95 hipStream_t stream);
96
107 static void residual(Scalar* vals,
108 int* cols,
109 int* rows,
110 Scalar* x,
111 const Scalar* rhs,
112 Scalar* out,
113 int Nb,
114 unsigned int block_size,
115 hipStream_t stream);
116
126 static void spmv(Scalar* vals,
127 int* cols,
128 int* rows,
129 Scalar* x,
130 Scalar* y,
131 int Nb,
132 unsigned int block_size,
133 hipStream_t stream);
134};
135
136} // namespace Opm
137
138#endif
Definition: hipKernels.hpp:34
static void vmul(const Scalar alpha, Scalar *in1, Scalar *in2, Scalar *out, int N, hipStream_t stream)
static void init(int verbosity)
static void add_coarse_pressure_correction(Scalar *coarse_x, Scalar *fine_x, int pressure_idx, int Nb, hipStream_t stream)
static void spmv(Scalar *vals, int *cols, int *rows, Scalar *x, Scalar *y, int Nb, unsigned int block_size, hipStream_t stream)
static void prolongate_vector(const Scalar *in, Scalar *out, const int *cols, int N, hipStream_t stream)
static void full_to_pressure_restriction(const Scalar *fine_y, Scalar *weights, Scalar *coarse_y, int Nb, hipStream_t stream)
static void residual(Scalar *vals, int *cols, int *rows, Scalar *x, const Scalar *rhs, Scalar *out, int Nb, unsigned int block_size, hipStream_t stream)
Definition: blackoilboundaryratevector.hh:37