28 template <
typename Number>
30 cusparseXcsrilu02(cusparseHandle_t ,
33 const cusparseMatDescr_t ,
38 cusparseSolvePolicy_t ,
42 return CUSPARSE_STATUS_INVALID_VALUE;
47 cusparseXcsrilu02<float>(cusparseHandle_t handle,
50 const cusparseMatDescr_t descrA,
52 const int *csrRowPtrA,
53 const int *csrColIndA,
55 cusparseSolvePolicy_t policy,
58 return cusparseScsrilu02(handle,
72 cusparseXcsrilu02<double>(cusparseHandle_t handle,
75 const cusparseMatDescr_t descrA,
77 const int *csrRowPtrA,
78 const int *csrColIndA,
80 cusparseSolvePolicy_t policy,
83 return cusparseDcsrilu02(handle,
155 template <
typename Number>
157 cusparseXcsrilu02_analysis(cusparseHandle_t ,
160 const cusparseMatDescr_t ,
165 cusparseSolvePolicy_t ,
169 return CUSPARSE_STATUS_INVALID_VALUE;
174 cusparseXcsrilu02_analysis<float>(cusparseHandle_t handle,
177 const cusparseMatDescr_t descrA,
178 const float *csrValA,
179 const int *csrRowPtrA,
180 const int *csrColIndA,
182 cusparseSolvePolicy_t policy,
185 return cusparseScsrilu02_analysis(handle,
199 cusparseXcsrilu02_analysis<double>(cusparseHandle_t handle,
202 const cusparseMatDescr_t descrA,
203 const double *csrValA,
204 const int *csrRowPtrA,
205 const int *csrColIndA,
207 cusparseSolvePolicy_t policy,
210 return cusparseDcsrilu02_analysis(handle,
282 template <
typename Number>
284 cusparseXcsrilu02_bufferSize(cusparseHandle_t ,
287 const cusparseMatDescr_t ,
295 return CUSPARSE_STATUS_INVALID_VALUE;
300 cusparseXcsrilu02_bufferSize<float>(cusparseHandle_t handle,
303 const cusparseMatDescr_t descrA,
305 const int *csrRowPtrA,
306 const int *csrColIndA,
308 int *pBufferSizeInBytes)
310 return cusparseScsrilu02_bufferSize(handle,
323 cusparseXcsrilu02_bufferSize<double>(cusparseHandle_t handle,
326 const cusparseMatDescr_t descrA,
328 const int *csrRowPtrA,
329 const int *csrColIndA,
331 int *pBufferSizeInBytes)
333 return cusparseDcsrilu02_bufferSize(handle,
398 template <
typename Number>
400 cusparseXcsric02(cusparseHandle_t ,
403 const cusparseMatDescr_t ,
408 cusparseSolvePolicy_t ,
412 return CUSPARSE_STATUS_INVALID_VALUE;
417 cusparseXcsric02<float>(cusparseHandle_t handle,
420 const cusparseMatDescr_t descrA,
422 const int *csrRowPtrA,
423 const int *csrColIndA,
425 cusparseSolvePolicy_t policy,
428 return cusparseScsric02(handle,
442 cusparseXcsric02<double>(cusparseHandle_t handle,
445 const cusparseMatDescr_t descrA,
446 double *csrValA_valM,
447 const int *csrRowPtrA,
448 const int *csrColIndA,
450 cusparseSolvePolicy_t policy,
453 return cusparseDcsric02(handle,
525 template <
typename Number>
527 cusparseXcsrsv2_solve(cusparseHandle_t ,
528 cusparseOperation_t ,
532 const cusparseMatDescr_t ,
539 cusparseSolvePolicy_t ,
543 return CUSPARSE_STATUS_INVALID_VALUE;
548 cusparseXcsrsv2_solve<float>(cusparseHandle_t handle,
549 cusparseOperation_t transA,
553 const cusparseMatDescr_t descra,
554 const float *csrValA,
555 const int *csrRowPtrA,
556 const int *csrColIndA,
560 cusparseSolvePolicy_t policy,
563 return cusparseScsrsv2_solve(handle,
581 cusparseXcsrsv2_solve<double>(cusparseHandle_t handle,
582 cusparseOperation_t transA,
586 const cusparseMatDescr_t descra,
587 const double *csrValA,
588 const int *csrRowPtrA,
589 const int *csrColIndA,
593 cusparseSolvePolicy_t policy,
596 return cusparseDcsrsv2_solve(handle,
688 template <
typename Number>
690 cusparseXcsrsv2_analysis(cusparseHandle_t ,
691 cusparseOperation_t ,
694 const cusparseMatDescr_t ,
699 cusparseSolvePolicy_t ,
703 return CUSPARSE_STATUS_INVALID_VALUE;
708 cusparseXcsrsv2_analysis<float>(cusparseHandle_t handle,
709 cusparseOperation_t transA,
712 const cusparseMatDescr_t descrA,
713 const float *csrValA,
714 const int *csrRowPtrA,
715 const int *csrColIndA,
717 cusparseSolvePolicy_t policy,
720 return cusparseScsrsv2_analysis(handle,
735 cusparseXcsrsv2_analysis<double>(cusparseHandle_t handle,
736 cusparseOperation_t transA,
739 const cusparseMatDescr_t descrA,
740 const double *csrValA,
741 const int *csrRowPtrA,
742 const int *csrColIndA,
744 cusparseSolvePolicy_t policy,
747 return cusparseDcsrsv2_analysis(handle,
823 template <
typename Number>
825 cusparseXcsric02_analysis(cusparseHandle_t ,
828 const cusparseMatDescr_t ,
833 cusparseSolvePolicy_t ,
837 return CUSPARSE_STATUS_INVALID_VALUE;
842 cusparseXcsric02_analysis<float>(cusparseHandle_t handle,
845 const cusparseMatDescr_t descrA,
846 const float *csrValA,
847 const int *csrRowPtrA,
848 const int *csrColIndA,
850 cusparseSolvePolicy_t policy,
853 return cusparseScsric02_analysis(handle,
867 cusparseXcsric02_analysis<double>(cusparseHandle_t handle,
870 const cusparseMatDescr_t descrA,
871 const double *csrValA,
872 const int *csrRowPtrA,
873 const int *csrColIndA,
875 cusparseSolvePolicy_t policy,
878 return cusparseDcsric02_analysis(handle,
950 template <
typename Number>
952 cusparseXcsrsv2_bufferSize(cusparseHandle_t ,
953 cusparseOperation_t ,
956 const cusparseMatDescr_t ,
964 return CUSPARSE_STATUS_INVALID_VALUE;
969 cusparseXcsrsv2_bufferSize<float>(cusparseHandle_t handle,
970 cusparseOperation_t transA,
973 const cusparseMatDescr_t descrA,
975 const int *csrRowPtrA,
976 const int *csrColIndA,
978 int *pBufferSizeInBytes)
980 return cusparseScsrsv2_bufferSize(handle,
994 cusparseXcsrsv2_bufferSize<double>(cusparseHandle_t handle,
995 cusparseOperation_t transA,
998 const cusparseMatDescr_t descrA,
1000 const int *csrRowPtrA,
1001 const int *csrColIndA,
1003 int *pBufferSizeInBytes)
1005 return cusparseDcsrsv2_bufferSize(handle,
1014 pBufferSizeInBytes);
1077 template <
typename Number>
1079 cusparseXcsric02_bufferSize(cusparseHandle_t ,
1082 const cusparseMatDescr_t ,
1090 return CUSPARSE_STATUS_INVALID_VALUE;
1095 cusparseXcsric02_bufferSize<float>(cusparseHandle_t handle,
1098 const cusparseMatDescr_t descrA,
1100 const int *csrRowPtrA,
1101 const int *csrColIndA,
1103 int *pBufferSizeInBytes)
1105 return cusparseScsric02_bufferSize(handle,
1113 pBufferSizeInBytes);
1118 cusparseXcsric02_bufferSize<double>(cusparseHandle_t handle,
1121 const cusparseMatDescr_t descrA,
1123 const int *csrRowPtrA,
1124 const int *csrColIndA,
1126 int *pBufferSizeInBytes)
1128 return cusparseDcsric02_bufferSize(handle,
1136 pBufferSizeInBytes);
1190 template <
typename Number>
1192 bool use_level_analysis_)
1193 : use_level_analysis(use_level_analysis_)
1198 template <
typename Number>
1206 ,
policy_L(CUSPARSE_SOLVE_POLICY_USE_LEVEL)
1207 ,
policy_Lt(CUSPARSE_SOLVE_POLICY_USE_LEVEL)
1208 ,
policy_M(CUSPARSE_SOLVE_POLICY_USE_LEVEL)
1217 cusparseStatus_t status = cusparseCreateMatDescr(&
descr_M);
1219 status = cusparseSetMatIndexBase(
descr_M, CUSPARSE_INDEX_BASE_ZERO);
1221 status = cusparseSetMatType(
descr_M, CUSPARSE_MATRIX_TYPE_GENERAL);
1224 status = cusparseCreateMatDescr(&
descr_L);
1226 status = cusparseSetMatIndexBase(
descr_L, CUSPARSE_INDEX_BASE_ZERO);
1228 status = cusparseSetMatType(
descr_L, CUSPARSE_MATRIX_TYPE_GENERAL);
1230 status = cusparseSetMatFillMode(
descr_L, CUSPARSE_FILL_MODE_LOWER);
1232 status = cusparseSetMatDiagType(
descr_L, CUSPARSE_DIAG_TYPE_NON_UNIT);
1237 status = cusparseCreateCsric02Info(&
info_M);
1239 status = cusparseCreateCsrsv2Info(&
info_L);
1241 status = cusparseCreateCsrsv2Info(&
info_Lt);
1247 template <
typename Number>
1251 cusparseStatus_t status = cusparseDestroyMatDescr(descr_M);
1254 status = cusparseDestroyMatDescr(descr_L);
1257 status = cusparseDestroyCsric02Info(info_M);
1260 status = cusparseDestroyCsrsv2Info(info_L);
1263 status = cusparseDestroyCsrsv2Info(info_Lt);
1269 template <
typename Number>
1276 policy_L = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
1277 policy_Lt = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
1278 policy_M = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
1282 policy_L = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
1283 policy_Lt = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
1284 policy_M = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
1291 matrix_pointer = &A;
1292 const Number *A_val_dev;
1302 cudaError_t cuda_status = cudaMemcpy(P_val_dev.get(),
1304 n_nonzero_elements *
sizeof(Number),
1305 cudaMemcpyDeviceToDevice);
1314 cusparseStatus_t status = cusparseXcsric02_bufferSize(cusparse_handle,
1326 status = cusparseXcsrsv2_bufferSize(cusparse_handle,
1327 CUSPARSE_OPERATION_NON_TRANSPOSE,
1339 status = cusparseXcsrsv2_bufferSize(cusparse_handle,
1340 CUSPARSE_OPERATION_TRANSPOSE,
1351 const int BufferSize =
1355 buffer_dev.reset(
static_cast<void *
>(
1364 status = cusparseXcsric02_analysis(cusparse_handle,
1376 int structural_zero;
1378 cusparseXcsric02_zeroPivot(cusparse_handle, info_M, &structural_zero);
1381 status = cusparseXcsrsv2_analysis(cusparse_handle,
1382 CUSPARSE_OPERATION_TRANSPOSE,
1394 status = cusparseXcsrsv2_analysis(cusparse_handle,
1395 CUSPARSE_OPERATION_NON_TRANSPOSE,
1408 status = cusparseXcsric02(cusparse_handle,
1422 cusparseXcsric02_zeroPivot(cusparse_handle, info_M, &numerical_zero);
1428 template <
typename Number>
1441 const Number *
const src_dev = src.
get_values();
1445 cusparseStatus_t status =
1446 cusparseXcsrsv2_solve(cusparse_handle,
1447 CUSPARSE_OPERATION_NON_TRANSPOSE,
1463 status = cusparseXcsrsv2_solve(cusparse_handle,
1464 CUSPARSE_OPERATION_TRANSPOSE,
1482 template <
typename Number>
1494 template <
typename Number>
1496 bool use_level_analysis_)
1497 : use_level_analysis(use_level_analysis_)
1502 template <
typename Number>
1511 ,
policy_L(CUSPARSE_SOLVE_POLICY_USE_LEVEL)
1512 ,
policy_U(CUSPARSE_SOLVE_POLICY_USE_LEVEL)
1513 ,
policy_M(CUSPARSE_SOLVE_POLICY_USE_LEVEL)
1525 cusparseStatus_t status = cusparseCreateMatDescr(&
descr_M);
1527 status = cusparseSetMatIndexBase(
descr_M, CUSPARSE_INDEX_BASE_ZERO);
1529 status = cusparseSetMatType(
descr_M, CUSPARSE_MATRIX_TYPE_GENERAL);
1532 status = cusparseCreateMatDescr(&
descr_L);
1534 status = cusparseSetMatIndexBase(
descr_L, CUSPARSE_INDEX_BASE_ZERO);
1536 status = cusparseSetMatType(
descr_L, CUSPARSE_MATRIX_TYPE_GENERAL);
1538 status = cusparseSetMatFillMode(
descr_L, CUSPARSE_FILL_MODE_LOWER);
1540 status = cusparseSetMatDiagType(
descr_L, CUSPARSE_DIAG_TYPE_UNIT);
1543 status = cusparseCreateMatDescr(&
descr_U);
1545 status = cusparseSetMatIndexBase(
descr_U, CUSPARSE_INDEX_BASE_ZERO);
1547 status = cusparseSetMatType(
descr_U, CUSPARSE_MATRIX_TYPE_GENERAL);
1549 status = cusparseSetMatFillMode(
descr_U, CUSPARSE_FILL_MODE_UPPER);
1551 status = cusparseSetMatDiagType(
descr_U, CUSPARSE_DIAG_TYPE_NON_UNIT);
1556 status = cusparseCreateCsrilu02Info(&
info_M);
1558 status = cusparseCreateCsrsv2Info(&
info_L);
1560 status = cusparseCreateCsrsv2Info(&
info_U);
1566 template <
typename Number>
1570 cusparseStatus_t status = cusparseDestroyMatDescr(descr_M);
1573 status = cusparseDestroyMatDescr(descr_L);
1576 status = cusparseDestroyMatDescr(descr_U);
1579 status = cusparseDestroyCsrilu02Info(info_M);
1582 status = cusparseDestroyCsrsv2Info(info_L);
1585 status = cusparseDestroyCsrsv2Info(info_U);
1591 template <
typename Number>
1598 policy_L = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
1599 policy_U = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
1600 policy_M = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
1604 policy_L = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
1605 policy_U = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
1606 policy_M = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
1609 matrix_pointer = &A;
1614 const Number *A_val_dev;
1624 cudaError_t cuda_status = cudaMemcpy(P_val_dev.get(),
1626 n_nonzero_elements *
sizeof(Number),
1627 cudaMemcpyDeviceToDevice);
1636 cusparseStatus_t status = cusparseXcsrilu02_bufferSize(cusparse_handle,
1648 status = cusparseXcsrsv2_bufferSize(cusparse_handle,
1649 CUSPARSE_OPERATION_NON_TRANSPOSE,
1661 status = cusparseXcsrsv2_bufferSize(cusparse_handle,
1662 CUSPARSE_OPERATION_NON_TRANSPOSE,
1673 const int BufferSize =
1677 buffer_dev.reset(
static_cast<void *
>(
1686 status = cusparseXcsrilu02_analysis(cusparse_handle,
1698 int structural_zero;
1700 cusparseXcsrilu02_zeroPivot(cusparse_handle, info_M, &structural_zero);
1703 status = cusparseXcsrsv2_analysis(cusparse_handle,
1704 CUSPARSE_OPERATION_NON_TRANSPOSE,
1716 status = cusparseXcsrsv2_analysis(cusparse_handle,
1717 CUSPARSE_OPERATION_NON_TRANSPOSE,
1729 status = cusparseXcsrilu02(cusparse_handle,
1743 cusparseXcsrilu02_zeroPivot(cusparse_handle, info_M, &numerical_zero);
1749 template <
typename Number>
1762 const Number *
const src_dev = src.
get_values();
1767 cusparseStatus_t status =
1768 cusparseXcsrsv2_solve(cusparse_handle,
1769 CUSPARSE_OPERATION_NON_TRANSPOSE,
1785 status = cusparseXcsrsv2_solve(cusparse_handle,
1786 CUSPARSE_OPERATION_NON_TRANSPOSE,
1804 template <
typename Number>
cusparseSolvePolicy_t policy_M
std::unique_ptr< Number[], void(*)(Number *)> P_val_dev
void Tvmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
std::unique_ptr< Number[], void(*)(Number *)> tmp_dev
const int * P_row_ptr_dev
void initialize(const SparseMatrix< Number > &matrix, const AdditionalData &additional_data=AdditionalData())
cusparseSolvePolicy_t policy_Lt
const int * P_column_index_dev
cusparseSolvePolicy_t policy_L
void vmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
PreconditionIC(const Utilities::CUDA::Handle &handle)
std::unique_ptr< void, void(*)(void *)> buffer_dev
cusparseHandle_t cusparse_handle
cusparseMatDescr_t descr_L
cusparseMatDescr_t descr_M
cusparseMatDescr_t descr_U
const int * P_row_ptr_dev
cusparseSolvePolicy_t policy_M
void vmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
std::unique_ptr< void, void(*)(void *)> buffer_dev
void initialize(const SparseMatrix< Number > &matrix, const AdditionalData &additional_data=AdditionalData())
cusparseMatDescr_t descr_M
cusparseHandle_t cusparse_handle
cusparseSolvePolicy_t policy_U
PreconditionILU(const Utilities::CUDA::Handle &handle)
std::unique_ptr< Number[], void(*)(Number *)> P_val_dev
std::unique_ptr< Number[], void(*)(Number *)> tmp_dev
const int * P_column_index_dev
void Tvmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
cusparseMatDescr_t descr_L
cusparseSolvePolicy_t policy_L
std::tuple< Number *, int *, int *, cusparseMatDescr_t, cusparseSpMatDescr_t > get_cusparse_matrix() const
std::size_t n_nonzero_elements() const
Number * get_values() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define AssertCusparse(error_code)
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertNothrowCusparse(error_code)
static ::ExceptionBase & ExcInternalError()
#define AssertCuda(error_code)
static ::ExceptionBase & ExcNotInitialized()
#define AssertThrow(cond, exc)
#define DEAL_II_NOT_IMPLEMENTED()
Number * allocate_device_data(const std::size_t size)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
AdditionalData(bool use_level_analysis=true)
AdditionalData(bool use_level_analysis=true)
static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE const T & value(const T &t)