Template Class StateVectorCudaBase¶
Defined in File StateVectorCudaBase.hpp
Inheritance Relationships¶
Base Type¶
public Pennylane::StateVectorBase< Precision, Derived >
(Template Class StateVectorBase)
Class Documentation¶
-
template<class Precision, class Derived>
class StateVectorCudaBase : public Pennylane::StateVectorBase<Precision, Derived>¶ CRTP-enabled base class for CUDA-capable state-vector simulators.
- Template Parameters
Precision – Floating point precision.
Derived – Derived class to instantiate using CRTP.
Public Types
Public Functions
-
inline auto getData() const -> const CFP_t*¶
Return a pointer to the GPU data.
- Returns
const CFP_t* Complex device pointer.
-
inline auto getData() -> CFP_t*¶
Return a pointer to the GPU data.
- Returns
CFP_t* Complex device pointer.
-
inline auto getStream() -> cudaStream_t¶
Get the CUDA stream for the given object.
- Returns
cudaStream_t&
-
inline auto getStream() const -> cudaStream_t¶
Get the CUDA stream for the given object.
- Returns
const cudaStream_t&
-
inline void setStream(const cudaStream_t &s)¶
-
inline void CopyHostDataToGpu(const std::vector<std::complex<Precision>> &sv, bool async = false)¶
Explicitly copy data from host memory to GPU device.
- Parameters
sv – StateVector host data class.
-
inline void CopyGpuDataToGpuIn(const CFP_t *gpu_sv, std::size_t length, bool async = false)¶
Explicitly copy data from host memory to GPU device.
- Parameters
host_sv – Complex data pointer to array.
length – Number of complex elements.
-
inline void CopyGpuDataToGpuIn(const Derived &sv, bool async = false)¶
Explicitly copy data from another GPU device memory block to this GPU device.
- Parameters
sv – LightningGPU object to send data.
-
inline void CopyHostDataToGpu(const std::complex<Precision> *host_sv, std::size_t length, bool async = false)¶
Explicitly copy data from host memory to GPU device.
- Parameters
host_sv – Complex data pointer to array.
length – Number of complex elements.
-
inline void CopyGpuDataToHost(std::complex<Precision> *host_sv, std::size_t length, bool async = false) const¶
Explicitly copy data from GPU device to host memory.
- Parameters
sv – Complex data pointer to receive data from device.
-
inline void CopyGpuDataToGpuOut(Derived &sv, bool async = false)¶
Explicitly copy data from this GPU device to another GPU device memory block.
- Parameters
sv – LightningGPU object to receive data.
-
inline const LightningGPU::DataBuffer<CFP_t> &getDataBuffer() const¶
-
inline LightningGPU::DataBuffer<CFP_t> &getDataBuffer()¶
-
inline void updateData(const Derived &other, bool async = false)¶
Update GPU device data from given derived object.
- Parameters
other – Source data to copy from.
async – Use asynchronous copies.
-
inline void updateData(std::unique_ptr<LightningGPU::DataBuffer<CFP_t>> &&other)¶
Move and replace DataBuffer for statevector.
- Parameters
other – Source data to copy from.
Protected Types
Protected Functions
-
inline StateVectorCudaBase(std::size_t num_qubits, int device_id = 0, cudaStream_t stream_id = 0, bool device_alloc = true)¶
-
inline StateVectorCudaBase(std::size_t num_qubits, LightningGPU::DevTag<int> dev_tag, bool device_alloc = true)¶
-
StateVectorCudaBase() = delete¶
-
StateVectorCudaBase(const StateVectorCudaBase &other) = delete¶
-
StateVectorCudaBase(StateVectorCudaBase &&other) = delete¶
-
inline virtual ~StateVectorCudaBase()¶
-
inline auto getCtrlMap() -> const std::unordered_map<std::string, std::size_t>&¶
Return the mapping of named gates to amount of control wires they have.
- Returns
const std::unordered_map<std::string, std::size_t>&
-
inline auto getParametricGatesMap() -> const std::unordered_map<std::string, std::size_t>&¶
Utility method to get the mappings from gate to supported wires.
- Returns
const std::unordered_map<std::string, std::size_t>&