|
cuSBF
|
GPU Super Bloom filter (defined in filter.cuh). More...
Public Types | |
| using | block_type = filter_block< Config > |
| One 256-bit filter block stored as an array of Config::blockWordCount words. | |
| using | Shard = block_type |
| Alias for block_type (one 256-bit shard). | |
Public Member Functions | |
| filter (uint64_t requestedFilterBits) | |
Constructs a Filter with at least requestedFilterBits bits of storage. | |
| filter (const filter &)=delete | |
| Non-copyable (owns device shard storage). | |
| filter & | operator= (const filter &)=delete |
| filter (filter &&) noexcept=default | |
| Move-constructs, transfers shard vectors and staging buffers. | |
| filter & | operator= (filter &&) noexcept=default |
| Move-assigns shard storage and staging buffers. | |
| ~filter ()=default | |
| Destroys device allocations and releases staging scratch. | |
| filter_ref< Config > | ref () const noexcept |
| Non-owning device reference to this filter's shard storage. | |
| Result< uint64_t > | insert_sequence (std::string_view sequence, cuda::stream_ref stream=cudaStream_t{}) |
| Inserts all valid k-mers from a host-resident sequence. | |
| Result< uint64_t > | insert_sequence_async (device_span< const char > d_sequence, cuda::stream_ref stream=cudaStream_t{}) |
| Async insert of k-mers from a device-resident sequence. | |
| Result< uint64_t > | insert_dense_packed_async (device_span< const uint64_t > d_words, uint64_t num_symbols, cuda::stream_ref stream=cudaStream_t{}) |
| Inserts all k-mers from a dense packed symbol buffer on the device. | |
| Result< uint64_t > | insert_dense_packed (std::span< const uint64_t > words, uint64_t num_symbols, cuda::stream_ref stream=cudaStream_t{}) |
| Inserts all k-mers from a host-resident dense packed symbol buffer. | |
| Result< void > | contains_dense_packed_async (device_span< const uint64_t > d_words, uint64_t num_symbols, device_span< uint8_t > d_output, cuda::stream_ref stream=cudaStream_t{}) const |
| Async query of k-mers from a dense packed symbol buffer on the device. | |
| Result< void > | contains_dense_packed (std::span< const uint64_t > words, uint64_t num_symbols, device_span< uint8_t > d_output, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all k-mers from a host-resident dense packed symbol buffer into device memory. | |
| Result< std::vector< uint8_t > > | contains_dense_packed (std::span< const uint64_t > words, uint64_t num_symbols, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all k-mers from a host-resident dense packed symbol buffer. | |
| constexpr uint64_t | dense_packed_kmer_count (uint64_t num_symbols) const |
Number of k-mer windows in a dense packed sequence of num_symbols symbols. | |
| Result< FastxInsertReport > | insert_record_batch (RecordBatchView batch, cuda::stream_ref stream=cudaStream_t{}) |
| Inserts a dense host-resident record batch. | |
| Result< uint64_t > | insert_record_batch_async (device_span< const char > d_sequence, std::span< const RecordRange > records, cuda::stream_ref stream=cudaStream_t{}) |
| Async insert of k-mers from a device-resident record batch. | |
| Result< FastxInsertReport > | insert_fastx (std::istream &input, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) |
| Inserts all k-mers from a FASTA/FASTQ input stream. | |
| Result< FastxInsertReport > | insert_fastx_file (const std::filesystem::path &path, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) |
| Inserts all k-mers from a FASTA/FASTQ file. | |
| Result< void > | contains_sequence_async (device_span< const char > d_sequence, device_span< uint8_t > d_output, cuda::stream_ref stream=cudaStream_t{}) const |
| Async query of k-mers from a device-resident sequence. | |
| Result< void > | contains_sequence (std::string_view sequence, device_span< uint8_t > d_output, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all valid k-mers from a host-resident sequence into device memory. | |
| Result< std::vector< uint8_t > > | contains_sequence (std::string_view sequence, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all valid k-mers from a host-resident sequence. | |
| Result< FastxQueryReport > | query_record_batch (RecordBatchView batch, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries a dense host-resident record batch and returns aggregate counts. | |
| template<RecordQueryConsumer Consumer> | |
| Result< FastxQueryReport > | query_record_batch (RecordBatchView batch, Consumer &&consume, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries a dense host-resident record batch and streams per-record results. | |
| Result< void > | contains_record_batch_async (device_span< const char > d_sequence, std::span< const RecordRange > records, device_span< uint8_t > d_output, cuda::stream_ref stream=cudaStream_t{}) const |
| Async query of k-mers from a device-resident record batch. | |
| Result< FastxQueryReport > | query_fastx (std::istream &input, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all k-mers from a FASTA/FASTQ input stream via chunked streaming. | |
| Result< FastxQueryReport > | query_fastx_file (const std::filesystem::path &path, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all k-mers from a FASTA/FASTQ file. | |
| template<FastxRecordConsumer Consumer> | |
| Result< FastxQueryReport > | query_fastx_records (std::istream &input, Consumer &&consume, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries a FASTA/FASTQ stream and emits one record result per parsed record. | |
| template<FastxRecordConsumer Consumer> | |
| Result< FastxQueryReport > | query_fastx_file_records (const std::filesystem::path &path, Consumer &&consume, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries a FASTA/FASTQ file and emits one record result per parsed record. | |
| Result< FastxDetailedQueryReport > | query_fastx_detailed (std::istream &input, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all k-mers from a FASTA/FASTQ input stream via chunked streaming and preserves per-record hit vectors. | |
| Result< FastxDetailedQueryReport > | query_fastx_file_detailed (const std::filesystem::path &path, double fill_fraction=0.7, cuda::stream_ref stream=cudaStream_t{}) const |
| Queries all k-mers from a FASTA/FASTQ file via chunked streaming and preserves per-record hit vectors. | |
| Result< void > | clear (cuda::stream_ref stream=cudaStream_t{}) |
| Resets all filter bits to zero and synchronises the stream. | |
| float | load_factor () const |
| Computes the fraction of set bits in the filter. | |
| uint64_t | filter_bits () const |
| Returns the total allocated capacity of the filter in bits. | |
| uint64_t | num_shards () const |
| Returns the number of shards. | |
Static Public Member Functions | |
| static constexpr uint64_t | dense_packed_word_count (uint64_t num_symbols) |
Number of uint64_t words for num_symbols dense packed symbols. | |
GPU Super Bloom filter (defined in filter.cuh).
GPU-resident Super Bloom filter for batch k-mer insert and query.
Config fixes k-mer length, minimizer and s-mer widths, hash count, CUDA block size, and alphabet at compile time. Host bulk APIs synchronize before returning, device-span *_async methods do not.
FASTX and record-batch paths inject alphabet separator bytes between records so cross-record k-mers are never formed.
| Config | Compile-time filter configuration (cusbf::Config). |
Definition at line 69 of file filter.cuh.
| using cusbf::filter< Config >::block_type = filter_block<Config> |
One 256-bit filter block stored as an array of Config::blockWordCount words.
Each shard is addressed as a unit: a minimizer hash selects the shard, and the s-mer-derived hashes set/test bits within it.
The struct is 32-byte aligned to enable vectorised loads via cusbf::detail::load256BitGlobalNC.
Definition at line 86 of file filter.cuh.
| using cusbf::filter< Config >::Shard = block_type |
Alias for block_type (one 256-bit shard).
Definition at line 88 of file filter.cuh.
|
inlineexplicit |
Constructs a Filter with at least requestedFilterBits bits of storage.
The actual allocated capacity is rounded up to the next power-of-two number of shards.
| requestedFilterBits | Desired filter capacity in bits. |
Definition at line 108 of file filter.cuh.
|
delete |
Non-copyable (owns device shard storage).
|
defaultnoexcept |
Move-constructs, transfers shard vectors and staging buffers.
|
default |
Destroys device allocations and releases staging scratch.
|
inline |
Resets all filter bits to zero and synchronises the stream.
| stream | CUDA stream to use. |
Definition at line 793 of file filter.cuh.
|
inline |
Queries all k-mers from a host-resident dense packed symbol buffer.
Copies d_words to device, queries, copies results back, and synchronises.
Definition at line 289 of file filter.cuh.
|
inline |
Queries all k-mers from a host-resident dense packed symbol buffer into device memory.
Copies words to device, launches the query kernel into d_output, and synchronises. Does not allocate the result buffer or copy hits back to the host.
Definition at line 267 of file filter.cuh.
|
inline |
Async query of k-mers from a dense packed symbol buffer on the device.
d_output receives one byte per k-mer (1 = present, 0 = absent). Does not synchronise the stream.
Definition at line 248 of file filter.cuh.
|
inline |
Async query of k-mers from a device-resident record batch.
The device sequence is assumed to already contain alphabet separator bytes between records: the caller is responsible for embedding them. records provides ordered, non-overlapping byte ranges into d_sequence.
d_output receives one byte per k-mer across all records (1 = present, 0 = absent). The buffer must hold at least the total k-mer count.
Does not synchronise the stream.
| d_sequence | Device-resident sequence (records concatenated with separators already in place). |
| records | Ordered, non-overlapping record byte ranges. |
| d_output | Per-k-mer result buffer. |
| stream | CUDA stream to use. |
Definition at line 603 of file filter.cuh.
|
inline |
Queries all valid k-mers from a host-resident sequence.
Copies the sequence to device, queries, copies results back, and synchronises. The returned vector has one byte per k-mer: 1 = present, 0 = absent.
| sequence | Raw nucleotide sequence. |
| stream | CUDA stream to use. |
Definition at line 515 of file filter.cuh.
|
inline |
Queries all valid k-mers from a host-resident sequence into device memory.
Copies the sequence to device, launches the query kernel into d_output, and synchronises. Does not allocate the result buffer or copy hits back to the host.
| sequence | Raw nucleotide sequence. |
| d_output | Per-k-mer result buffer (must hold kmerCount() bytes). |
| stream | CUDA stream to use. |
Definition at line 486 of file filter.cuh.
|
inline |
Async query of k-mers from a device-resident sequence.
Does not synchronise the stream. Results are written to d_output (one byte per k-mer: 1 = present, 0 = absent).
| d_sequence | Device-resident nucleotide sequence. |
| d_output | Per-k-mer result buffer (must hold kmerCount() bytes). |
| stream | CUDA stream to use. |
Definition at line 464 of file filter.cuh.
|
inlineconstexpr |
Number of k-mer windows in a dense packed sequence of num_symbols symbols.
Definition at line 320 of file filter.cuh.
|
inlinestaticconstexpr |
Number of uint64_t words for num_symbols dense packed symbols.
Definition at line 315 of file filter.cuh.
|
inline |
Returns the total allocated capacity of the filter in bits.
Definition at line 826 of file filter.cuh.
|
inline |
Inserts all k-mers from a host-resident dense packed symbol buffer.
Copies d_words to device staging, launches the insert kernel, and synchronises.
Definition at line 226 of file filter.cuh.
|
inline |
Inserts all k-mers from a dense packed symbol buffer on the device.
d_words stores dense_packed_word_count(num_symbols) words using Config::symbolBits per encoded symbol. Adjacent k-mers overlap in the same uint64_t chunks; this path decodes a per-block symbol tile and slides packed k-mers like insert_sequence_async.
Does not synchronise the stream.
| d_words | Device-resident dense packed sequence. |
| num_symbols | Number of valid encoded symbols in d_words. |
| stream | CUDA stream to use. |
Definition at line 207 of file filter.cuh.
|
inline |
Inserts all k-mers from a FASTA/FASTQ input stream.
Reads records in streaming fashion, accumulating them until the concatenated sequence approaches a GPU staging budget derived from free VRAM (fill_fraction of free memory minus a small slack reserve), then inserts each chunk independently. The budget accounts for normalized sequence device staging.
| input | Input stream containing FASTA or FASTQ records. |
| fill_fraction | Fraction of available GPU memory for per-chunk staging (default 0.7). |
| stream | CUDA stream to use. |
Definition at line 416 of file filter.cuh.
|
inline |
Inserts all k-mers from a FASTA/FASTQ file.
Uses fill_fraction of free GPU memory to size chunks. When the file fits in a single chunk, reads via a lightweight stream (no mmap, no ping-pong). Larger files are mmap'd if they fit in host RAM, otherwise streamed, multi-chunk paths overlap host assembly with GPU work.
| path | Path to a FASTA or FASTQ file (optionally gzip-compressed). |
| fill_fraction | Fraction of free GPU memory for per-chunk staging (default 0.7). |
| stream | Optional CUDA stream, default uses an internal pipelined path. |
Definition at line 437 of file filter.cuh.
|
inline |
Inserts a dense host-resident record batch.
batch.sequence stores the raw record payloads back-to-back without separators. batch.records stores ordered, non-overlapping byte ranges into that dense buffer. The filter injects alphabet separators between records internally, so callers do not need to materialise separator bytes themselves.
Synchronises before returning.
| batch | Dense record batch to insert. |
| stream | CUDA stream to use. |
Definition at line 339 of file filter.cuh.
|
inline |
Async insert of k-mers from a device-resident record batch.
The device sequence is assumed to already contain alphabet separator bytes between records, the caller is responsible for embedding them so that cross-record k-mers are not formed. records provides ordered, non-overlapping byte ranges into d_sequence.
The returned count is total attempted k-mers (maximum possible per record size). The kernel still skips k-mer windows that contain invalid symbols.
Does not synchronise the stream.
| d_sequence | Device-resident sequence (records concatenated with separators already in place). |
| records | Ordered, non-overlapping record byte ranges. |
| stream | CUDA stream to use. |
Definition at line 385 of file filter.cuh.
|
inline |
Inserts all valid k-mers from a host-resident sequence.
Copies the sequence to device, launches the insert kernel, and synchronises before returning. K-mer windows containing alphabet-invalid symbols are skipped.
| sequence | Host-resident sequence bytes (alphabet-encoded width per symbol). |
| stream | CUDA stream to use (default: null stream). |
k yield 0). Definition at line 155 of file filter.cuh.
|
inline |
Async insert of k-mers from a device-resident sequence.
Does not synchronise the stream, the caller is responsible for ordering relative to downstream operations.
| d_sequence | Device-resident nucleotide sequence. |
| stream | CUDA stream to use. |
Definition at line 179 of file filter.cuh.
|
inline |
Computes the fraction of set bits in the filter.
Definition at line 810 of file filter.cuh.
|
inline |
Returns the number of shards.
Definition at line 831 of file filter.cuh.
|
delete |
|
defaultnoexcept |
Move-assigns shard storage and staging buffers.
|
inline |
Queries all k-mers from a FASTA/FASTQ input stream via chunked streaming.
Returns aggregate counts only (no per-record hit vectors). For per-record callbacks use query_fastx_records, for owning per-record hits use query_fastx_detailed.
| input | Input stream containing FASTA or FASTQ records. |
| fill_fraction | Fraction of free GPU memory for per-chunk staging (default 0.7). |
| stream | CUDA stream to use. |
Definition at line 632 of file filter.cuh.
|
inline |
Queries all k-mers from a FASTA/FASTQ input stream via chunked streaming and preserves per-record hit vectors.
The returned report keeps aggregate counts plus one detailed record result in source order. Each detailed hit vector contains one byte per k-mer window: 1 = present, 0 = absent. Invalid-symbol windows remain in the vector as 0 and are excluded from queriedKmers.
| input | Input stream containing FASTA or FASTQ records. |
| fill_fraction | Fraction of free GPU memory for per-chunk staging (default 0.7). |
| stream | CUDA stream to use. |
Definition at line 750 of file filter.cuh.
|
inline |
Queries all k-mers from a FASTA/FASTQ file.
Returns aggregate counts only. See query_fastx_file_records and query_fastx_file_detailed for per-record results.
| path | Path to a FASTA or FASTQ file (optionally gzip-compressed). |
| fill_fraction | Fraction of free GPU memory for per-chunk staging (default 0.7). |
| stream | CUDA stream to use. |
Definition at line 652 of file filter.cuh.
|
inline |
Queries all k-mers from a FASTA/FASTQ file via chunked streaming and preserves per-record hit vectors.
| path | Path to a FASTA or FASTQ file (optionally gzip-compressed). |
| fill_fraction | Fraction of free GPU memory for per-chunk staging (default 0.7). |
| stream | CUDA stream to use. |
Definition at line 771 of file filter.cuh.
|
inline |
Queries a FASTA/FASTQ file and emits one record result per parsed record.
| path | Path to a FASTA or FASTQ file (optionally gzip-compressed). |
| consume | Per-record callback. |
| fill_fraction | Fraction of free GPU memory for per-chunk staging (default 0.7). |
| stream | CUDA stream to use. |
Definition at line 712 of file filter.cuh.
|
inline |
Queries a FASTA/FASTQ stream and emits one record result per parsed record.
The callback receives record headers, record sequences, aggregate counts, and the per-window hit span for each record as soon as its chunk has been processed. The hit span remains valid only for the duration of the callback.
| input | Input stream containing FASTA or FASTQ records. |
| consume | Per-record callback. |
| fill_fraction | Fraction of available GPU memory for per-chunk staging (default 0.7). Query mode reserves space for both sequence and per-k-mer hit buffers. |
| stream | CUDA stream to use. |
Definition at line 684 of file filter.cuh.
|
inline |
Queries a dense host-resident record batch and streams per-record results.
The callback receives one RecordQueryView per input record in source order. The hit span remains valid only for the duration of the callback.
Synchronises before returning.
| batch | Dense record batch to query. |
| consume | Per-record callback. |
| stream | CUDA stream to use. |
Definition at line 568 of file filter.cuh.
|
inline |
Queries a dense host-resident record batch and returns aggregate counts.
batch.sequence stores raw record payloads back-to-back without separators. batch.records stores ordered, non-overlapping byte ranges into that dense buffer. The filter injects alphabet separators between records internally, so cross-record k-mers are never formed.
Synchronises before returning.
| batch | Dense record batch to query. |
| stream | CUDA stream to use. |
Definition at line 550 of file filter.cuh.
|
inlinenoexcept |
Non-owning device reference to this filter's shard storage.
Trivially copyable, intended to be passed by value into CUDA kernels.
Definition at line 137 of file filter.cuh.