Template Class device_matrix

Inheritance Relationships

Base Type

  • private noncopyable

Class Documentation

template<typename T>
class icrar::cuda::device_matrix : private noncopyable

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

Note

See https://www.quantstart.com/articles/Matrix-Matrix-Multiplication-on-the-GPU-with-Nvidia-CUDA/

Note

See https://forums.developer.nvidia.com/t/guide-cudamalloc3d-and-cudaarrays/23421

Template Parameters
  • T: numeric type

Public Functions

device_matrix()

Default constructor.

device_matrix(device_matrix &&other) noexcept

Move Constructor.

Parameters
  • other:

device_matrix &operator=(device_matrix &&other) noexcept

Move Assignment Operator.

Return

device_matrix&

Parameters
  • other:

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

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

Performs a synchronous copy of data into the device buffer.

Return

host

Parameters
  • data:

__host__ void SetDataAsync(const T *data)

Set the Data Async object.

Return

host

Parameters
  • data:

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