My Project
Loading...
Searching...
No Matches
cusparse_wrapper.hpp
1/*
2 Copyright 2022-2023 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
26#include <cusparse.h>
27#include <type_traits>
28#ifndef OPM_CUSPARSE_WRAPPER_HPP
29#define OPM_CUSPARSE_WRAPPER_HPP
31{
32
34cusparseBsrilu02_analysis(cusparseHandle_t handle,
36 int mb,
37 int nnzb,
39 double* bsrSortedVal,
40 const int* bsrSortedRowPtr,
41 const int* bsrSortedColInd,
42 int blockDim,
43 bsrilu02Info_t info,
45 void* pBuffer)
46{
47 return cusparseDbsrilu02_analysis(handle,
48 dirA,
49 mb,
50 nnzb,
51 descrA,
56 info,
57 policy,
58 pBuffer);
59}
60
62cusparseBsrsv2_analysis(cusparseHandle_t handle,
65 int mb,
66 int nnzb,
68 const double* bsrSortedValA,
69 const int* bsrSortedRowPtrA,
70 const int* bsrSortedColIndA,
71 int blockDim,
72 bsrsv2Info_t info,
74 void* pBuffer)
75{
76 return cusparseDbsrsv2_analysis(handle,
77 dirA,
78 transA,
79 mb,
80 nnzb,
81 descrA,
86 info,
87 policy,
88 pBuffer);
89}
90
92cusparseBsrsv2_analysis(cusparseHandle_t handle,
95 int mb,
96 int nnzb,
98 const float* bsrSortedValA,
99 const int* bsrSortedRowPtrA,
100 const int* bsrSortedColIndA,
101 int blockDim,
102 bsrsv2Info_t info,
104 void* pBuffer)
105{
106 return cusparseSbsrsv2_analysis(handle,
107 dirA,
108 transA,
109 mb,
110 nnzb,
111 descrA,
115 blockDim,
116 info,
117 policy,
118 pBuffer);
119}
120
121inline cusparseStatus_t
122cusparseBsrilu02_analysis(cusparseHandle_t handle,
124 int mb,
125 int nnzb,
127 float* bsrSortedVal,
128 const int* bsrSortedRowPtr,
129 const int* bsrSortedColInd,
130 int blockDim,
131 bsrilu02Info_t info,
133 void* pBuffer)
134{
135 return cusparseSbsrilu02_analysis(handle,
136 dirA,
137 mb,
138 nnzb,
139 descrA,
143 blockDim,
144 info,
145 policy,
146 pBuffer);
147}
148
149inline cusparseStatus_t
150cusparseBsrsv2_solve(cusparseHandle_t handle,
153 int mb,
154 int nnzb,
155 const double* alpha,
157 const double* bsrSortedValA,
158 const int* bsrSortedRowPtrA,
159 const int* bsrSortedColIndA,
160 int blockDim,
161 bsrsv2Info_t info,
162 const double* f,
163 double* x,
165 void* pBuffer)
166{
167 return cusparseDbsrsv2_solve(handle,
168 dirA,
169 transA,
170 mb,
171 nnzb,
172 alpha,
173 descrA,
177 blockDim,
178 info,
179 f,
180 x,
181 policy,
182 pBuffer);
183}
184
185
186inline cusparseStatus_t
187cusparseBsrsv2_solve(cusparseHandle_t handle,
190 int mb,
191 int nnzb,
192 const float* alpha,
194 const float* bsrSortedValA,
195 const int* bsrSortedRowPtrA,
196 const int* bsrSortedColIndA,
197 int blockDim,
198 bsrsv2Info_t info,
199 const float* f,
200 float* x,
202 void* pBuffer)
203{
204 return cusparseSbsrsv2_solve(handle,
205 dirA,
206 transA,
207 mb,
208 nnzb,
209 alpha,
210 descrA,
214 blockDim,
215 info,
216 f,
217 x,
218 policy,
219 pBuffer);
220}
221
222
223inline cusparseStatus_t
224cusparseBsrilu02_bufferSize(cusparseHandle_t handle,
226 int mb,
227 int nnzb,
229 double* bsrSortedVal,
230 const int* bsrSortedRowPtr,
231 const int* bsrSortedColInd,
232 int blockDim,
233 bsrilu02Info_t info,
235{
236 return cusparseDbsrilu02_bufferSize(handle,
237 dirA,
238 mb,
239 nnzb,
240 descrA,
244 blockDim,
245 info,
247}
248
249
250inline cusparseStatus_t
251cusparseBsrilu02_bufferSize(cusparseHandle_t handle,
253 int mb,
254 int nnzb,
256 float* bsrSortedVal,
257 const int* bsrSortedRowPtr,
258 const int* bsrSortedColInd,
259 int blockDim,
260 bsrilu02Info_t info,
262{
263 return cusparseSbsrilu02_bufferSize(handle,
264 dirA,
265 mb,
266 nnzb,
267 descrA,
271 blockDim,
272 info,
274}
275
276inline cusparseStatus_t
277cusparseBsrsv2_bufferSize(cusparseHandle_t handle,
280 int mb,
281 int nnzb,
283 double* bsrSortedValA,
284 const int* bsrSortedRowPtrA,
285 const int* bsrSortedColIndA,
286 int blockDim,
287 bsrsv2Info_t info,
289{
290 return cusparseDbsrsv2_bufferSize(handle,
291 dirA,
292 transA,
293 mb,
294 nnzb,
295 descrA,
299 blockDim,
300 info,
302}
303inline cusparseStatus_t
304cusparseBsrsv2_bufferSize(cusparseHandle_t handle,
307 int mb,
308 int nnzb,
310 float* bsrSortedValA,
311 const int* bsrSortedRowPtrA,
312 const int* bsrSortedColIndA,
313 int blockDim,
314 bsrsv2Info_t info,
316{
317 return cusparseSbsrsv2_bufferSize(handle,
318 dirA,
319 transA,
320 mb,
321 nnzb,
322 descrA,
326 blockDim,
327 info,
329}
330
331inline cusparseStatus_t
332cusparseBsrilu02(cusparseHandle_t handle,
334 int mb,
335 int nnzb,
337 double* bsrSortedVal,
338 const int* bsrSortedRowPtr,
339 const int* bsrSortedColInd,
340 int blockDim,
341 bsrilu02Info_t info,
343 void* pBuffer)
344{
345 return cusparseDbsrilu02(handle,
346 dirA,
347 mb,
348 nnzb,
349 descrA,
353 blockDim,
354 info,
355 policy,
356 pBuffer);
357}
358inline cusparseStatus_t
359cusparseBsrilu02(cusparseHandle_t handle,
361 int mb,
362 int nnzb,
364 float* bsrSortedVal,
365 const int* bsrSortedRowPtr,
366 const int* bsrSortedColInd,
367 int blockDim,
368 bsrilu02Info_t info,
370 void* pBuffer)
371{
372 return cusparseSbsrilu02(handle,
373 dirA,
374 mb,
375 nnzb,
376 descrA,
380 blockDim,
381 info,
382 policy,
383 pBuffer);
384}
385
386inline cusparseStatus_t
387cusparseBsrmv(cusparseHandle_t handle,
390 int mb,
391 int nb,
392 int nnzb,
393 const double* alpha,
395 const double* bsrSortedValA,
396 const int* bsrSortedRowPtrA,
397 const int* bsrSortedColIndA,
398 int blockDim,
399 const double* x,
400 const double* beta,
401 double* y)
402{
403 return cusparseDbsrmv(handle,
404 dirA,
405 transA,
406 mb,
407 nb,
408 nnzb,
409 alpha,
410 descrA,
414 blockDim,
415 x,
416 beta,
417 y);
418}
419
420inline cusparseStatus_t
421cusparseBsrmv(cusparseHandle_t handle,
424 int mb,
425 int nb,
426 int nnzb,
427 const float* alpha,
429 const float* bsrSortedValA,
430 const int* bsrSortedRowPtrA,
431 const int* bsrSortedColIndA,
432 int blockDim,
433 const float* x,
434 const float* beta,
435 float* y)
436{
437 return cusparseSbsrmv(handle,
438 dirA,
439 transA,
440 mb,
441 nb,
442 nnzb,
443 alpha,
444 descrA,
448 blockDim,
449 x,
450 beta,
451 y);
452}
453} // namespace Opm::gpuistl::detail
454#endif
Contains wrappers to make the CuBLAS library behave as a modern C++ library with function overlading.
Definition autotuner.hpp:29
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242