warp.optim.linear.MultiRHSOperator#
- class warp.optim.linear.MultiRHSOperator(A, nrhs, algorithm='auto')[source]#
Repeat one sparse matrix or linear operator over independent RHS rows.
This is a logical block-diagonal operator, with no duplicated matrix storage. Inputs to
matvecare contiguous flat scalar arrays representing(nrhs, n). Sparse matrices use the batchedwarp.sparse.bsr_mv()strategies; other operators are applied to each RHS row in turn. Exact aliases are supported; shifted output overlap and strided storage are rejected before launching.Each object owns its scratch.
with_nrhscreates smaller capacities sharing it. Eager applications issued from different CUDA streams are ordered with an event; simultaneously executing graphs that share scratch require caller ordering. Value updates in existing buffers are observed on replay; topology/address changes require recapture. No adjoint is supplied.- Parameters:
A – Square sparse matrix or a single-system
LinearOperator.nrhs (int) – Positive RHS count.
algorithm (Literal['auto', 'loop', 'rows', 'columns']) – Batched product strategy for a sparse
A, fixed at construction and kept bywith_nrhs:"auto","loop","rows"or"columns", as inwarp.sparse.bsr_mv()."auto"reads back the mean row length once, so unlike per-callwarp.sparse.bsr_mv()it can also choose"columns"for CSR rows averaging more than 16 entries. Explicit strategies pin a kernel and raiseValueErrorwhere unsupported. Other operators accept only"auto"or"loop". The chosen strategy is available asalgorithm.
Methods
with_nrhs(nrhs)Prepare a smaller capacity sharing scratch, strategy and stream ordering.
Attributes
batch_countNumber of independent subproblems.
batch_offsetsArray partitioning the active scalar degrees of freedom, or
None.deviceDevice on which computations involving the operator are performed.
dtypeType of the operator elements, such as a scalar type or a matrix block type.
matvecMatrix-vector multiplication function.
max_batch_lengthUpper bound on the number of scalar degrees of freedom in any subproblem, or
None.scalar_typeScalar component type of the operator's elements.
shapeNumber of rows and columns of the operator.
- with_nrhs(nrhs)[source]#
Prepare a smaller capacity sharing scratch, strategy and stream ordering.
- Parameters:
nrhs (int) – Positive capacity no greater than this operator’s
nrhs.- Returns:
A
MultiRHSOperatoracting onnrhsRHS rows.