pub trait Runtime: Send + Sync {
type Buffer: RuntimeBuffer;
// Required methods
fn capabilities(&self) -> RuntimeCapabilities;
fn zeros(&self, length: usize) -> Result<Self::Buffer>;
fn upload(&self, values: &[Complex64]) -> Result<Self::Buffer>;
fn to_host(&self, buffer: &Self::Buffer) -> Result<Vec<Complex64>>;
fn fill(&self, buffer: &mut Self::Buffer, value: Complex64) -> Result<()>;
fn axpy(
&self,
alpha: Complex64,
input: &Self::Buffer,
output: &mut Self::Buffer,
) -> Result<()>;
fn scale(&self, alpha: Complex64, buffer: &mut Self::Buffer) -> Result<()>;
fn dotc(
&self,
left: &Self::Buffer,
right: &Self::Buffer,
) -> Result<Complex64>;
// Provided method
fn norm(&self, buffer: &Self::Buffer) -> Result<f64> { ... }
}Expand description
Coarse-grained storage and vector primitives required by iterative methods.
A future GPU or MPI backend implements this trait with its native buffer. No basis, model, or operator-string type crosses this boundary.
Required Associated Types§
Sourcetype Buffer: RuntimeBuffer
type Buffer: RuntimeBuffer
Backend-native vector type.
Required Methods§
Sourcefn capabilities(&self) -> RuntimeCapabilities
fn capabilities(&self) -> RuntimeCapabilities
Report the execution resources supplied by this runtime.
Sourcefn upload(&self, values: &[Complex64]) -> Result<Self::Buffer>
fn upload(&self, values: &[Complex64]) -> Result<Self::Buffer>
Copy a host slice into backend-owned storage.
Sourcefn to_host(&self, buffer: &Self::Buffer) -> Result<Vec<Complex64>>
fn to_host(&self, buffer: &Self::Buffer) -> Result<Vec<Complex64>>
Copy backend-owned storage to the host.
Sourcefn fill(&self, buffer: &mut Self::Buffer, value: Complex64) -> Result<()>
fn fill(&self, buffer: &mut Self::Buffer, value: Complex64) -> Result<()>
Fill a backend buffer with one complex value.
Sourcefn axpy(
&self,
alpha: Complex64,
input: &Self::Buffer,
output: &mut Self::Buffer,
) -> Result<()>
fn axpy( &self, alpha: Complex64, input: &Self::Buffer, output: &mut Self::Buffer, ) -> Result<()>
Compute output += alpha * input.