warp.sparse.bsr_set_from_mapped_values#

warp.sparse.bsr_set_from_mapped_values(dest, mapping, values, reduction='gather')[source]#

Set BSR values using a precomputed value-to-topology mapping.

Unlike bsr_set_from_triplets(), this function does no symbolic topology work. reduction="gather" assigns one thread per destination block coefficient and is atomic-free; it sums duplicate entries in the same order as bsr_set_from_triplets(). reduction="atomic" assigns one thread per input value coefficient.

The gather launch is dimensioned by the host-side dest.nnz upper bound. Calling BsrMatrix.nnz_sync() once after building the map, outside of graph capture, tightens that bound for all subsequent calls.

Parameters:
  • dest (BsrMatrix[BlockType[Rows, Cols, Scalar]]) – Matrix whose topology was used to build mapping.

  • mapping (BsrTripletMap) – Reusable map built by bsr_set_from_triplets() through its build_mapping argument.

  • values (Array[Scalar | BlockType[Rows, Cols, Scalar]]) – Contiguous array containing the current numerical value for every mapped input.

  • reduction (Literal['gather', 'atomic']) – Numerical duplicate-reduction strategy.

Return type:

None