opm-simulators
DILUKernels.hpp
1 /*
2  Copyright 2024 SINTEF AS
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 #ifndef OPM_DILU_KERNELS_HPP
20 #define OPM_DILU_KERNELS_HPP
21 
22 #include <cstddef>
23 #include <cuda.h>
24 #include <cuda_runtime.h>
25 #include <opm/simulators/linalg/gpuistl/detail/kernel_enums.hpp>
26 #include <vector>
27 
29 {
30 
47 template <class T, int blocksize>
48 void solveLowerLevelSet(T* reorderedMat,
49  int* rowIndices,
50  int* colIndices,
51  int* indexConversion,
52  int startIdx,
53  int rowsInLevelSet,
54  const T* dInv,
55  const T* d,
56  T* v,
57  int threadBlockSize,
58  cudaStream_t stream);
59 
73 template <class T, int blocksize>
74 void solveLowerLevelSetNoReorder(const T* mat,
75  const int* rowIndices,
76  const int* colIndices,
77  const size_t* indexConversion,
78  int startIdx,
79  int rowsInLevelSet,
80  const T* dInv,
81  const T* d,
82  T* v,
83  int threadBlockSize,
84  cudaStream_t stream);
85 
102 template <int blocksize, class LinearSolverScalar, class MatrixScalar, class DiagonalScalar>
103 void solveLowerLevelSetSplit(MatrixScalar* reorderedUpperMat,
104  int* rowIndices,
105  int* colIndices,
106  int* indexConversion,
107  int startIdx,
108  int rowsInLevelSet,
109  const DiagonalScalar* dInv,
110  const LinearSolverScalar* d,
111  LinearSolverScalar* v,
112  int threadBlockSize,
113  cudaStream_t stream);
114 
130 template <class T, int blocksize>
131 void solveUpperLevelSet(T* reorderedMat,
132  int* rowIndices,
133  int* colIndices,
134  int* indexConversion,
135  int startIdx,
136  int rowsInLevelSet,
137  const T* dInv,
138  T* v,
139  int threadBlockSize,
140  cudaStream_t stream);
141 
155 template <class T, int blocksize>
156 void solveUpperLevelSetNoReorder(const T* mat,
157  const int* rowIndices,
158  const int* colIndices,
159  const size_t* indexConversion,
160  int startIdx,
161  int rowsInLevelSet,
162  const T* dInv,
163  T* v,
164  int threadBlockSize,
165  cudaStream_t stream);
166 
182 template <int blocksize, class LinearSolverScalar, class MatrixScalar, class DiagonalScalar>
183 void solveUpperLevelSetSplit(MatrixScalar* reorderedUpperMat,
184  int* rowIndices,
185  int* colIndices,
186  int* indexConversion,
187  int startIdx,
188  int rowsInLevelSet,
189  const DiagonalScalar* dInv,
190  LinearSolverScalar* v,
191  int threadBlockSize,
192  cudaStream_t stream);
193 
210 template <class T, int blocksize>
211 void computeDiluDiagonal(T* reorderedMat,
212  int* rowIndices,
213  int* colIndices,
214  int* reorderedToNatural,
215  int* naturalToReordered,
216  size_t* diagIndices,
217  int startIdx,
218  int rowsInLevelSet,
219  T* dInv,
220  int threadBlockSize);
221 
234 template <class T, int blocksize>
235 void computeDiluDiagonalNoReorder(const T* mat,
236  const int* rowIndices,
237  const int* colIndices,
238  const size_t* indexConversion,
239  const size_t* diagIndices,
240  int startIdx,
241  int rowsInLevelSet,
242  T* dInv,
243  int threadBlockSize);
244 
266 template <int blocksize, class InputScalar, class OutputScalar, MatrixStorageMPScheme>
267 void computeDiluDiagonalSplit(const InputScalar* srcReorderedLowerMat,
268  int* lowerRowIndices,
269  int* lowerColIndices,
270  const InputScalar* srcReorderedUpperMat,
271  int* upperRowIndices,
272  int* upperColIndices,
273  const InputScalar* srcDiagonal,
274  int* reorderedToNatural,
275  int* naturalToReordered,
276  int startIdx,
277  int rowsInLevelSet,
278  InputScalar* dInv,
279  OutputScalar* dstDiagonal,
280  OutputScalar* dstLowerMat,
281  OutputScalar* dstUpperMat,
282  int threadBlockSize);
283 
284 } // namespace Opm::gpuistl::detail::DILU
285 #endif
Definition: DILUKernels.hpp:28