-
Notifications
You must be signed in to change notification settings - Fork 0
Gpu devicesparsematrix
Development build. This page describes
main, not a released package. The latest published Lodestar.Gpu is 0.2.0 — read its documentation.
Home › Gpu › GPU kernels
A CSR matrix held on the accelerator across many products.
public sealed class DeviceSparseMatrix : IDisposableExample — the shape a caller writes.
using Lodestar.Gpu.Compute;
using var context = GpuContext.Create(preferCpu: true);
using var matrix = DeviceSparseMatrix.Upload(
context, [0, 1, 2], [0, 1], [2.0, 3.0], rowCount: 2, columnCount: 2);
int rows = matrix.RowCount; // => 2
int stored = matrix.NonZeroCount; // => 2Members — one page each.
| Member | What it does |
|---|---|
DeviceSparseMatrix.Upload |
Uploads a CSR matrix to the accelerator |
DeviceSparseMatrix.Dispose |
Frees the three device buffers |
Properties — RowCount, ColumnCount and NonZeroCount.
Remarks — the three CSR arrays are taken as spans rather than as a CsrMatrix.
Decision 0003
forbids an edge from a core package into this one, and an edge the other way would floor this
package on a published Lodestar.Abstractions for the sake of one type. A caller holding a
CsrMatrix passes its RowPointers, ColumnIndices and Values directly.
Double precision, because CsrMatrix is. A consumer card runs FP64 at a fraction of FP32, and
the kernel clears its gate anyway — it is bound by memory bandwidth rather than by the
double-precision units, which is the one prediction this package got wrong in the kernel's favour.
Applies to — net10.0, netstandard2.1.
See also — TiledSparseDenseProduct,
the namespace index.