Misc.hpp
Go to the documentation of this file.
1#ifndef OPM_MISC_HPP
2#define OPM_MISC_HPP
3
4#ifdef HAVE_ROCSPARSE
5#include <hip/hip_runtime_api.h>
6#include <hip/hip_version.h>
7#include <sstream>
8
9#define HIP_CHECK(STAT) \
10 do { \
11 const hipError_t stat = (STAT); \
12 if(stat != hipSuccess) \
13 { \
14 std::ostringstream oss; \
15 oss << "rocsparseSolverBackend::hip "; \
16 oss << "error: " << hipGetErrorString(stat); \
17 OPM_THROW(std::logic_error, oss.str()); \
18 } \
19 } while(0)
20
21#define ROCSPARSE_CHECK(STAT) \
22 do { \
23 const rocsparse_status stat = (STAT); \
24 if(stat != rocsparse_status_success) \
25 { \
26 std::ostringstream oss; \
27 oss << "rocsparseSolverBackend::rocsparse "; \
28 oss << "error: " << stat; \
29 OPM_THROW(std::logic_error, oss.str()); \
30 } \
31 } while(0)
32
33#define ROCBLAS_CHECK(STAT) \
34 do { \
35 const rocblas_status stat = (STAT); \
36 if(stat != rocblas_status_success) \
37 { \
38 std::ostringstream oss; \
39 oss << "rocsparseSolverBackend::rocblas "; \
40 oss << "error: " << stat; \
41 OPM_THROW(std::logic_error, oss.str()); \
42 } \
43 } while(0)
44#endif
45
46namespace Opm::Accelerator {
47
48unsigned int ceilDivision(const unsigned int A,
49 const unsigned int B);
50
51template<class Scalar>
52Scalar get_absmax(const Scalar *data,
53 const int N);
54
55template<class Scalar>
56void solve_transposed_3x3(const Scalar *A,
57 const Scalar *b,
58 Scalar *x);
59
60}
61
62#endif
Definition: amgclSolverBackend.hpp:44
void solve_transposed_3x3(const Scalar *A, const Scalar *b, Scalar *x)
unsigned int ceilDivision(const unsigned int A, const unsigned int B)
Scalar get_absmax(const Scalar *data, const int N)