namespace CUDAWrappers
{
- namespace internal
+ namespace
{
void
cusparsecsr2dense(cusparseHandle_t cusparse_handle,
{
auto cusparse_matrix = matrix.get_cusparse_matrix();
- cusparseStatus_t cusparse_error_code =
+ const cusparseStatus_t cusparse_error_code =
cusparseScsr2dense(cusparse_handle,
matrix.m(),
matrix.n(),
{
auto cusparse_matrix = matrix.get_cusparse_matrix();
- cusparseStatus_t cusparse_error_code =
+ const cusparseStatus_t cusparse_error_code =
cusparseDcsr2dense(cusparse_handle,
matrix.m(),
matrix.n(),
float * dense_matrix_dev,
int & workspace_size)
{
- cusolverStatus_t cusolver_error_code = cusolverDnSgetrf_bufferSize(
+ const cusolverStatus_t cusolver_error_code = cusolverDnSgetrf_bufferSize(
cusolver_dn_handle, m, n, dense_matrix_dev, m, &workspace_size);
AssertCusolver(cusolver_error_code);
}
double * dense_matrix_dev,
int & workspace_size)
{
- cusolverStatus_t cusolver_error_code = cusolverDnDgetrf_bufferSize(
+ const cusolverStatus_t cusolver_error_code = cusolverDnDgetrf_bufferSize(
cusolver_dn_handle, m, n, dense_matrix_dev, m, &workspace_size);
AssertCusolver(cusolver_error_code);
}
int * pivot_dev,
int * info_dev)
{
- cusolverStatus_t cusolver_error_code =
+ const cusolverStatus_t cusolver_error_code =
cusolverDnSgetrf(cusolver_dn_handle,
m,
n,
int * pivot_dev,
int * info_dev)
{
- cusolverStatus_t cusolver_error_code =
+ const cusolverStatus_t cusolver_error_code =
cusolverDnDgetrf(cusolver_dn_handle,
m,
n,
float * b,
int * info_dev)
{
- const int n_rhs = 1;
- cusolverStatus_t cusolver_error_code =
+ const int n_rhs = 1;
+ const cusolverStatus_t cusolver_error_code =
cusolverDnSgetrs(cusolver_dn_handle,
CUBLAS_OP_N,
m,
double * b,
int * info_dev)
{
- const int n_rhs = 1;
- cusolverStatus_t cusolver_error_code =
+ const int n_rhs = 1;
+ const cusolverStatus_t cusolver_error_code =
cusolverDnDgetrs(cusolver_dn_handle,
CUBLAS_OP_N,
m,
const float * b_host,
float * x_host)
{
- int singularity = 0;
- cusolverStatus_t cusolver_error_code =
+ int singularity = 0;
+ const cusolverStatus_t cusolver_error_code =
cusolverSpScsrlsvluHost(cusolver_sp_handle,
n_rows,
nnz,
const double * b_host,
double * x_host)
{
- int singularity = 0;
- cusolverStatus_t cusolver_error_code =
+ int singularity = 0;
+ const cusolverStatus_t cusolver_error_code =
cusolverSpDcsrlsvluHost(cusolver_sp_handle,
n_rows,
nnz,
auto cusparse_matrix = matrix.get_cusparse_matrix();
int singularity = 0;
- cusolverStatus_t cusolver_error_code =
+ const cusolverStatus_t cusolver_error_code =
cusolverSpScsrlsvchol(cusolver_sp_handle,
matrix.m(),
matrix.n_nonzero_elements(),
auto cusparse_matrix = matrix.get_cusparse_matrix();
int singularity = 0;
- cusolverStatus_t cusolver_error_code =
+ const cusolverStatus_t cusolver_error_code =
cusolverSpDcsrlsvchol(cusolver_sp_handle,
matrix.m(),
matrix.n_nonzero_elements(),
Utilities::CUDA::malloc(dense_matrix_dev, m * n);
// Change the format of matrix to dense
- internal::cusparsecsr2dense(cusparse_handle, matrix, dense_matrix_dev);
+ cusparsecsr2dense(cusparse_handle, matrix, dense_matrix_dev);
// Create the working space
int workspace_size = 0;
- internal::cusolverDngetrf_buffer_size(
+ cusolverDngetrf_buffer_size(
cusolver_dn_handle, m, n, dense_matrix_dev, workspace_size);
Assert(workspace_size > 0, ExcMessage("No workspace was allocated"));
Number *workspace_dev;
int *info_dev;
Utilities::CUDA::malloc(info_dev, 1);
- internal::cusolverDngetrf(cusolver_dn_handle,
- m,
- n,
- dense_matrix_dev,
- workspace_dev,
- pivot_dev,
- info_dev);
+ cusolverDngetrf(cusolver_dn_handle,
+ m,
+ n,
+ dense_matrix_dev,
+ workspace_dev,
+ pivot_dev,
+ info_dev);
#ifdef DEBUG
int info = 0;
cudaError_t cuda_error_code =
cudaMemcpy(x_dev, b_dev, m * sizeof(Number), cudaMemcpyDeviceToDevice);
AssertCuda(cuda_error_code);
- internal::cusolverDngetrs(
+ cusolverDngetrs(
cusolver_dn_handle, m, dense_matrix_dev, pivot_dev, x_dev, info_dev);
#ifdef DEBUG
cuda_error_code =
std::vector<Number> x_host(n_rows);
Utilities::CUDA::copy_to_host(x_dev, x_host);
- internal::cusolverSpcsrlsvluHost(cusolver_sp_handle,
- n_rows,
- nnz,
- std::get<3>(cusparse_matrix),
- val_host.data(),
- row_ptr_host.data(),
- column_index_host.data(),
- b_host.data(),
- x_host.data());
+ cusolverSpcsrlsvluHost(cusolver_sp_handle,
+ n_rows,
+ nnz,
+ std::get<3>(cusparse_matrix),
+ val_host.data(),
+ row_ptr_host.data(),
+ column_index_host.data(),
+ b_host.data(),
+ x_host.data());
// Move the solution back to the device
Utilities::CUDA::copy_to_dev(x_host, x_dev);
}
- } // namespace internal
+ } // namespace
const LinearAlgebra::CUDAWrappers::Vector<Number> &b)
{
if (additional_data.solver_type == "Cholesky")
- internal::cholesky_factorization(cuda_handle.cusolver_sp_handle,
- A,
- b.get_values(),
- x.get_values());
+ cholesky_factorization(cuda_handle.cusolver_sp_handle,
+ A,
+ b.get_values(),
+ x.get_values());
else if (additional_data.solver_type == "LU_dense")
- internal::lu_factorization(cuda_handle.cusparse_handle,
- cuda_handle.cusolver_dn_handle,
- A,
- b.get_values(),
- x.get_values());
+ lu_factorization(cuda_handle.cusparse_handle,
+ cuda_handle.cusolver_dn_handle,
+ A,
+ b.get_values(),
+ x.get_values());
else if (additional_data.solver_type == "LU_host")
- internal::lu_factorization(cuda_handle.cusolver_sp_handle,
- A,
- b.get_values(),
- x.get_values());
+ lu_factorization(cuda_handle.cusolver_sp_handle,
+ A,
+ b.get_values(),
+ x.get_values());
else
AssertThrow(false,
ExcMessage("The provided solver name " +