20#ifndef __ACC_LAPACK_HPP__
21#define __ACC_LAPACK_HPP__
26#if defined(SIRIUS_CUDA)
28#elif defined(SIRIUS_ROCM)
39inline int getrf(
int m,
int n, acc_complex_double_t* A,
int* devIpiv,
int lda)
41#if defined (SIRIUS_CUDA)
42 auto& handle = cusolver::cusolver_handle();
43 int* devInfo = acc::allocate<int>(1);
46 CALL_CUSOLVER(cusolverDnZgetrf_bufferSize, (handle, m, n, A, lda, &lwork));
47 auto workspace = acc::allocate<cuDoubleComplex>(lwork);
48 CALL_CUSOLVER(cusolverDnZgetrf, (handle, m, n,
reinterpret_cast<cuDoubleComplex *
>(A), lda, workspace, devIpiv, devInfo));
55#elif defined(SIRIUS_ROCM)
56 auto& handle = rocsolver::rocsolver_handle();
58 int* devInfo = acc::allocate<int>(1);
60 rocsolver::zgetrf(handle, m, n, A, devIpiv, lda, devInfo);
68inline int getrs(
char trans,
int n,
int nrhs,
const acc_complex_double_t* A,
int lda,
const int* devIpiv, acc_complex_double_t* B,
int ldb)
70#if defined(SIRIUS_CUDA)
71 auto& handle = cusolver::cusolver_handle();
72 int* devInfo = acc::allocate<int>(1);
74 cublasOperation_t op = blas::get_gpublasOperation_t(trans);
76 CALL_CUSOLVER(cusolverDnZgetrs, (handle, op, n, nrhs, A, lda, devIpiv, B, ldb, devInfo));
82 RTE_THROW(
"Error: cusolver LU solve (Zgetrs) failed. " + std::to_string(cpuInfo));
85#elif defined(SIRIUS_ROCM)
86 auto& handle = rocsolver::rocsolver_handle();
87 rocsolver::zgetrs(handle, trans, n, nrhs,
const_cast<acc_complex_double_t*
>(A), lda, devIpiv, B, ldb);
Blas functions for execution on GPUs.
Interface to CUDA eigen-solver library.
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.
void deallocate(void *ptr__)
Deallocate GPU memory.
void copyout(T *target__, T const *source__, size_t n__)
Copy memory from device to host.
Namespace of the SIRIUS library.
Contains implementation of rocsolver wrappers.
Eror and warning handling during run-time execution.