25#ifndef __ROCSOLVER_HPP__
26#define __ROCSOLVER_HPP__
28#include <rocsolver/rocsolver.h>
29#include <rocblas/rocblas.h>
42#define CALL_ROCSOLVER(func__, args__) \
44 rocblas_status status = func__ args__; \
45 if (status != rocblas_status::rocblas_status_success) { \
47 gethostname(nm, 1024); \
48 printf("hostname: %s\n", nm); \
49 printf("Error in %s at line %i of file %s: %s\n", #func__, __LINE__, __FILE__, \
50 rocblas_status_to_string(status)); \
51 acc::stack_backtrace(); \
55acc::blas_api::handle_t& rocsolver_handle();
57inline rocblas_operation
58get_rocblas_operation(
char trans)
60 rocblas_operation op{rocblas_operation::rocblas_operation_none};
64 op = rocblas_operation::rocblas_operation_none;
68 op = rocblas_operation::rocblas_operation_transpose;
72 op = rocblas_operation::rocblas_operation_conjugate_transpose;
75 RTE_THROW(
"invalid tranpose op.")
83std::enable_if_t<std::is_same<T, double>::value>
84syheevd(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, T* A,
int lda, T* D, T* E,
87 CALL_ROCSOLVER(rocsolver_dsyevd, (handle, evect, uplo, n, A, lda, D, E, info));
92std::enable_if_t<std::is_same<T, float>::value>
93syheevd(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, T* A,
int lda, T* D, T* E,
96 CALL_ROCSOLVER(rocsolver_ssyevd, (handle, evect, uplo, n, A, lda, D, E, info));
101std::enable_if_t<std::is_same<T, double>::value>
102syheevd(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, std::complex<T>* A,
int lda,
103 T* D, T* E,
int* info)
105 CALL_ROCSOLVER(rocsolver_zheevd,
106 (handle, evect, uplo, n,
reinterpret_cast<rocblas_double_complex*
>(A), lda, D, E, info));
111std::enable_if_t<std::is_same<T, float>::value>
112syheevd(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, std::complex<T>* A,
int lda,
113 T* D, T* E,
int* info)
115 CALL_ROCSOLVER(rocsolver_cheevd,
116 (handle, evect, uplo, n,
reinterpret_cast<rocblas_float_complex*
>(A), lda, D, E, info));
121std::enable_if_t<std::is_same<T, double>::value>
122syhegvd(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
123 T* A,
int lda, T* B,
int ldb, T* D, T* E,
int* info)
125 CALL_ROCSOLVER(rocsolver_dsygvd, (handle, itype, evect, uplo, n, A, lda, B, ldb, D, E, info));
130std::enable_if_t<std::is_same<T, float>::value>
131syhegvd(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
132 T* A,
int lda, T* B,
int ldb, T* D, T* E,
int* info)
134 CALL_ROCSOLVER(rocsolver_ssygvd, (handle, itype, evect, uplo, n, A, lda, B, ldb, D, E, info));
139std::enable_if_t<std::is_same<T, float>::value>
140syhegvd(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
141 std::complex<T>* A,
int lda, std::complex<T>* B,
int ldb, T* D, T* E,
int* info)
143 CALL_ROCSOLVER(rocsolver_chegvd, (handle, itype, evect, uplo, n,
reinterpret_cast<rocblas_float_complex*
>(A), lda,
144 reinterpret_cast<rocblas_float_complex*
>(B), ldb, D, E, info));
149std::enable_if_t<std::is_same<T, double>::value>
150syhegvd(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
151 std::complex<T>* A,
int lda, std::complex<T>* B,
int ldb, T* D, T* E,
int* info)
153 CALL_ROCSOLVER(rocsolver_zhegvd, (handle, itype, evect, uplo, n,
reinterpret_cast<rocblas_double_complex*
>(A), lda,
154 reinterpret_cast<rocblas_double_complex*
>(B), ldb, D, E, info));
157#if (ROCSOLVER_VERSION_MAJOR > 3) || ((ROCSOLVER_VERSION_MAJOR == 3) && (ROCSOLVER_VERSION_MINOR >= 19))
161std::enable_if_t<std::is_same<T, double>::value>
162syheevx(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, T* A,
int lda,
int il,
int iu,
163 double abstol,
int* nev, T* D, T* Z,
int ldz,
int* ifail,
int* info)
166 rocsolver_dsyevx(handle, evect, rocblas_erange::rocblas_erange_index, uplo, n, A, lda, vl, vu, il, iu, abstol, nev,
167 D, Z, ldz, ifail, info);
171std::enable_if_t<std::is_same<T, float>::value>
172syheevx(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, T* A,
int lda,
int il,
int iu,
173 double abstol,
int* nev, T* D, T* Z,
int ldz,
int* ifail,
int* info)
176 rocsolver_ssyevx(handle, evect, rocblas_erange::rocblas_erange_index, uplo, n, A, lda, vl, vu, il, iu, abstol, nev,
177 D, Z, ldz, ifail, info);
182std::enable_if_t<std::is_same<T, double>::value>
183syheevx(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, std::complex<double>* A,
184 int lda,
int il,
int iu,
double abstol,
int* nev, T* D, std::complex<double>* Z,
int ldz,
int* ifail,
int* info)
187 rocsolver_zheevx(handle, evect, rocblas_erange::rocblas_erange_index, uplo, n,
188 reinterpret_cast<rocblas_double_complex*
>(A), lda, vl, vu, il, iu, abstol, nev, D,
189 reinterpret_cast<rocblas_double_complex*
>(Z), ldz, ifail, info);
193std::enable_if_t<std::is_same<T, float>::value>
194syheevx(rocblas_handle handle,
const rocblas_evect evect,
const rocblas_fill uplo,
int n, std::complex<float>* A,
195 int lda,
int il,
int iu,
double abstol,
int* nev, T* D, std::complex<float>* Z,
int ldz,
int* ifail,
int* info)
198 rocsolver_cheevx(handle, evect, rocblas_erange::rocblas_erange_index, uplo, n,
199 reinterpret_cast<rocblas_float_complex*
>(A), lda, vl, vu, il, iu, abstol, nev, D,
200 reinterpret_cast<rocblas_float_complex*
>(Z), ldz, ifail, info);
206std::enable_if_t<std::is_same<T, double>::value>
207syhegvx(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
208 T* A,
int lda, T* B,
int ldb,
int il,
int iu,
double abstol,
int* nev, T* D, T* Z,
int ldz,
int* ifail,
212 rocsolver_dsygvx(handle, itype, evect, rocblas_erange::rocblas_erange_index, uplo, n, A, lda, B, ldb, vl, vu, il,
213 iu, abstol, nev, D, Z, ldz, ifail, info);
217std::enable_if_t<std::is_same<T, float>::value>
218syhegvx(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
219 T* A,
int lda, T* B,
int ldb,
int il,
int iu,
double abstol,
int* nev, T* D, T* Z,
int ldz,
int* ifail,
223 rocsolver_ssygvx(handle, itype, evect, rocblas_erange::rocblas_erange_index, uplo, n, A, lda, B, ldb, vl, vu, il,
224 iu, abstol, nev, D, Z, ldz, ifail, info);
229std::enable_if_t<std::is_same<T, double>::value>
230syhegvx(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
231 std::complex<double>* A,
int lda, std::complex<double>* B,
int ldb,
int il,
int iu,
double abstol,
int* nev,
232 T* D, std::complex<double>* Z,
int ldz,
int* ifail,
int* info)
235 rocsolver_zhegvx(handle, itype, evect, rocblas_erange::rocblas_erange_index, uplo, n,
236 reinterpret_cast<rocblas_double_complex*
>(A), lda,
reinterpret_cast<rocblas_double_complex*
>(B),
237 ldb, vl, vu, il, iu, abstol, nev, D,
reinterpret_cast<rocblas_double_complex*
>(Z), ldz, ifail,
242std::enable_if_t<std::is_same<T, float>::value>
243syhegvx(rocblas_handle handle,
const rocblas_eform itype,
const rocblas_evect evect,
const rocblas_fill uplo,
int n,
244 std::complex<float>* A,
int lda, std::complex<float>* B,
int ldb,
int il,
int iu,
double abstol,
int* nev, T* D,
245 std::complex<float>* Z,
int ldz,
int* ifail,
int* info)
248 rocsolver_chegvx(handle, itype, evect, rocblas_erange::rocblas_erange_index, uplo, n,
249 reinterpret_cast<rocblas_float_complex*
>(A), lda,
reinterpret_cast<rocblas_float_complex*
>(B), ldb,
250 vl, vu, il, iu, abstol, nev, D,
reinterpret_cast<rocblas_float_complex*
>(Z), ldz, ifail, info);
256zgetrs(rocblas_handle handle,
char trans,
int n,
int nrhs, acc_complex_double_t* A,
int lda,
const int* devIpiv,
257 acc_complex_double_t* B,
int ldb);
260zgetrf(rocblas_handle handle,
int m,
int n, acc_complex_double_t* A,
int* devIpiv,
int lda,
int* devInfo);
Interface to accelerators API.
Interface to cuBLAS / rocblas related functions.
void zgetrs(rocblas_handle handle, char trans, int n, int nrhs, acc_complex_double_t *A, int lda, const int *devIpiv, acc_complex_double_t *B, int ldb)
Linear Solvers.
std::enable_if_t< std::is_same< T, double >::value > syhegvd(rocblas_handle handle, const rocblas_eform itype, const rocblas_evect evect, const rocblas_fill uplo, int n, T *A, int lda, T *B, int ldb, T *D, T *E, int *info)
_sy_mmetric or _he_rmitian GENERALIZED eigenvalue problem | double
std::enable_if_t< std::is_same< T, double >::value > syheevd(rocblas_handle handle, const rocblas_evect evect, const rocblas_fill uplo, int n, T *A, int lda, T *D, T *E, int *info)
_sy_mmetric or _he_rmitian STANDARD eigenvalue problem | double
Namespace of the SIRIUS library.
Eror and warning handling during run-time execution.