Crate Documentation
Version: 0.2.0
Format Version: 57
Module qdp_core
Modules
Module dlpack
pub mod dlpack { /* ... */ }
Types
Enum DLDeviceType
Attributes:
Other("#[allow(non_camel_case_types)]")Repr(AttributeRepr { kind: C, align: None, packed: None, int: None })
Device type enum for DLPack. Eq/PartialEq used for validation (e.g. device_type != kDLCUDA); Debug for diagnostics; Copy/Clone for FFI ergonomics when used in DLDevice.
pub enum DLDeviceType {
kDLCPU = 1,
kDLCUDA = 2,
}
Variants
kDLCPU
Discriminant: 1
Discriminant value: 1
kDLCUDA
Discriminant: 2
Discriminant value: 2
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> DLDeviceType { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Copy
-
Debug
-
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
-
-
Eq
-
Equivalent
-
fn equivalent(self: &Self, key: &K) -> bool { /* ... */ } -
fn equivalent(self: &Self, key: &K) -> bool { /* ... */ } -
fn equivalent(self: &Self, key: &K) -> bool { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
PartialEq
-
fn eq(self: &Self, other: &DLDeviceType) -> bool { /* ... */ }
-
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
StructuralPartialEq
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct DLDevice
Attributes:
Repr(AttributeRepr { kind: C, align: None, packed: None, int: None })
pub struct DLDevice {
pub device_type: DLDeviceType,
pub device_id: std::os::raw::c_int,
}
Fields
| Name | Type | Documentation |
|---|---|---|
device_type | DLDeviceType | |
device_id | std::os::raw::c_int |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct DLDataType
Attributes:
Repr(AttributeRepr { kind: C, align: None, packed: None, int: None })
pub struct DLDataType {
pub code: u8,
pub bits: u8,
pub lanes: u16,
}
Fields
| Name | Type | Documentation |
|---|---|---|
code | u8 | |
bits | u8 | |
lanes | u16 |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct DLTensor
Attributes:
Repr(AttributeRepr { kind: C, align: None, packed: None, int: None })
pub struct DLTensor {
pub data: *mut std::os::raw::c_void,
pub device: DLDevice,
pub ndim: std::os::raw::c_int,
pub dtype: DLDataType,
pub shape: *mut i64,
pub strides: *mut i64,
pub byte_offset: u64,
}
Fields
| Name | Type | Documentation |
|---|---|---|
data | *mut std::os::raw::c_void | |
device | DLDevice | |
ndim | std::os::raw::c_int | |
dtype | DLDataType | |
shape | *mut i64 | |
strides | *mut i64 | |
byte_offset | u64 |
Implementations
Trait Implementations
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct DLManagedTensor
Attributes:
Repr(AttributeRepr { kind: C, align: None, packed: None, int: None })
pub struct DLManagedTensor {
pub dl_tensor: DLTensor,
pub manager_ctx: *mut std::os::raw::c_void,
pub deleter: Option<unsafe extern "C" fn(*mut DLManagedTensor)>,
}
Fields
| Name | Type | Documentation |
|---|---|---|
dl_tensor | DLTensor | |
manager_ctx | *mut std::os::raw::c_void | |
deleter | Option<unsafe extern "C" fn(*mut DLManagedTensor)> |
Implementations
Trait Implementations
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Functions
Function dlpack_stream_to_cuda
Map DLPack stream integer to a CUDA stream pointer.
pub fn dlpack_stream_to_cuda(stream: i64) -> *mut std::os::raw::c_void { /* ... */ }
Function synchronize_stream
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/dlpack.rs:48:7: 48:26 (#0) }])]")
Safety
stream must be a valid CUDA stream pointer or one of the CUDA sentinel
values (legacy/per-thread default). Passing any other pointer is undefined.
pub unsafe fn synchronize_stream(stream: *mut std::os::raw::c_void) -> crate::error::Result<()> { /* ... */ }
Function dlpack_deleter
Attributes:
Other("#[allow(unsafe_op_in_unsafe_fn)]")
Called by PyTorch to free tensor memory
Safety
Frees shape, strides, GPU buffer, and managed tensor. Caller must ensure the pointer is valid and points to a properly initialized DLManagedTensor.
pub unsafe extern "C" fn dlpack_deleter(managed: *mut DLManagedTensor) { /* ... */ }
Constants and Statics
Constant CUDA_STREAM_LEGACY
Attributes:
Other("#[allow(clippy::manual_dangling_ptr)]")
DLPack CUDA stream sentinel values (legacy/per-thread default). These match cudaStreamLegacy/cudaStreamPerThread in the CUDA runtime.
pub const CUDA_STREAM_LEGACY: *mut std::os::raw::c_void = _;
Constant CUDA_STREAM_PER_THREAD
Attributes:
Other("#[allow(clippy::manual_dangling_ptr)]")
pub const CUDA_STREAM_PER_THREAD: *mut std::os::raw::c_void = _;
Constant DL_INT
Attributes:
Other("#[allow(dead_code)]")
pub const DL_INT: u8 = 0;
Constant DL_UINT
Attributes:
Other("#[allow(dead_code)]")
pub const DL_UINT: u8 = 1;
Constant DL_FLOAT
Attributes:
Other("#[allow(dead_code)]")
pub const DL_FLOAT: u8 = 2;
Constant DL_BFLOAT
Attributes:
Other("#[allow(dead_code)]")
pub const DL_BFLOAT: u8 = 4;
Constant DL_COMPLEX
pub const DL_COMPLEX: u8 = 5;
Module error
pub mod error { /* ... */ }
Types
Enum MahoutError
Error types for Mahout QDP operations
pub enum MahoutError {
Cuda(String),
InvalidInput(String),
MemoryAllocation(String),
KernelLaunch(String),
DLPack(String),
Io(String),
NotImplemented(String),
}
Variants
Cuda
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
InvalidInput
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
MemoryAllocation
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
KernelLaunch
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
DLPack
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
Io
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
NotImplemented
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | String |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Debug
-
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
-
-
Display
-
fn fmt(self: &Self, __formatter: &mut ::core::fmt::Formatter<''_>) -> ::core::fmt::Result { /* ... */ }
-
-
Error
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
ToString
-
fn to_string(self: &Self) -> String { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Type Alias Result
Result type alias for Mahout operations
pub type Result<T> = std::result::Result<T, MahoutError>;
Functions
Function cuda_error_to_string
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/error.rs:48:7: 48:26 (#0) }])]")
Convert CUDA error code to human-readable string
pub fn cuda_error_to_string(code: i32) -> &''static str { /* ... */ }
Module gpu
pub mod gpu { /* ... */ }
Modules
Module buffer_pool
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:17:7: 17:26 (#0) }])]")
Reusable pool of pinned host buffers for staging Disk → Host → GPU transfers. Intended for producer/consumer pipelines that need a small, fixed set of page-locked buffers to avoid repeated cudaHostAlloc / cudaFreeHost.
pub mod buffer_pool { /* ... */ }
Types
Struct PinnedBufferHandle
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/buffer_pool.rs:30:7: 30:26 (#0) }])]")
Handle that automatically returns a buffer to the pool on drop.
pub struct PinnedBufferHandle {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Deref
-
fn deref(self: &Self) -> &<Self as >::Target { /* ... */ }
-
-
DerefMut
-
fn deref_mut(self: &mut Self) -> &mut <Self as >::Target { /* ... */ }
-
-
Drop
-
fn drop(self: &mut Self) { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
Receiver
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct PinnedBufferPool
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/buffer_pool.rs:68:7: 68:26 (#0) }])]")
Pool of pinned host buffers sized for a fixed batch shape.
pub struct PinnedBufferPool {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new(pool_size: usize, elements_per_buffer: usize) -> Result<Arc<Self>> { /* ... */ }Create a pool with
pool_sizepinned buffers, each sized forelements_per_bufferf64 values. -
pub fn acquire(self: &Arc<Self>) -> PinnedBufferHandle { /* ... */ }Acquire a pinned buffer, blocking until one is available.
-
pub fn acquire_with_metrics(self: &Arc<Self>, metrics: Option<&PoolMetrics>) -> PinnedBufferHandle { /* ... */ }Acquire a pinned buffer with optional metrics tracking.
-
pub fn try_acquire(self: &Arc<Self>) -> Option<PinnedBufferHandle> { /* ... */ }Try to acquire a pinned buffer from the pool.
-
pub fn available(self: &Self) -> usize { /* ... */ }Number of buffers currently available.
-
pub fn capacity(self: &Self) -> usize { /* ... */ }Total number of buffers managed by this pool.
-
pub fn elements_per_buffer(self: &Self) -> usize { /* ... */ }Fixed element capacity for each buffer in the pool.
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module encodings
pub mod encodings { /* ... */ }
Modules
Module amplitude
Attributes:
Other("#[allow(unused_unsafe)]")
pub mod amplitude { /* ... */ }
Types
Struct AmplitudeEncoder
Amplitude encoding: data → normalized quantum amplitudes
Steps: L2 norm (CPU) → GPU allocation → CUDA kernel (normalize + pad) Fast: ~50-100x vs circuit-based methods
pub struct AmplitudeEncoder;
Implementations
Methods
-
pub unsafe fn calculate_inv_norm_gpu_f32(device: &Arc<CudaDevice>, input_ptr: *const f32, len: usize) -> Result<f32> { /* ... */ }Compute inverse L2 norm on GPU for float32 input using the reduction kernel.
-
pub unsafe fn calculate_inv_norm_gpu_f32_with_stream(device: &Arc<CudaDevice>, input_ptr: *const f32, len: usize, stream: *mut c_void) -> Result<f32> { /* ... */ }Compute inverse L2 norm on GPU for float32 input on a given stream.
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
QuantumEncoder
-
fn encode(self: &Self, _device: &Arc<CudaDevice>, host_data: &[f64], num_qubits: usize) -> Result<GpuStateVector> { /* ... */ } -
fn encode_batch(self: &Self, device: &Arc<CudaDevice>, batch_data: &[f64], num_samples: usize, sample_size: usize, num_qubits: usize) -> Result<GpuStateVector> { /* ... */ }Encode multiple samples in a single GPU allocation and kernel launch
-
unsafe fn encode_from_gpu_ptr(self: &Self, device: &Arc<CudaDevice>, input_d: *const c_void, input_len: usize, num_qubits: usize, stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ } -
unsafe fn encode_batch_from_gpu_ptr(self: &Self, device: &Arc<CudaDevice>, input_batch_d: *const c_void, num_samples: usize, sample_size: usize, num_qubits: usize, stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ } -
fn name(self: &Self) -> &''static str { /* ... */ } -
fn description(self: &Self) -> &''static str { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module angle
Attributes:
Other("#[allow(unused_unsafe)]")
pub mod angle { /* ... */ }
Types
Struct AngleEncoder
Angle encoding: each qubit uses one rotation angle to form a product state.
pub struct AngleEncoder;
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
QuantumEncoder
-
fn encode(self: &Self, device: &Arc<CudaDevice>, data: &[f64], num_qubits: usize) -> Result<GpuStateVector> { /* ... */ } -
fn encode_batch(self: &Self, device: &Arc<CudaDevice>, batch_data: &[f64], num_samples: usize, sample_size: usize, num_qubits: usize) -> Result<GpuStateVector> { /* ... */ }Encode multiple angle samples in a single GPU allocation and kernel launch
-
unsafe fn encode_from_gpu_ptr(self: &Self, device: &Arc<CudaDevice>, input_d: *const c_void, input_len: usize, num_qubits: usize, stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ } -
unsafe fn encode_batch_from_gpu_ptr(self: &Self, device: &Arc<CudaDevice>, input_batch_d: *const c_void, num_samples: usize, sample_size: usize, num_qubits: usize, stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ } -
fn validate_input(self: &Self, data: &[f64], num_qubits: usize) -> Result<()> { /* ... */ } -
fn name(self: &Self) -> &''static str { /* ... */ } -
fn description(self: &Self) -> &''static str { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module basis
Attributes:
Other("#[allow(unused_unsafe)]")
pub mod basis { /* ... */ }
Types
Struct BasisEncoder
Basis encoding: maps an integer index to a computational basis state.
For n qubits, maps integer i (0 ≤ i < 2^n) to |i⟩, where:
- state[i] = 1.0 + 0.0i
- state[j] = 0.0 + 0.0i for all j ≠ i
Example: index 3 with 3 qubits → |011⟩ (binary representation of 3)
Input format:
- Single encoding: data = [index] (single f64 representing the basis index)
- Batch encoding: data = [idx0, idx1, ..., idxN] (one index per sample)
pub struct BasisEncoder;
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
QuantumEncoder
-
fn encode(self: &Self, device: &Arc<CudaDevice>, data: &[f64], num_qubits: usize) -> Result<GpuStateVector> { /* ... */ } -
fn encode_batch(self: &Self, device: &Arc<CudaDevice>, batch_data: &[f64], num_samples: usize, sample_size: usize, num_qubits: usize) -> Result<GpuStateVector> { /* ... */ }Encode multiple basis indices in a single GPU allocation and kernel launch
-
unsafe fn encode_from_gpu_ptr(self: &Self, device: &Arc<CudaDevice>, input_d: *const c_void, input_len: usize, num_qubits: usize, stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ } -
unsafe fn encode_batch_from_gpu_ptr(self: &Self, device: &Arc<CudaDevice>, input_batch_d: *const c_void, num_samples: usize, sample_size: usize, num_qubits: usize, stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ } -
fn validate_input(self: &Self, data: &[f64], num_qubits: usize) -> Result<()> { /* ... */ } -
fn name(self: &Self) -> &''static str { /* ... */ } -
fn description(self: &Self) -> &''static str { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module iqp
pub mod iqp { /* ... */ }
Types
Struct IqpEncoder
IQP encoding: creates entangled quantum states using diagonal phase gates.
Two variants are supported:
enable_zz = false: Single-qubit Z rotations only (n parameters)enable_zz = true: Full ZZ interactions (n + n*(n-1)/2 parameters)
pub struct IqpEncoder {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn full() -> Self { /* ... */ }Create an IQP encoder with full ZZ interactions.
-
pub fn z_only() -> Self { /* ... */ }Create an IQP encoder with single-qubit Z rotations only.
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
QuantumEncoder
-
fn encode(self: &Self, device: &Arc<CudaDevice>, data: &[f64], num_qubits: usize) -> Result<GpuStateVector> { /* ... */ } -
fn encode_batch(self: &Self, device: &Arc<CudaDevice>, batch_data: &[f64], num_samples: usize, sample_size: usize, num_qubits: usize) -> Result<GpuStateVector> { /* ... */ }Encode multiple IQP samples in a single GPU allocation and kernel launch
-
fn validate_input(self: &Self, data: &[f64], num_qubits: usize) -> Result<()> { /* ... */ } -
fn name(self: &Self) -> &''static str { /* ... */ } -
fn description(self: &Self) -> &''static str { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Traits
Trait QuantumEncoder
Quantum encoding strategy interface Implemented by: AmplitudeEncoder, AngleEncoder, BasisEncoder
pub trait QuantumEncoder: Send + Sync {
/* Associated items */
}
Required Items
Required Methods
encode: Encode classical data to quantum state on GPUname: Strategy namedescription: Strategy description
Provided Methods
-
fn encode_batch(self: &Self, _device: &Arc<CudaDevice>, _batch_data: &[f64], _num_samples: usize, _sample_size: usize, _num_qubits: usize) -> Result<GpuStateVector> { /* ... */ }Encode multiple samples in a single GPU allocation and kernel launch (Batch Encoding)
-
fn validate_input(self: &Self, data: &[f64], num_qubits: usize) -> Result<()> { /* ... */ }Validate input data before encoding
-
unsafe fn encode_from_gpu_ptr(self: &Self, _device: &Arc<CudaDevice>, _input_d: *const c_void, _input_len: usize, _num_qubits: usize, _stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ }Encode from existing GPU pointer (zero-copy). Default: not supported.
-
unsafe fn encode_batch_from_gpu_ptr(self: &Self, _device: &Arc<CudaDevice>, _input_batch_d: *const c_void, _num_samples: usize, _sample_size: usize, _num_qubits: usize, _stream: *mut c_void) -> Result<GpuStateVector> { /* ... */ }Encode batch from existing GPU pointer (zero-copy). Default: not supported.
Implementations
This trait is implemented for the following types:
AmplitudeEncoderAngleEncoderBasisEncoderIqpEncoder
Functions
Function validate_qubit_count
Validates qubit count against practical limits.
Checks:
- Qubit count is at least 1
- Qubit count does not exceed MAX_QUBITS
Arguments
num_qubits- The number of qubits to validate
Returns
Ok(())if the qubit count is validErr(MahoutError::InvalidInput)if the qubit count is invalid
pub fn validate_qubit_count(num_qubits: usize) -> crate::error::Result<()> { /* ... */ }
Function get_encoder
Create encoder by name: "amplitude", "angle", "basis", "iqp", or "iqp-z"
pub fn get_encoder(name: &str) -> crate::error::Result<Box<dyn QuantumEncoder>> { /* ... */ }
Constants and Statics
Constant MAX_QUBITS
Maximum number of qubits supported (16GB GPU memory limit) This constant must match MAX_QUBITS in qdp-kernels/src/kernel_config.h
pub const MAX_QUBITS: usize = 30;
Re-exports
Re-export AmplitudeEncoder
pub use amplitude::AmplitudeEncoder;
Re-export AngleEncoder
pub use angle::AngleEncoder;
Re-export BasisEncoder
pub use basis::BasisEncoder;
Re-export IqpEncoder
pub use iqp::IqpEncoder;
Module memory
Attributes:
Other("#[allow(unused_unsafe)]")
pub mod memory { /* ... */ }
Types
Enum Precision
Precision of the GPU state vector.
pub enum Precision {
Float32,
Float64,
}
Variants
Float32
Float64
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> Precision { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Copy
-
Debug
-
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
-
-
Eq
-
Equivalent
-
fn equivalent(self: &Self, key: &K) -> bool { /* ... */ } -
fn equivalent(self: &Self, key: &K) -> bool { /* ... */ } -
fn equivalent(self: &Self, key: &K) -> bool { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
PartialEq
-
fn eq(self: &Self, other: &Precision) -> bool { /* ... */ }
-
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
StructuralPartialEq
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct GpuBufferRaw
RAII wrapper for GPU memory buffer Automatically frees GPU memory when dropped
pub struct GpuBufferRaw<T> {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
Get raw pointer to GPU memory
pub fn ptr(self: &Self) -> *mut T { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Enum BufferStorage
Storage wrapper for precision-specific GPU buffers
pub enum BufferStorage {
F32(GpuBufferRaw<qdp_kernels::CuComplex>),
F64(GpuBufferRaw<qdp_kernels::CuDoubleComplex>),
}
Variants
F32
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | GpuBufferRaw<qdp_kernels::CuComplex> |
F64
Fields:
| Index | Type | Documentation |
|---|---|---|
| 0 | GpuBufferRaw<qdp_kernels::CuDoubleComplex> |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct GpuStateVector
Quantum state vector on GPU
Manages complex array of size 2^n (n = qubits) in GPU memory. Uses Arc for shared ownership (needed for DLPack/PyTorch integration). Thread-safe: Send + Sync
pub struct GpuStateVector {
pub num_qubits: usize,
pub size_elements: usize,
pub device_id: usize,
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
num_qubits | usize | |
size_elements | usize | |
device_id | usize | CUDA device ordinal |
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn to_dlpack(self: &Self) -> *mut DLManagedTensor { /* ... */ }Convert to DLPack format for PyTorch
-
pub fn new(_device: &Arc<CudaDevice>, qubits: usize, precision: Precision) -> Result<Self> { /* ... */ }Create GPU state vector for n qubits with the given precision.
-
pub fn precision(self: &Self) -> Precision { /* ... */ }Get current precision of the underlying buffer.
-
pub fn ptr_void(self: &Self) -> *mut c_void { /* ... */ }Get raw GPU pointer for DLPack/FFI
-
pub fn ptr_f64(self: &Self) -> Option<*mut CuDoubleComplex> { /* ... */ }Returns a double-precision pointer if the buffer stores complex128 data.
-
pub fn ptr_f32(self: &Self) -> Option<*mut CuComplex> { /* ... */ }Returns a single-precision pointer if the buffer stores complex64 data.
-
pub fn num_qubits(self: &Self) -> usize { /* ... */ }Get the number of qubits
-
pub fn size_elements(self: &Self) -> usize { /* ... */ }Get the size in elements (2^n where n is number of qubits)
-
pub fn new_batch(_device: &Arc<CudaDevice>, num_samples: usize, qubits: usize) -> Result<Self> { /* ... */ }Create GPU state vector for a batch of samples
-
pub fn to_precision(self: &Self, device: &Arc<CudaDevice>, target: Precision) -> Result<Self> { /* ... */ }Convert the state vector to the requested precision (GPU-side).
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> GpuStateVector { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct PinnedHostBuffer
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/memory.rs:573:7: 573:26 (#0) }])]")
Pinned Host Memory Buffer (owned allocation).
Allocates page-locked memory to maximize H2D throughput in streaming IO paths.
pub struct PinnedHostBuffer {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new(elements: usize) -> Result<Self> { /* ... */ }Allocate pinned memory
-
pub fn as_slice_mut(self: &mut Self) -> &mut [f64] { /* ... */ }Get mutable slice to write data into
-
pub fn as_slice(self: &Self) -> &[f64] { /* ... */ }Immutable slice view of the pinned region
-
pub fn ptr(self: &Self) -> *const f64 { /* ... */ }Get raw pointer for CUDA memcpy
-
pub fn len(self: &Self) -> usize { /* ... */ } -
pub fn is_empty(self: &Self) -> bool { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Drop
-
fn drop(self: &mut Self) { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module overlap_tracker
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:23:7: 23:26 (#0) }])]")
Overlap tracking for H2D copy and compute operations.
Uses CUDA events to measure the overlap between host-to-device copy operations and compute operations, enabling verification of the >60% overlap target.
pub mod overlap_tracker { /* ... */ }
Types
Struct OverlapTracker
Tracks overlap between H2D copy and compute operations using CUDA events.
Creates events for each pool slot to track copy and compute start/end times. Can be optionally enabled via environment variable to minimize overhead when disabled.
pub struct OverlapTracker {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new(pool_size: usize, enabled: bool) -> Result<Self> { /* ... */ }Create a new OverlapTracker for the given pool size.
-
pub fn record_copy_start(self: &Self, stream: &CudaStream, slot: usize) -> Result<()> { /* ... */ }Record the start of a copy operation on the copy stream.
-
pub fn record_copy_end(self: &Self, stream: &CudaStream, slot: usize) -> Result<()> { /* ... */ }Record the end of a copy operation on the copy stream.
-
pub fn record_compute_start(self: &Self, stream: &CudaStream, slot: usize) -> Result<()> { /* ... */ }Record the start of a compute operation on the compute stream.
-
pub fn record_compute_end(self: &Self, stream: &CudaStream, slot: usize) -> Result<()> { /* ... */ }Record the end of a compute operation on the compute stream.
-
pub fn calculate_overlap(self: &Self, chunk_idx: usize) -> Result<f64> { /* ... */ }Calculate the overlap ratio for a specific chunk.
-
pub fn log_overlap(self: &Self, chunk_idx: usize) -> Result<()> { /* ... */ }Log the overlap ratio for a specific chunk.
Trait Implementations
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Drop
-
fn drop(self: &mut Self) { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module pipeline
Attributes:
Other("#[allow(unused_unsafe)]")
pub mod pipeline { /* ... */ }
Types
Struct PipelineContext
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/pipeline.rs:47:7: 47:26 (#0) }])]")
Dual-stream context coordinating copy/compute with an event.
pub struct PipelineContext {
pub stream_compute: cudarc::driver::safe::CudaStream,
pub stream_copy: cudarc::driver::safe::CudaStream,
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
stream_compute | cudarc::driver::safe::CudaStream | |
stream_copy | cudarc::driver::safe::CudaStream | |
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new(device: &Arc<CudaDevice>, event_slots: usize) -> Result<Self> { /* ... */ } -
pub unsafe fn async_copy_to_device(self: &Self, src: *const c_void, dst: *mut c_void, len_elements: usize) -> Result<()> { /* ... */ }Async H2D copy on the copy stream.
-
pub unsafe fn record_copy_done(self: &Self, slot: usize) -> Result<()> { /* ... */ }Record completion of the copy on the copy stream.
-
pub unsafe fn wait_for_copy(self: &Self, slot: usize) -> Result<()> { /* ... */ }Make compute stream wait for the copy completion event.
-
pub unsafe fn sync_copy_stream(self: &Self) -> Result<()> { /* ... */ }Sync copy stream (safe to reuse host buffer).
Trait Implementations
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Drop
-
fn drop(self: &mut Self) { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Functions
Function run_dual_stream_pipeline
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/pipeline.rs:252:7: 252:26 (#0) }])]")
Executes a task using dual-stream double-buffering pattern
This function handles the generic pipeline mechanics:
- Dual stream creation and management
- Data chunking and async H2D copy
- Buffer lifetime management
- Stream synchronization
- Optional observability (pool metrics and overlap tracking)
The caller provides a kernel_launcher closure that handles the
specific kernel launch logic for each chunk.
Arguments
device- The CUDA devicehost_data- Full source data to processkernel_launcher- Closure that launches the specific kernel for each chunk
Environment Variables
QDP_ENABLE_POOL_METRICS- Enable pool utilization metrics (set to "1" or "true")QDP_ENABLE_OVERLAP_TRACKING- Enable H2D overlap tracking (set to "1" or "true")
Example
run_dual_stream_pipeline(device, host_data, |stream, input_ptr, offset, len| {
// Launch your specific kernel here
launch_my_kernel(input_ptr, offset, len, stream)?;
Ok(())
})?;
pub fn run_dual_stream_pipeline<F>(device: &std::sync::Arc<cudarc::driver::CudaDevice>, host_data: &[f64], kernel_launcher: F) -> crate::error::Result<()>
where
F: FnMut(&cudarc::driver::safe::CudaStream, *const f64, usize, usize) -> crate::error::Result<()> { /* ... */ }
Function run_dual_stream_pipeline_aligned
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/pipeline.rs:276:7: 276:26 (#0) }])]")
Executes a task using dual-stream double-buffering with aligned chunk boundaries.
align_elements must evenly divide the host data length and ensures chunks do not
split logical records (e.g., per-sample data in batch encoding).
pub fn run_dual_stream_pipeline_aligned<F>(device: &std::sync::Arc<cudarc::driver::CudaDevice>, host_data: &[f64], align_elements: usize, kernel_launcher: F) -> crate::error::Result<()>
where
F: FnMut(&cudarc::driver::safe::CudaStream, *const f64, usize, usize) -> crate::error::Result<()> { /* ... */ }
Module pool_metrics
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:26:7: 26:26 (#0) }])]")
Pool utilization metrics for diagnosing pool starvation.
Provides lightweight, thread-safe metrics tracking for pinned buffer pool utilization. Uses lock-free atomic operations to minimize performance impact.
pub mod pool_metrics { /* ... */ }
Types
Struct PoolMetrics
Pool utilization metrics (thread-safe, lock-free design)
Tracks pool availability, acquire operations, and wait times to diagnose pool starvation issues. Uses atomic operations with Relaxed ordering for minimal performance overhead.
pub struct PoolMetrics {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new() -> Self { /* ... */ }Create a new PoolMetrics instance with all counters initialized to zero.
-
pub fn record_acquire(self: &Self, available: usize) { /* ... */ }Record an acquire operation with the number of available buffers at that time.
-
pub fn record_wait(self: &Self, wait_time_ns: u64) { /* ... */ }Record a wait operation with the wait time in nanoseconds.
-
pub fn report(self: &Self) -> PoolUtilizationReport { /* ... */ }Generate a utilization report from the current metrics.
-
pub fn reset(self: &Self) { /* ... */ }Reset all metrics to their initial state.
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Debug
-
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
-
-
Default
-
fn default() -> Self { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct PoolUtilizationReport
Pool utilization report containing aggregated metrics.
pub struct PoolUtilizationReport {
pub min_available: usize,
pub max_available: usize,
pub total_acquires: u64,
pub total_waits: u64,
pub starvation_ratio: f64,
pub avg_wait_time_ns: u64,
}
Fields
| Name | Type | Documentation |
|---|---|---|
min_available | usize | Minimum number of buffers available during any acquire operation |
max_available | usize | Maximum number of buffers available during any acquire operation |
total_acquires | u64 | Total number of acquire operations |
total_waits | u64 | Total number of wait operations (pool was empty) |
starvation_ratio | f64 | Ratio of waits to acquires (starvation ratio) |
avg_wait_time_ns | u64 | Average wait time in nanoseconds |
Implementations
Methods
-
Print a summary of the utilization report to the log.
pub fn print_summary(self: &Self) { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> PoolUtilizationReport { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Debug
-
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Re-exports
Re-export PinnedBufferHandle
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:32:7: 32:26 (#0) }])]")
pub use buffer_pool::PinnedBufferHandle;
Re-export PinnedBufferPool
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:32:7: 32:26 (#0) }])]")
pub use buffer_pool::PinnedBufferPool;
Re-export AmplitudeEncoder
pub use encodings::AmplitudeEncoder;
Re-export AngleEncoder
pub use encodings::AngleEncoder;
Re-export BasisEncoder
pub use encodings::BasisEncoder;
Re-export QuantumEncoder
pub use encodings::QuantumEncoder;
Re-export get_encoder
pub use encodings::get_encoder;
Re-export GpuStateVector
pub use memory::GpuStateVector;
Re-export run_dual_stream_pipeline
pub use pipeline::run_dual_stream_pipeline;
Re-export OverlapTracker
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:38:7: 38:26 (#0) }])]")
pub use overlap_tracker::OverlapTracker;
Re-export PipelineContext
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:40:7: 40:26 (#0) }])]")
pub use pipeline::PipelineContext;
Re-export PoolMetrics
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:42:7: 42:26 (#0) }])]")
pub use pool_metrics::PoolMetrics;
Re-export PoolUtilizationReport
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/gpu/mod.rs:42:7: 42:26 (#0) }])]")
pub use pool_metrics::PoolUtilizationReport;
Module io
I/O utilities for reading and writing quantum data.
Provides efficient columnar data exchange via Apache Arrow and Parquet formats.
TODO
Consider using generic T: ArrowPrimitiveType instead of hardcoded Float64Array
to support both Float32 and Float64 for flexibility in precision vs performance trade-offs.
pub mod io { /* ... */ }
Types
Type Alias ParquetBlockReader
Streaming Parquet reader for List
Reads Parquet files in chunks without loading entire file into memory. Supports efficient streaming for large files via Producer-Consumer pattern.
This is a type alias for backward compatibility. Use [crate::readers::ParquetStreamingReader] directly.
pub type ParquetBlockReader = crate::readers::ParquetStreamingReader;
Functions
Function arrow_to_vec
Converts an Arrow Float64Array to Vec
pub fn arrow_to_vec(array: &arrow::array::Float64Array) -> Vec<f64> { /* ... */ }
Function arrow_to_vec_chunked
Flattens multiple Arrow Float64Arrays into a single Vec
pub fn arrow_to_vec_chunked(arrays: &[arrow::array::Float64Array]) -> Vec<f64> { /* ... */ }
Function read_parquet
Reads Float64 data from a Parquet file.
Expects a single Float64 column. For zero-copy access, use [read_parquet_to_arrow].
pub fn read_parquet<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<Vec<f64>> { /* ... */ }
Function write_parquet
Writes Float64 data to a Parquet file.
Arguments
path- Output file pathdata- Data to writecolumn_name- Column name (defaults to "data")
pub fn write_parquet<P: AsRef<std::path::Path>>(path: P, data: &[f64], column_name: Option<&str>) -> crate::error::Result<()> { /* ... */ }
Function read_parquet_to_arrow
Reads a Parquet file as Arrow Float64Arrays.
Returns one array per row group for zero-copy access.
pub fn read_parquet_to_arrow<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<Vec<arrow::array::Float64Array>> { /* ... */ }
Function write_arrow_to_parquet
Writes an Arrow Float64Array to a Parquet file.
Arguments
path- Output file patharray- Array to writecolumn_name- Column name (defaults to "data")
pub fn write_arrow_to_parquet<P: AsRef<std::path::Path>>(path: P, array: &arrow::array::Float64Array, column_name: Option<&str>) -> crate::error::Result<()> { /* ... */ }
Function read_parquet_batch
Reads batch data from a Parquet file with List<Float64> column format.
Returns flattened data suitable for batch encoding.
Returns
Tuple of (flattened_data, num_samples, sample_size)
TODO
Add OOM protection for very large files
pub fn read_parquet_batch<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<(Vec<f64>, usize, usize)> { /* ... */ }
Function read_arrow_ipc_batch
Reads batch data from an Arrow IPC file.
Supports FixedSizeList<Float64> and List<Float64> column formats.
Returns flattened data suitable for batch encoding.
Returns
Tuple of (flattened_data, num_samples, sample_size)
TODO
Add OOM protection for very large files
pub fn read_arrow_ipc_batch<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<(Vec<f64>, usize, usize)> { /* ... */ }
Function read_numpy_batch
Reads batch data from a NumPy .npy file.
Expects a 2D array with shape [num_samples, sample_size] and dtype float64.
Returns flattened data suitable for batch encoding.
Returns
Tuple of (flattened_data, num_samples, sample_size)
Example
let (data, num_samples, sample_size) = read_numpy_batch("quantum_states.npy")?;
pub fn read_numpy_batch<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<(Vec<f64>, usize, usize)> { /* ... */ }
Function read_torch_batch
Reads batch data from a PyTorch .pt/.pth file.
Expects a 1D or 2D tensor saved with torch.save.
Returns flattened data suitable for batch encoding.
Requires the pytorch feature to be enabled.
Returns
Tuple of (flattened_data, num_samples, sample_size)
pub fn read_torch_batch<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<(Vec<f64>, usize, usize)> { /* ... */ }
Function read_tensorflow_batch
Reads batch data from a TensorFlow TensorProto file.
Supports Float64 tensors with shape [batch_size, feature_size] or [n].
Prefers tensor_content for efficient parsing, but still requires one copy to Vec
Byte Order
Assumes little-endian byte order (standard on x86_64).
Returns
Tuple of (flattened_data, num_samples, sample_size)
TODO
Add OOM protection for very large files
pub fn read_tensorflow_batch<P: AsRef<std::path::Path>>(path: P) -> crate::error::Result<(Vec<f64>, usize, usize)> { /* ... */ }
Module preprocessing
pub mod preprocessing { /* ... */ }
Types
Struct Preprocessor
Shared CPU-based pre-processing pipeline for quantum encoding.
Centralizes validation, normalization, and data preparation steps to ensure consistency across different encoding strategies and backends.
pub struct Preprocessor;
Implementations
Methods
-
pub fn validate_input(host_data: &[f64], num_qubits: usize) -> Result<()> { /* ... */ }Validates standard quantum input constraints.
-
pub fn calculate_l2_norm(host_data: &[f64]) -> Result<f64> { /* ... */ }Calculates L2 norm of the input data in parallel on the CPU.
-
pub fn validate_batch(batch_data: &[f64], num_samples: usize, sample_size: usize, num_qubits: usize) -> Result<()> { /* ... */ }Validates input constraints for batch processing.
-
pub fn calculate_batch_l2_norms(batch_data: &[f64], _num_samples: usize, sample_size: usize) -> Result<Vec<f64>> { /* ... */ }Calculates L2 norms for a batch of samples in parallel.
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module reader
Generic data reader interface for multiple input formats.
This module provides a trait-based architecture for reading quantum data from various sources (Parquet, Arrow IPC, NumPy, PyTorch, etc.) in a unified way without sacrificing performance or memory efficiency.
Architecture
The reader system is based on two main traits:
- [
DataReader]: Basic interface for batch reading - [
StreamingDataReader]: Extended interface for chunk-by-chunk streaming
Example: Adding a New Format
To add support for a new format (e.g., NumPy):
use qdp_core::reader::{DataReader, Result};
pub struct NumpyReader {
// format-specific fields
}
impl DataReader for NumpyReader {
fn read_batch(&mut self) -> Result<(Vec<f64>, usize, usize)> {
// implementation
}
}
pub mod reader { /* ... */ }
Traits
Trait DataReader
Generic data reader interface for batch quantum data.
Implementations should read data in the format:
- Flattened batch data (all samples concatenated)
- Number of samples
- Sample size (elements per sample)
This interface enables zero-copy streaming where possible and maintains memory efficiency for large datasets.
pub trait DataReader {
/* Associated items */
}
Required Items
Required Methods
read_batch: Read all data from the source.
Provided Methods
-
fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ }Get the sample size if known before reading.
-
fn get_num_samples(self: &Self) -> Option<usize> { /* ... */ }Get the total number of samples if known before reading.
Implementations
This trait is implemented for the following types:
ArrowIPCReaderNumpyReaderParquetReaderParquetStreamingReaderTensorFlowReaderTorchReader
Trait StreamingDataReader
Streaming data reader interface for large datasets.
This trait enables chunk-by-chunk reading for datasets that don't fit in memory, maintaining constant memory usage regardless of file size.
pub trait StreamingDataReader: DataReader {
/* Associated items */
}
Required Items
Required Methods
read_chunk: Read a chunk of data into the provided buffer.total_rows: Get the total number of rows/samples in the data source.
Implementations
This trait is implemented for the following types:
ParquetStreamingReader
Module readers
Format-specific data reader implementations.
This module contains concrete implementations of the [DataReader] and
[StreamingDataReader] traits for various file formats.
Fully Implemented Formats
- Parquet: [
ParquetReader], [ParquetStreamingReader] - Arrow IPC: [
ArrowIPCReader] - NumPy: [
NumpyReader] - TensorFlow TensorProto: [
TensorFlowReader] - PyTorch: [
TorchReader] (feature:pytorch)
pub mod readers { /* ... */ }
Modules
Module arrow_ipc
Arrow IPC format reader implementation.
pub mod arrow_ipc { /* ... */ }
Types
Struct ArrowIPCReader
Reader for Arrow IPC files containing FixedSizeList
pub struct ArrowIPCReader {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
Create a new Arrow IPC reader.
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self> { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
DataReader
-
fn read_batch(self: &mut Self) -> Result<(Vec<f64>, usize, usize)> { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module numpy
NumPy format reader implementation.
Provides support for reading .npy files containing 2D float64 arrays.
pub mod numpy { /* ... */ }
Types
Struct NumpyReader
Reader for NumPy .npy files containing 2D float64 arrays.
Expected Format
- 2D array with shape
[num_samples, sample_size] - Data type:
float64 - Fortran (column-major) or C (row-major) order supported
Example
use qdp_core::reader::DataReader;
use qdp_core::readers::NumpyReader;
let mut reader = NumpyReader::new("data.npy").unwrap();
let (data, num_samples, sample_size) = reader.read_batch().unwrap();
println!("Read {} samples of size {}", num_samples, sample_size);
pub struct NumpyReader {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
Create a new NumPy reader.
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self> { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
DataReader
-
fn read_batch(self: &mut Self) -> Result<(Vec<f64>, usize, usize)> { /* ... */ } -
fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ } -
fn get_num_samples(self: &Self) -> Option<usize> { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module parquet
Parquet format reader implementation.
pub mod parquet { /* ... */ }
Types
Struct ParquetReader
Reader for Parquet files containing List
pub struct ParquetReader {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
Create a new Parquet reader.
pub fn new<P: AsRef<Path>>(path: P, batch_size: Option<usize>) -> Result<Self> { /* ... */ }
Trait Implementations
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
DataReader
-
fn read_batch(self: &mut Self) -> Result<(Vec<f64>, usize, usize)> { /* ... */ } -
fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ } -
fn get_num_samples(self: &Self) -> Option<usize> { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct ParquetStreamingReader
Streaming Parquet reader for List
Reads Parquet files in chunks without loading entire file into memory. Supports efficient streaming for large files via Producer-Consumer pattern.
pub struct ParquetStreamingReader {
pub total_rows: usize,
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
total_rows | usize | |
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new<P: AsRef<Path>>(path: P, batch_size: Option<usize>) -> Result<Self> { /* ... */ }Create a new streaming Parquet reader.
-
pub fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ }Get the sample size (number of elements per sample).
Trait Implementations
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
DataReader
-
fn read_batch(self: &mut Self) -> Result<(Vec<f64>, usize, usize)> { /* ... */ } -
fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ } -
fn get_num_samples(self: &Self) -> Option<usize> { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
StreamingDataReader
-
fn read_chunk(self: &mut Self, buffer: &mut [f64]) -> Result<usize> { /* ... */ } -
fn total_rows(self: &Self) -> usize { /* ... */ }
-
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module tensorflow
TensorFlow TensorProto format reader implementation.
pub mod tensorflow { /* ... */ }
Types
Struct TensorFlowReader
Reader for TensorFlow TensorProto files.
Supports Float64 tensors with shape [batch_size, feature_size] or [n].
Prefers tensor_content for efficient parsing, but still requires one copy to Vec
Byte Order
This implementation assumes little-endian byte order, which is the standard on x86_64 platforms. TensorFlow typically uses host byte order.
pub struct TensorFlowReader {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
Create a new TensorFlow reader from a file path.
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self> { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
DataReader
-
fn read_batch(self: &mut Self) -> Result<(Vec<f64>, usize, usize)> { /* ... */ } -
fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ } -
fn get_num_samples(self: &Self) -> Option<usize> { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Module torch
PyTorch tensor reader implementation.
Supports .pt/.pth files containing a single tensor saved with torch.save.
The tensor must be 1D or 2D and will be converted to float64.
Requires the pytorch feature to be enabled.
pub mod torch { /* ... */ }
Types
Struct TorchReader
Reader for PyTorch .pt/.pth tensor files.
pub struct TorchReader {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
Create a new PyTorch reader.
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self> { /* ... */ }
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
DataReader
-
fn read_batch(self: &mut Self) -> Result<(Vec<f64>, usize, usize)> { /* ... */ } -
fn get_sample_size(self: &Self) -> Option<usize> { /* ... */ } -
fn get_num_samples(self: &Self) -> Option<usize> { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Re-exports
Re-export ArrowIPCReader
pub use arrow_ipc::ArrowIPCReader;
Re-export NumpyReader
pub use numpy::NumpyReader;
Re-export ParquetReader
pub use parquet::ParquetReader;
Re-export ParquetStreamingReader
pub use parquet::ParquetStreamingReader;
Re-export TensorFlowReader
pub use tensorflow::TensorFlowReader;
Re-export TorchReader
pub use torch::TorchReader;
Module tf_proto
TensorFlow TensorProto protobuf definitions.
This module contains the generated protobuf code for TensorFlow TensorProto format.
The code is generated at build time by prost-build from proto/tensor.proto.
pub mod tf_proto { /* ... */ }
Modules
Module tensorflow
pub mod tensorflow { /* ... */ }
Types
Struct TensorProto
Attributes:
Other("#[allow(clippy::derive_partial_eq_without_eq)]")
TensorProto - only define necessary fields, field numbers match TensorFlow official
pub struct TensorProto {
pub dtype: i32,
pub tensor_shape: ::core::option::Option<TensorShapeProto>,
pub tensor_content: ::prost::bytes::Bytes,
pub double_val: ::prost::alloc::vec::Vec<f64>,
}
Fields
| Name | Type | Documentation |
|---|---|---|
dtype | i32 | Field 1: dtype (enum DataType in TF, but varint in wire format) DT_DOUBLE = 2 (see tensorflow/core/framework/types.proto) |
tensor_shape | ::core::option::Option<TensorShapeProto> | Field 2: tensor_shape |
tensor_content | ::prost::bytes::Bytes | Field 4: tensor_content (preferred for efficient parsing) |
double_val | ::prost::alloc::vec::Vec<f64> | Field 6: double_val (fallback, only used when tensor_content is empty) |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> TensorProto { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Debug
-
fn fmt(self: &Self, f: &mut ::core::fmt::Formatter<''_>) -> ::core::fmt::Result { /* ... */ }
-
-
Default
-
fn default() -> Self { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Message
-
fn encoded_len(self: &Self) -> usize { /* ... */ } -
fn clear(self: &mut Self) { /* ... */ }
-
-
PartialEq
-
fn eq(self: &Self, other: &TensorProto) -> bool { /* ... */ }
-
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
StructuralPartialEq
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct TensorShapeProto
Attributes:
Other("#[allow(clippy::derive_partial_eq_without_eq)]")
pub struct TensorShapeProto {
pub dim: ::prost::alloc::vec::Vec<Dim>,
pub unknown_rank: bool,
}
Fields
| Name | Type | Documentation |
|---|---|---|
dim | ::prost::alloc::vec::Vec<Dim> | Field 2: dim (field number matches official) |
unknown_rank | bool | Field 3: unknown_rank (optional; helps with better error messages) |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> TensorShapeProto { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Debug
-
fn fmt(self: &Self, f: &mut ::core::fmt::Formatter<''_>) -> ::core::fmt::Result { /* ... */ }
-
-
Default
-
fn default() -> Self { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Message
-
fn encoded_len(self: &Self) -> usize { /* ... */ } -
fn clear(self: &mut Self) { /* ... */ }
-
-
PartialEq
-
fn eq(self: &Self, other: &TensorShapeProto) -> bool { /* ... */ }
-
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
StructuralPartialEq
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Struct Dim
Attributes:
Other("#[allow(clippy::derive_partial_eq_without_eq)]")
pub struct Dim {
pub size: i64,
}
Fields
| Name | Type | Documentation |
|---|---|---|
size | i64 | Field 1: size Skip name field (field number 2) to reduce parsing overhead |
Implementations
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> Dim { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Debug
-
fn fmt(self: &Self, f: &mut ::core::fmt::Formatter<''_>) -> ::core::fmt::Result { /* ... */ }
-
-
Default
-
fn default() -> Self { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Message
-
fn encoded_len(self: &Self) -> usize { /* ... */ } -
fn clear(self: &mut Self) { /* ... */ }
-
-
PartialEq
-
fn eq(self: &Self, other: &Dim) -> bool { /* ... */ }
-
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
StructuralPartialEq
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Types
Struct QdpEngine
Main entry point for Mahout QDP
Manages GPU context and dispatches encoding tasks. Provides unified interface for device management, memory allocation, and DLPack.
pub struct QdpEngine {
// Some fields omitted
}
Fields
| Name | Type | Documentation |
|---|---|---|
| private fields | ... | Some fields have been omitted |
Implementations
Methods
-
pub fn new(device_id: usize) -> Result<Self> { /* ... */ }Initialize engine on GPU device
-
pub fn new_with_precision(device_id: usize, precision: Precision) -> Result<Self> { /* ... */ }Initialize engine with explicit precision.
-
pub fn encode(self: &Self, data: &[f64], num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Encode classical data into quantum state
-
pub fn device(self: &Self) -> &CudaDevice { /* ... */ }Get CUDA device reference for advanced operations
-
pub fn synchronize(self: &Self) -> Result<()> { /* ... */ }Block until all GPU work on the default stream has completed.
-
pub fn encode_batch(self: &Self, batch_data: &[f64], num_samples: usize, sample_size: usize, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Encode multiple samples in a single fused kernel (most efficient)
-
pub fn run_dual_stream_encode(self: &Self, host_data: &[f64], num_qubits: usize, encoding_method: &str) -> Result<()> { /* ... */ }Run dual-stream pipeline for encoding (H2D + kernel overlap). Exposes gpu::pipeline::run_dual_stream_pipeline.
-
pub fn encode_from_parquet(self: &Self, path: &str, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Streaming Parquet encoder with multi-threaded IO
-
pub fn encode_from_arrow_ipc(self: &Self, path: &str, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Load data from Arrow IPC file and encode into quantum state
-
pub fn encode_from_numpy(self: &Self, path: &str, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Load data from NumPy .npy file and encode into quantum state
-
pub fn encode_from_torch(self: &Self, path: &str, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Load data from PyTorch .pt/.pth file and encode into quantum state
-
pub fn encode_from_tensorflow(self: &Self, path: &str, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Load data from TensorFlow TensorProto file and encode into quantum state
-
pub unsafe fn encode_from_gpu_ptr(self: &Self, input_d: *const std::ffi::c_void, input_len: usize, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Encode from existing GPU pointer (zero-copy for CUDA tensors)
-
pub unsafe fn encode_from_gpu_ptr_with_stream(self: &Self, input_d: *const std::ffi::c_void, input_len: usize, num_qubits: usize, encoding_method: &str, stream: *mut std::ffi::c_void) -> Result<*mut DLManagedTensor> { /* ... */ }Encode from existing GPU pointer with a specific CUDA stream.
-
pub unsafe fn encode_from_gpu_ptr_f32(self: &Self, input_d: *const f32, input_len: usize, num_qubits: usize) -> Result<*mut DLManagedTensor> { /* ... */ }Encode from existing GPU pointer (float32 input, amplitude encoding only)
-
pub unsafe fn encode_from_gpu_ptr_f32_with_stream(self: &Self, input_d: *const f32, input_len: usize, num_qubits: usize, stream: *mut c_void) -> Result<*mut DLManagedTensor> { /* ... */ }Encode from existing GPU pointer (float32) on a specified CUDA stream.
-
pub unsafe fn encode_batch_from_gpu_ptr(self: &Self, input_batch_d: *const std::ffi::c_void, num_samples: usize, sample_size: usize, num_qubits: usize, encoding_method: &str) -> Result<*mut DLManagedTensor> { /* ... */ }Encode batch from existing GPU pointer (zero-copy for CUDA tensors)
-
pub unsafe fn encode_batch_from_gpu_ptr_with_stream(self: &Self, input_batch_d: *const std::ffi::c_void, num_samples: usize, sample_size: usize, num_qubits: usize, encoding_method: &str, stream: *mut std::ffi::c_void) -> Result<*mut DLManagedTensor> { /* ... */ }Encode batch from existing GPU pointer with a specific CUDA stream.
Trait Implementations
-
Allocation
-
Any
-
fn type_id(self: &Self) -> TypeId { /* ... */ }
-
-
Borrow
-
fn borrow(self: &Self) -> &T { /* ... */ }
-
-
BorrowMut
-
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
-
-
Clone
-
fn clone(self: &Self) -> QdpEngine { /* ... */ }
-
-
CloneToUninit
-
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
-
-
Freeze
-
From
-
Returns the argument unchanged.
fn from(t: T) -> T { /* ... */ }
-
-
Into
-
Calls
fn into(self: Self) -> U { /* ... */ }U::from(self).
-
-
IntoEither
-
Pointable
-
unsafe fn init(init: <T as Pointable>::Init) -> usize { /* ... */ } -
unsafe fn deref<''a>(ptr: usize) -> &''a T { /* ... */ } -
unsafe fn deref_mut<''a>(ptr: usize) -> &''a mut T { /* ... */ } -
unsafe fn drop(ptr: usize) { /* ... */ }
-
-
RefUnwindSafe
-
Send
-
Sync
-
ToOwned
-
fn to_owned(self: &Self) -> T { /* ... */ } -
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
-
-
TryFrom
-
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
-
-
TryInto
-
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
-
-
Unpin
-
UnwindSafe
Macros
Macro profile_scope
Attributes:
Other("#[attr = CfgTrace([Not(NameValue { name: \"feature\", value: Some(\"observability\"), span: qdp-core/src/profiling.rs:46:11: 46:36 (#0) }, qdp-core/src/profiling.rs:46:10: 46:37 (#0))])]")MacroExport
No-op version when observability is disabled
Compiler eliminates this completely, zero runtime cost.
pub macro_rules! profile_scope {
/* macro_rules! profile_scope {
($name:expr) => { ... };
} */
}
Macro profile_mark
Attributes:
Other("#[attr = CfgTrace([Not(NameValue { name: \"feature\", value: Some(\"observability\"), span: qdp-core/src/profiling.rs:71:11: 71:36 (#0) }, qdp-core/src/profiling.rs:71:10: 71:37 (#0))])]")MacroExport
No-op version when observability is disabled
pub macro_rules! profile_mark {
/* macro_rules! profile_mark {
($name:expr) => { ... };
} */
}
Re-exports
Re-export MahoutError
pub use error::MahoutError;
Re-export Result
pub use error::Result;
Re-export cuda_error_to_string
pub use error::cuda_error_to_string;
Re-export Precision
pub use gpu::memory::Precision;
Re-export DataSource
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/lib.rs:42:7: 42:26 (#0) }])]")
pub use pipeline_runner::DataSource;
Re-export PipelineConfig
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/lib.rs:42:7: 42:26 (#0) }])]")
pub use pipeline_runner::PipelineConfig;
Re-export PipelineIterator
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/lib.rs:42:7: 42:26 (#0) }])]")
pub use pipeline_runner::PipelineIterator;
Re-export PipelineRunResult
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/lib.rs:42:7: 42:26 (#0) }])]")
pub use pipeline_runner::PipelineRunResult;
Re-export run_latency_pipeline
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/lib.rs:42:7: 42:26 (#0) }])]")
pub use pipeline_runner::run_latency_pipeline;
Re-export run_throughput_pipeline
Attributes:
Other("#[attr = CfgTrace([NameValue { name: \"target_os\", value: Some(\"linux\"), span: qdp-core/src/lib.rs:42:7: 42:26 (#0) }])]")
pub use pipeline_runner::run_throughput_pipeline;
Re-export QuantumEncoder
pub use gpu::QuantumEncoder;