Template Class DataBuffer¶
Defined in File DataBuffer.hpp
Class Documentation¶
-
template<class GPUDataT, class DevTagT = int>
class DataBuffer¶ Data storage class for CUDA memory. Maintains an associated stream and device ID taken during time of allocation.
- Template Parameters
GPUDataT – GPU data type.
DevTagT – Device tag index type.
Public Types
-
using type = GPUDataT¶
Construct a new DataBuffer object.
- Param length
Number of elements in data buffer.
- Param device_id
Associated device ID. Must be
cudaSetDevice
compatible.- Param stream_id
Associated stream ID. Must be
cudaSetStream
compatible.- Param alloc_memory
Indicate whether to allocate the memory for the buffer. Defaults to
true
Public Functions
-
inline DataBuffer(std::size_t length, int device_id = 0, cudaStream_t stream_id = 0, bool alloc_memory = true)¶
-
DataBuffer() = delete¶
-
inline DataBuffer &operator=(const DataBuffer &other)¶
-
inline DataBuffer &operator=(DataBuffer &&other)¶
-
inline virtual ~DataBuffer()¶
-
inline void zeroInit()¶
Zero-initialize the GPU buffer.
-
inline auto getLength() const¶
-
inline auto getStream() const -> cudaStream_t¶
Get the CUDA stream for the given object.
- Returns
const cudaStream_t&
-
inline auto getDevice() const -> int¶
-
inline void CopyGpuDataToGpu(const GPUDataT *gpu_in, std::size_t length, bool async = false)¶
Copy data from another GPU memory block to here.
-
inline void CopyGpuDataToGpu(const DataBuffer &buffer, bool async = false)¶
Copy data from another GPU memory block to here.
api/classPennylane_1_1LightningGPU_1_1DataBuffer
Download Python script
Download Notebook
View on GitHub