|
cuDDL
|
Move-only owning DDL sketch backed by one contiguous device allocation. More...
Public Types | |
| using | layout_type = Layout |
| using | register_type = uint32_t |
Public Member Functions | |
| sketch (cuda::stream_ref stream, std::optional< std::shared_ptr< device_blacklist const > > blacklist=std::nullopt) | |
| Allocates and clears the sketch. | |
| sketch (sketch const &)=delete | |
| sketch & | operator= (sketch const &)=delete |
| sketch (sketch &&) noexcept=default | |
| sketch & | operator= (sketch &&) noexcept=default |
| Move-assigns the sketch, leaving the source empty. | |
| device_span< register_type > | data () noexcept |
| Device registers. | |
| device_span< register_type const > | data () const noexcept |
| Device registers. | |
| std::optional< uint64_t > | added () const noexcept |
| k-mers offered through this sketch's own add paths since the last clear. | |
| Result< void > | clear_async (cuda::stream_ref stream) const noexcept |
| Resets every register to zero without synchronising. | |
| Result< void > | clear (cuda::stream_ref stream) const noexcept |
| Resets every register to zero, then synchronises. | |
| Result< void > | assign_async (device_span< register_type const > registers, cuda::stream_ref stream, kmer_blacklist const &source_blacklist) const noexcept |
| Overwrites the registers from stored words. | |
| Result< void > | add_async (device_span< uint64_t const > input, cuda::stream_ref stream) const noexcept |
| Adds packed device k-mers to the existing sketch without clearing it. | |
| Result< void > | add (device_span< uint64_t const > input, cuda::stream_ref stream) const noexcept |
| Adds packed device k-mers without clearing, then synchronizes the stream. | |
| Result< void > | add_sequence_async (device_span< char const > sequence, cuda::stream_ref stream) const noexcept |
| Adds device-resident raw ASCII bases without clearing. | |
| Result< void > | add_sequence (device_span< char const > sequence, cuda::stream_ref stream) const noexcept |
| Adds device-resident raw ASCII bases without clearing, then synchronizes. | |
| template<bool IncludeCardinality = false> | |
| Result< void > | summary_async (sketch const &other, pairwise_summary &output, cuda::stream_ref stream) const noexcept |
| Computes a fused pairwise summary into caller-owned device storage. | |
| Result< void > | compare_async (sketch const &other, pairwise_summary &output, cuda::stream_ref stream) const noexcept |
| Computes raw pairwise counts into caller-owned device storage. | |
| template<bool IncludeCardinality = false> | |
| Result< pairwise_summary > | summary (sketch const &other, cuda::stream_ref stream) const |
| Host-side fused pairwise summary (uses mapped scratch, synchronises). | |
| Result< pairwise_summary > | compare (sketch const &other, cuda::stream_ref stream) const |
Raw pairwise counts against other (host result). | |
| Result< void > | cardinality_async (uint64_t *empty_out, double *estimate_out, cuda::stream_ref stream) const noexcept |
| Computes this sketch's hybridDDL cardinality reduction on the GPU. | |
| Result< double > | cardinality (cuda::stream_ref stream) const |
| Host-side cardinality estimate for this sketch, capped at added. | |
| Result< hybrid_cardinality_estimates > | hybrid_cardinality (cuda::stream_ref stream) const |
| Experimental BBTools and paper-style HybridDDL estimates for comparison. | |
Static Public Member Functions | |
| static constexpr size_t | bucket_count () noexcept |
| Number of registers in the sketch. | |
| static constexpr uint32_t | kmer_length () noexcept |
| Compile-time k-mer length. | |
| static std::optional< double > | wkid (pairwise_summary const &summary) noexcept |
| Weighted k-mer identity from a raw pair summary. | |
| static std::optional< double > | ani (pairwise_summary const &summary) noexcept |
| Average nucleotide identity estimate from a raw pair summary. | |
| static std::optional< double > | containment (pairwise_summary const &summary) noexcept |
| Fraction of the left sketch's content shared with the right sketch. | |
| static std::optional< double > | completeness (pairwise_summary const &summary) noexcept |
Relative cardinality of the left sketch to the right sketch, clamped to [0, 1]. | |
Move-only owning DDL sketch backed by one contiguous device allocation.
The device allocation holds BucketCount uint32_t registers, each holding its bucket's winning score. A separate mapped pinned-host scratch area receives small synchronous results without a device-to-host copy.
The sketch also counts the k-mers offered through its own add paths, and cardinality and hybrid_cardinality cap their estimates at that count: a sketch never reports more distinct k-mers than it was given.
Definition at line 63 of file sketch.cuh.
| using cuddl::sketch< K, BucketCount, Layout >::layout_type = Layout |
Definition at line 65 of file sketch.cuh.
| using cuddl::sketch< K, BucketCount, Layout >::register_type = uint32_t |
Definition at line 66 of file sketch.cuh.
|
inlineexplicit |
Allocates and clears the sketch.
Throws on allocation failure. The allocation stream must outlive the sketch. Complete work on other streams before destroying or move-assigning the sketch, as required by cuda::buffer.
Definition at line 71 of file sketch.cuh.
|
delete |
|
defaultnoexcept |
|
inlinenoexcept |
Adds packed device k-mers without clearing, then synchronizes the stream.
The caller can reuse the input buffer for the next chunk after this returns successfully.
Definition at line 213 of file sketch.cuh.
|
inlinenoexcept |
Adds packed device k-mers to the existing sketch without clearing it.
Call repeatedly to accumulate successive chunks. Empty input is a no-op. Keep input alive and unchanged until the stream completes. Use clear() to reset. When chunking raw sequence before packing, preserve the K-1 boundary bases and emit each k-mer window exactly once; this API receives already-packed canonical k-mers. Every offered k-mer raises added, including blacklisted ones, so it remains an upper bound.
Definition at line 200 of file sketch.cuh.
|
inlinenoexcept |
Adds device-resident raw ASCII bases without clearing, then synchronizes.
Same input limits as add_sequence_async (raw ASCII, UINT32_MAX window cap, no cross-record overlap). The caller can reuse the input buffer for the next chunk after this returns successfully.
Definition at line 247 of file sketch.cuh.
|
inlinenoexcept |
Adds device-resident raw ASCII bases without clearing.
Expects raw contiguous ASCII (no FASTA/newline stripping). Canonicalises case-insensitively with the packed path; ambiguity breaks windows and emits no k-mer across it. Accumulates without reset; short input below K is a no-op. Windows per call are capped at UINT32_MAX, so size must not exceed UINT32_MAX + K - 1. No hidden carry: callers supply the K-1 overlap within one record and no overlap between distinct records. No host copies. Keep input alive and unchanged until the stream completes. Use clear() to reset. Every window the call offers raises added, whether or not an ambiguous base makes the kernel drop it, so the count stays an upper bound.
Definition at line 231 of file sketch.cuh.
|
inlinenoexcept |
k-mers offered through this sketch's own add paths since the last clear.
Every k-mer handed to add_async or add_sequence_async counts, duplicates included, so this is an upper bound on the distinct k-mer count rather than an estimate of it, and cardinality caps its estimate at it. std::nullopt means the registers arrived outside those paths, through assign_async or a write to data, so no count describes them and the estimate stays uncapped.
Definition at line 134 of file sketch.cuh.
|
inlinestaticnoexcept |
Average nucleotide identity estimate from a raw pair summary.
Definition at line 311 of file sketch.cuh.
|
inlinenoexcept |
Overwrites the registers from stored words.
Loads a sketch from registers produced elsewhere, for example a saved reference database or a streamed tile build. Nothing is cleared or merged; the sketch's contents become exactly registers. The stored words carry no element count, so the sketch forgets its own and stops capping estimates. Supply the source construction blacklist, or {} for unfiltered words. It must match this sketch's fixed policy.
Definition at line 165 of file sketch.cuh.
|
inlinestaticconstexprnoexcept |
Number of registers in the sketch.
Definition at line 118 of file sketch.cuh.
|
inline |
Host-side cardinality estimate for this sketch, capped at added.
Definition at line 361 of file sketch.cuh.
|
inlinenoexcept |
Computes this sketch's hybridDDL cardinality reduction on the GPU.
The raw estimator value, without the added cap: cardinality is the capped form, and this is what a caller comparing against the estimator itself wants.
Definition at line 352 of file sketch.cuh.
|
inlinenoexcept |
Resets every register to zero, then synchronises.
Definition at line 151 of file sketch.cuh.
|
inlinenoexcept |
Resets every register to zero without synchronising.
Resets the offered k-mer count, so the next estimate is capped at what the sketch is given after this call. The caller must keep the sketch alive until stream completes.
Definition at line 142 of file sketch.cuh.
|
inline |
Raw pairwise counts against other (host result).
Definition at line 293 of file sketch.cuh.
|
inlinenoexcept |
Computes raw pairwise counts into caller-owned device storage.
Definition at line 268 of file sketch.cuh.
|
inlinestaticnoexcept |
Relative cardinality of the left sketch to the right sketch, clamped to [0, 1].
BBTools completeness: (equal + higher) / (equal + lower); std::nullopt when the divisor is zero. This is a size-ratio estimate, not reverse containment.
Definition at line 336 of file sketch.cuh.
|
inlinestaticnoexcept |
Fraction of the left sketch's content shared with the right sketch.
equal / (equal + higher); std::nullopt when the divisor is zero.
Definition at line 322 of file sketch.cuh.
|
inlinenoexcept |
Device registers.
Definition at line 113 of file sketch.cuh.
|
inlinenoexcept |
Device registers.
Writing through this span bypasses the add paths, so the sketch can no longer relate its registers to an element count and forgets it.
Definition at line 107 of file sketch.cuh.
|
inline |
Experimental BBTools and paper-style HybridDDL estimates for comparison.
bbtools and paper are the estimates and are capped at added; the remaining members are the blend's raw inputs and keep the estimator's own values.
Definition at line 377 of file sketch.cuh.
|
inlinestaticconstexprnoexcept |
|
defaultnoexcept |
Move-assigns the sketch, leaving the source empty.
|
delete |
|
inline |
Host-side fused pairwise summary (uses mapped scratch, synchronises).
Definition at line 279 of file sketch.cuh.
|
inlinenoexcept |
Computes a fused pairwise summary into caller-owned device storage.
Definition at line 256 of file sketch.cuh.
|
inlinestaticnoexcept |
Weighted k-mer identity from a raw pair summary.
Pads non-zero divisors below six to suppress similarity from sparse random collisions. Returns std::nullopt when the divisor is zero.
Definition at line 301 of file sketch.cuh.