pub struct PartitionedCsr {
pub partitions: Vec<GpuCsrMatrix>,
pub row_offsets: Vec<usize>,
pub halo_rows: Vec<Vec<usize>>,
pub n_total_rows: usize,
pub n_cols: usize,
/* private fields */
}Expand description
A CSR matrix partitioned across multiple logical workers using a row-striped decomposition with optional halo rows.
Each entry of partitions holds the local matrix for that worker,
which covers [partition_row_start[w], partition_row_start[w] + partitions[w].n_rows).
Fields§
§partitions: Vec<GpuCsrMatrix>Local matrix per worker (may include halo rows at the boundaries).
row_offsets: Vec<usize>Global row index of the first owned (non-halo) row for each worker.
halo_rows: Vec<Vec<usize>>For each worker: the list of global row indices that are ghost rows (owned by another worker but needed by this worker).
n_total_rows: usizeTotal number of rows in the original matrix.
n_cols: usizeNumber of columns in the original matrix.
Implementations§
Source§impl PartitionedCsr
impl PartitionedCsr
Sourcepub fn from_csr(matrix: &GpuCsrMatrix, config: &DistributedCsrConfig) -> Self
pub fn from_csr(matrix: &GpuCsrMatrix, config: &DistributedCsrConfig) -> Self
Partition matrix into config.n_workers pieces using a row-striped
decomposition.
Each partition gets its owned rows plus up to config.overlap halo
rows from each adjacent partition.
Sourcepub fn spmv(&self, x: &[f64]) -> SparseResult<Vec<f64>>
pub fn spmv(&self, x: &[f64]) -> SparseResult<Vec<f64>>
Compute y = A * x using the distributed representation.
Each worker computes SpMV on its local matrix (which includes halo rows) and contributes only the owned rows to the global result.
§Errors
Returns SparseError::DimensionMismatch when x.len() != n_cols.
Sourcepub fn to_csr(&self) -> GpuCsrMatrix
pub fn to_csr(&self) -> GpuCsrMatrix
Reassemble all partitions’ owned rows into a single GpuCsrMatrix.
Sourcepub fn load_balance_quality(&self) -> f64
pub fn load_balance_quality(&self) -> f64
Measure load balance quality.
Returns std_dev(nnz_per_partition) / mean(nnz_per_partition).
A value of 0.0 means perfect balance; lower is better.
Returns 0.0 for degenerate cases (0 or 1 workers, or 0 total nnz).
Trait Implementations§
Source§impl Clone for PartitionedCsr
impl Clone for PartitionedCsr
Source§fn clone(&self) -> PartitionedCsr
fn clone(&self) -> PartitionedCsr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PartitionedCsr
impl RefUnwindSafe for PartitionedCsr
impl Send for PartitionedCsr
impl Sync for PartitionedCsr
impl Unpin for PartitionedCsr
impl UnsafeUnpin for PartitionedCsr
impl UnwindSafe for PartitionedCsr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more