|
Reference documentation for deal.II version 9.2.0
|
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\)
\(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\)
\(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\)
\(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Go to the documentation of this file.
16 #ifndef dealii_cuda_sparse_matrix_h
17 #define dealii_cuda_sparse_matrix_h
25 #ifdef DEAL_II_COMPILER_CUDA_AWARE
31 # include <cusparse.h>
49 template <
typename Number>
88 const ::SparseMatrix<Number> &sparse_matrix_host);
125 const ::SparseMatrix<Number> &sparse_matrix_host);
164 template <
class StreamType>
166 print(StreamType &out,
167 const bool across =
false,
168 const bool diagonal_first =
true)
const;
192 const unsigned int precision = 3,
193 const bool scientific =
true,
194 const unsigned int width = 0,
195 const char * zero_string =
" ",
196 const double denominator = 1.)
const;
328 std::tuple<Number *, int *, int *, cusparseMatDescr_t>
356 std::unique_ptr<Number[], void (*)(Number *)>
val_dev;
376 template <
typename Number>
385 template <
typename Number>
394 template <
typename Number>
403 template <
typename Number>
404 template <
class StreamType>
408 const bool diagonal_first)
const
414 std::vector<int> rows(n_rows + 1);
415 std::vector<int> cols(nnz);
416 std::vector<double> val(nnz);
421 bool has_diagonal =
false;
429 for (
size_type j = rows[i]; j < rows[i + 1] && cols[j] <= i; ++j)
436 out <<
' ' << i <<
',' << i <<
':' <<
diagonal;
438 out <<
'(' << i <<
',' << i <<
") " <<
diagonal
444 for (
size_type j = rows[i]; j < rows[i + 1]; ++j)
446 if (has_diagonal && i == cols[j])
449 out <<
' ' << i <<
',' << cols[j] <<
':' << val[j];
451 out <<
"(" << i <<
"," << cols[j] <<
") " << val[j] << std::endl;
460 template <
typename Number>
463 const unsigned int precision,
464 const bool scientific,
465 const unsigned int width_,
466 const char * zero_string,
467 const double denominator)
const
473 std::vector<int> rows(n_rows + 1);
474 std::vector<int> cols(nnz);
475 std::vector<Number> val(nnz);
480 unsigned int width = width_;
482 std::ios::fmtflags old_flags = out.flags();
483 unsigned int old_precision = out.precision(precision);
487 out.setf(std::ios::scientific, std::ios::floatfield);
489 width = precision + 7;
493 out.setf(std::ios::fixed, std::ios::floatfield);
495 width = precision + 2;
505 out << std::setw(width) << val[j] * Number(denominator) <<
' ';
509 out << std::setw(width) << zero_string <<
' ';
516 out.precision(old_precision);
517 out.flags(old_flags);
std::unique_ptr< Number[], void(*)(Number *)> val_dev
@ diagonal
Matrix is diagonal.
Number residual(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &x, const LinearAlgebra::CUDAWrappers::Vector< Number > &b) const
static ::ExceptionBase & ExcIO()
std::unique_ptr< int[], void(*)(int *)> row_ptr_dev
void Tvmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
void print_formatted(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const unsigned int width=0, const char *zero_string=" ", const double denominator=1.) const
Number matrix_norm_square(const LinearAlgebra::CUDAWrappers::Vector< Number > &v) const
std::size_t n_nonzero_elements() const
void print(StreamType &out, const bool across=false, const bool diagonal_first=true) const
void vmult_add(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
std::tuple< Number *, int *, int *, cusparseMatDescr_t > get_cusparse_matrix() const
#define DEAL_II_NAMESPACE_OPEN
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
void vmult(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
static ::ExceptionBase & ExcNotInitialized()
void copy_to_host(const T *pointer_dev, std::vector< T > &vector_host)
SparseMatrix & operator*=(const Number factor)
Number matrix_scalar_product(const LinearAlgebra::CUDAWrappers::Vector< Number > &u, const LinearAlgebra::CUDAWrappers::Vector< Number > &v) const
cusparseHandle_t cusparse_handle
#define Assert(cond, exc)
Number frobenius_norm() const
SparseMatrix & operator/=(const Number factor)
#define DEAL_II_NAMESPACE_CLOSE
void reinit(Utilities::CUDA::Handle &handle, const ::SparseMatrix< Number > &sparse_matrix_host)
Number linfty_norm() const
#define AssertThrow(cond, exc)
SparseMatrix & operator=(CUDAWrappers::SparseMatrix< Number > &&)
void Tvmult_add(LinearAlgebra::CUDAWrappers::Vector< Number > &dst, const LinearAlgebra::CUDAWrappers::Vector< Number > &src) const
std::unique_ptr< int[], void(*)(int *)> column_index_dev