Template Class device_matrix

Inheritance Relationships

Base Type

  • private boost::noncopyable

Class Documentation

template<typename T>
class device_matrix : private boost::noncopyable

A cuda device buffer object that represents a global memory buffer on a cuda device. Matrix size is fixed at construction and can only be resized using move semantics.

Template Parameters:

T – numeric type

Public Functions

inline device_matrix()

Default constructor.

inline device_matrix(device_matrix &&other) noexcept

Move Constructor.

Parameters:

other

inline device_matrix &operator=(device_matrix &&other) noexcept

Move Assignment Operator.

Parameters:

other

Returns:

device_matrix&

inline device_matrix(size_t rows, size_t cols, const T *data = nullptr)

Construct a new device matrix object of fixed size and initialized asyncronously if data is provided.

Parameters:
  • rows – number of rows

  • cols – number of columns

  • data – constigous column major data of size rows*cols*sizeof(T) to copy to device

inline explicit device_matrix(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &data)
template<int Rows, int Cols>
inline explicit device_matrix(const Eigen::Matrix<T, Rows, Cols> &data)
inline ~device_matrix()
__host__ inline T *Get()
__host__ inline const T *Get() const
__host__ inline size_t GetRows() const
__host__ inline size_t GetCols() const
__host__ inline size_t GetCount() const
__host__ inline size_t GetSize() const
__host__ inline void SetZeroAsync()
__host__ inline void SetDataSync(const T *data)

Performs a synchronous copy of data into the device buffer.

Parameters:

data

Returns:

host

__host__ inline void SetDataAsync(const T *data)

Copies data from device to host memory.

Parameters:

data

Returns:

host

__host__ inline void ToHost(T *out) const
__host__ inline void ToHost(std::vector<T> &out) const
__host__ inline void ToHost(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &out) const
template<int Rows, int Cols>
__host__ inline void ToHost(Eigen::Matrix<T, Rows, Cols> &out) const
__host__ inline Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> ToHost() const
__host__ inline void ToHostAsync(T *out) const
__host__ inline void ToHostAsync(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &out) const
__host__ inline void ToHostVectorAsync(Eigen::Matrix<T, Eigen::Dynamic, 1> &out) const
__host__ inline Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> ToHostAsync() const