Template Class device_vector
Defined in File device_vector.h
Inheritance Relationships
Base Type
private boost::noncopyable
Class Documentation
-
template<typename T>
class device_vector : private boost::noncopyable A cuda device buffer object that own a vector memory buffer on a cuda device. Vector size is fixed at construction.
Note
See https://www.quantstart.com/articles/Matrix-Matrix-Multiplication-on-the-GPU-with-Nvidia-CUDA/
- Template Parameters:
T – numeric type
Public Functions
-
inline device_vector()
Default constructor.
-
__host__ inline device_vector(device_vector &&other) noexcept
-
__host__ inline device_vector &operator=(device_vector &&other) noexcept
-
__host__ inline explicit device_vector(size_t count, const T *data = nullptr)
Construct a new device buffer object.
- Parameters:
size –
data –
-
__host__ inline ~device_vector()
-
__host__ __device__ inline size_t GetCount() const
Gets the number of elements in the buffer.
-
__host__ __device__ inline size_t GetRows() const
Gets the number of rows in the column vector.
-
__host__ __device__ inline constexpr size_t GetCols() const
-
__host__ __device__ inline size_t GetSize() const
Gets the buffer size in bytes.
-
__host__ inline void SetZeroAsync()
-
__host__ inline void SetDataSync(const T *data)
Performs a synchronous copy of data into the device buffer.
- Parameters:
data – data buffer for host to device copying
- Pre:
data points to a buffer of byte size >= GetSize()
-
__host__ inline void SetDataAsync(const T *data)
Sets buffer data from pinned host memory.
- Parameters:
data – data buffer for host to device copying
- Pre:
Heap memory must be pinned using cudaHostRegister(…, cudaHostRegisterPortable)
- Pre:
data points to a buffer of byte size >= GetSize()