Gpu 0.1.0 devicetextblock upload - CyrilB1531/lodestar GitHub Wiki

Lodestar.Gpu 0.1.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

DeviceTextBlock.Upload

Renames a batch against a pattern's alphabet and uploads it.

public static DeviceTextBlock Upload(GpuContext context, string pattern, IReadOnlyList<string> texts)

Parameterscontext is the accelerator to upload to. pattern is the string whose characters define the alphabet; the batch is renamed against it and can only be scored against it. texts are the strings to rename, none null.

ReturnsDeviceTextBlock, owning two device buffers the caller disposes.

ExceptionsArgumentNullException when an argument, or one of the texts, is null; ArgumentException when texts is empty, or the pattern holds more than 255 distinct characters.

Example — the shape a caller writes.

using Lodestar.Gpu.Compute;

using var context = GpuContext.Create(preferCpu: true);
using var block = DeviceTextBlock.Upload(context, "abc", ["abc", "abd", ""]);

int held = block.Count;  // => 3

Remarksthe block remembers the alphabet it was renamed with, and BitParallelEditDistance.Distance refuses a pattern holding a character that alphabet never saw. Without that check such a character would silently rename to the reserved code, the kernel would treat it as matching nothing, and the answer would come back plausible and wrong.

An empty string in the batch is legal and scores the pattern's length, which is the right answer. An empty batch is refused, because there is nothing to launch a kernel over.

Applies to — net10.0, netstandard2.1.

See alsoDeviceTextBlock.

⚠️ **GitHub.com Fallback** ⚠️