votca 2024-dev
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
votca::xtp::CudaMatrix Class Reference

#include <cudamatrix.h>

Collaboration diagram for votca::xtp::CudaMatrix:
Collaboration graph
[legend]

Public Member Functions

Index size () const
 
Index rows () const
 
Index ld () const
 
Index cols () const
 
double * data () const
 
void reshape (Index rows, Index cols)
 
CudaMatrixTranspose< CudaMatrixtranspose () const
 
CudaMatrixBlock< CudaMatrixblock (Index rowoffset, Index coloffset, Index rows, Index cols) const
 
CudaMatrixBlock< CudaMatrixrow (Index row) const
 
CudaMatrixBlock< CudaMatrixcol (Index col) const
 
CudaMatrixBlock< CudaMatrixmiddleRows (Index rowoffset, Index rows) const
 
CudaMatrixBlock< CudaMatrixmiddleCols (Index coloffset, Index cols) const
 
template<class T >
void copy_to_gpu (const T &m)
 
template<class T >
 CudaMatrix (const T &matrix, const cudaStream_t &stream)
 
 CudaMatrix (Index nrows, Index ncols, const cudaStream_t &stream)
 
void setZero ()
 
 operator Eigen::MatrixXd () const
 

Static Public Member Functions

static constexpr bool transposed ()
 

Private Types

using Unique_ptr_to_GPU_data = std::unique_ptr< double, void(*)(double *)>
 

Private Member Functions

Unique_ptr_to_GPU_data alloc_matrix_in_gpu (size_t size_arr) const
 
void throw_if_not_enough_memory_in_gpu (size_t requested_memory) const
 
size_t size_matrix () const
 

Private Attributes

Unique_ptr_to_GPU_data data_
 
cudaStream_t stream_ = nullptr
 
Index ld_
 
Index cols_
 

Friends

std::ostream & operator<< (std::ostream &out, const CudaMatrix &m)
 

Detailed Description

Definition at line 104 of file cudamatrix.h.

Member Typedef Documentation

◆ Unique_ptr_to_GPU_data

using votca::xtp::CudaMatrix::Unique_ptr_to_GPU_data = std::unique_ptr<double, void (*)(double *)>
private

Definition at line 179 of file cudamatrix.h.

Constructor & Destructor Documentation

◆ CudaMatrix() [1/2]

template<class T >
votca::xtp::CudaMatrix::CudaMatrix ( const T &  matrix,
const cudaStream_t &  stream 
)
inline

Definition at line 159 of file cudamatrix.h.

◆ CudaMatrix() [2/2]

votca::xtp::CudaMatrix::CudaMatrix ( Index  nrows,
Index  ncols,
const cudaStream_t &  stream 
)

Definition at line 71 of file cudamatrix.cc.

Member Function Documentation

◆ alloc_matrix_in_gpu()

CudaMatrix::Unique_ptr_to_GPU_data votca::xtp::CudaMatrix::alloc_matrix_in_gpu ( size_t  size_arr) const
private

Definition at line 87 of file cudamatrix.cc.

◆ block()

CudaMatrixBlock< CudaMatrix > votca::xtp::CudaMatrix::block ( Index  rowoffset,
Index  coloffset,
Index  rows,
Index  cols 
) const
inline

Definition at line 123 of file cudamatrix.h.

◆ col()

CudaMatrixBlock< CudaMatrix > votca::xtp::CudaMatrix::col ( Index  col) const
inline

Definition at line 132 of file cudamatrix.h.

◆ cols()

Index votca::xtp::CudaMatrix::cols ( ) const
inline

Definition at line 109 of file cudamatrix.h.

◆ copy_to_gpu()

template<class T >
void votca::xtp::CudaMatrix::copy_to_gpu ( const T &  m)
inline

Definition at line 146 of file cudamatrix.h.

◆ data()

double * votca::xtp::CudaMatrix::data ( ) const
inline

Definition at line 110 of file cudamatrix.h.

◆ ld()

Index votca::xtp::CudaMatrix::ld ( ) const
inline

Definition at line 108 of file cudamatrix.h.

◆ middleCols()

CudaMatrixBlock< CudaMatrix > votca::xtp::CudaMatrix::middleCols ( Index  coloffset,
Index  cols 
) const
inline

Definition at line 139 of file cudamatrix.h.

◆ middleRows()

CudaMatrixBlock< CudaMatrix > votca::xtp::CudaMatrix::middleRows ( Index  rowoffset,
Index  rows 
) const
inline

Definition at line 136 of file cudamatrix.h.

◆ operator Eigen::MatrixXd()

votca::xtp::CudaMatrix::operator Eigen::MatrixXd ( ) const

Definition at line 77 of file cudamatrix.cc.

◆ reshape()

void votca::xtp::CudaMatrix::reshape ( Index  rows,
Index  cols 
)
inline

Definition at line 112 of file cudamatrix.h.

◆ row()

CudaMatrixBlock< CudaMatrix > votca::xtp::CudaMatrix::row ( Index  row) const
inline

Definition at line 128 of file cudamatrix.h.

◆ rows()

Index votca::xtp::CudaMatrix::rows ( ) const
inline

Definition at line 107 of file cudamatrix.h.

◆ setZero()

void votca::xtp::CudaMatrix::setZero ( )

Definition at line 85 of file cudamatrix.cc.

◆ size()

Index votca::xtp::CudaMatrix::size ( ) const
inline

Definition at line 106 of file cudamatrix.h.

◆ size_matrix()

size_t votca::xtp::CudaMatrix::size_matrix ( ) const
inlineprivate

Definition at line 185 of file cudamatrix.h.

◆ throw_if_not_enough_memory_in_gpu()

void votca::xtp::CudaMatrix::throw_if_not_enough_memory_in_gpu ( size_t  requested_memory) const
private

Definition at line 97 of file cudamatrix.cc.

◆ transpose()

CudaMatrixTranspose< CudaMatrix > votca::xtp::CudaMatrix::transpose ( ) const
inline

Definition at line 119 of file cudamatrix.h.

◆ transposed()

static constexpr bool votca::xtp::CudaMatrix::transposed ( )
inlinestaticconstexpr

Definition at line 143 of file cudamatrix.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const CudaMatrix m 
)
friend

Definition at line 115 of file cudamatrix.cc.

Member Data Documentation

◆ cols_

Index votca::xtp::CudaMatrix::cols_
private

Definition at line 192 of file cudamatrix.h.

◆ data_

Unique_ptr_to_GPU_data votca::xtp::CudaMatrix::data_
private
Initial value:
{nullptr,
[](double *x) { checkCuda(cudaFree(x)); }}
void checkCuda(cudaError_t result)
Definition cudamatrix.cc:25

Definition at line 188 of file cudamatrix.h.

◆ ld_

Index votca::xtp::CudaMatrix::ld_
private

Definition at line 191 of file cudamatrix.h.

◆ stream_

cudaStream_t votca::xtp::CudaMatrix::stream_ = nullptr
private

Definition at line 190 of file cudamatrix.h.


The documentation for this class was generated from the following files: