cuDDL
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
cuddl::reference_index< K, BucketCount, Layout > Class Template Reference

Move-only acceleration data for an immutable reference database. More...

Public Member Functions

 reference_index (reference_index const &)=delete
 
reference_index & operator= (reference_index const &)=delete
 
__host__ ~reference_index ()
 
 reference_index (reference_index &&other) noexcept
 
reference_index & operator= (reference_index &&other) noexcept
 Move-assigns the index, leaving the source empty.
 
index_storage storage () const noexcept
 Dense index when offsets cover every cell, sparse when only keys are stored.
 
double pair_fraction () const noexcept
 Fraction of all (query, reference, bucket) cells an index lookup visits for queries resembling the references; searches fall back to comparing bit-planes when the index would visit too many.
 
size_t persistent_index_bytes () const noexcept
 Bytes the saved index file needs for offsets, postings, and keys.
 

Static Public Member Functions

static Result< reference_index > build_async (database_type const &database, cuda::stream_ref stream, index_storage storage=index_storage::automatic)
 Build acceleration data without taking ownership of or copying reference rows.
 

Friends

class reference_index_file
 
class reference_database< K, BucketCount, Layout >
 

Detailed Description

template<uint32_t K, size_t BucketCount, typename Layout>
class cuddl::reference_index< K, BucketCount, Layout >

Move-only acceleration data for an immutable reference database.

Build and load return the same type; pass its address to a database search. The allocation stream must outlive the index.

Definition at line 11 of file reference_index.cuh.

Constructor & Destructor Documentation

◆ reference_index() [1/2]

template<uint32_t K, size_t BucketCount, typename Layout >
cuddl::reference_index< K, BucketCount, Layout >::reference_index ( reference_index< K, BucketCount, Layout > const &  )
delete

◆ ~reference_index()

template<uint32_t K, size_t BucketCount, typename Layout >
__host__ cuddl::reference_index< K, BucketCount, Layout >::~reference_index ( )
inline

Definition at line 23 of file reference_index.cuh.

23{}

◆ reference_index() [2/2]

template<uint32_t K, size_t BucketCount, typename Layout >
cuddl::reference_index< K, BucketCount, Layout >::reference_index ( reference_index< K, BucketCount, Layout > &&  other)
inlinenoexcept

Definition at line 25 of file reference_index.cuh.

26 : identity_(std::move(other.identity_)),
27 index_offsets_(std::move(other.index_offsets_)),
28 index_postings_(std::move(other.index_postings_)),
29 index_keys_(std::move(other.index_keys_)),
30 key_directory_(std::move(other.key_directory_)),
31 bitmap_cells_(std::move(other.bitmap_cells_)),
32 posting_bitmaps_(std::move(other.posting_bitmaps_)),
33 bitmap_count_(std::exchange(other.bitmap_count_, 0U)),
34 index_posting_capacity_(std::exchange(other.index_posting_capacity_, 0)),
35 pair_work_(std::exchange(other.pair_work_, 0ULL)),
36 pair_fraction_(std::exchange(other.pair_fraction_, 0.0)),
37 indexed_(std::exchange(other.indexed_, false)) {}

Member Function Documentation

◆ build_async()

template<uint32_t K, size_t BucketCount, typename Layout >
static Result< reference_index > cuddl::reference_index< K, BucketCount, Layout >::build_async ( database_type const &  database,
cuda::stream_ref  stream,
index_storage  storage = index_storage::automatic 
)
inlinestatic

Build acceleration data without taking ownership of or copying reference rows.

index_storage::automatic builds whichever storage needs less device memory.

Definition at line 65 of file reference_index.cuh.

69 {
70 detail::device_scope const scope{stream};
71 auto index = CUDDL_TRY(build_index<score_type>(database, stream, storage));
72 CUDDL_TRY(index.measure_pair_fraction(database, stream));
73 if (!detail::ablated("posting-bitmaps")) {
74 CUDDL_TRY(index.build_posting_bitmaps(database, stream));
75 }
76 return Result<reference_index>::ok(std::move(index));
77 }
index_storage storage() const noexcept
Dense index when offsets cover every cell, sparse when only keys are stored.
#define CUDDL_TRY(expr)
Propagates a cuddl::Result failure from the enclosing function (GNU statement expression).
Definition error.hpp:225
::cuda::__ensure_current_context device_scope
Makes stream's device current for the enclosing scope and restores the previous context on exit.
constexpr bool ablated(std::string_view) noexcept
Always false: this build compiles the ablation switches out.
Definition ablation.hpp:82
static Result ok(T value)
Definition error.hpp:121
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

template<uint32_t K, size_t BucketCount, typename Layout >
reference_index & cuddl::reference_index< K, BucketCount, Layout >::operator= ( reference_index< K, BucketCount, Layout > &&  other)
inlinenoexcept

Move-assigns the index, leaving the source empty.

Definition at line 40 of file reference_index.cuh.

40 {
41 if (this != &other) {
42 identity_ = std::move(other.identity_);
43 index_offsets_ = std::move(other.index_offsets_);
44 index_postings_ = std::move(other.index_postings_);
45 index_keys_ = std::move(other.index_keys_);
46 key_directory_ = std::move(other.key_directory_);
47 bitmap_cells_ = std::move(other.bitmap_cells_);
48 posting_bitmaps_ = std::move(other.posting_bitmaps_);
49 bitmap_count_ = std::exchange(other.bitmap_count_, 0U);
50 index_posting_capacity_ = std::exchange(other.index_posting_capacity_, 0);
51 pair_work_ = std::exchange(other.pair_work_, 0ULL);
52 pair_fraction_ = std::exchange(other.pair_fraction_, 0.0);
53 indexed_ = std::exchange(other.indexed_, false);
54 }
55 return *this;
56 }

◆ operator=() [2/2]

template<uint32_t K, size_t BucketCount, typename Layout >
reference_index & cuddl::reference_index< K, BucketCount, Layout >::operator= ( reference_index< K, BucketCount, Layout > const &  )
delete

◆ pair_fraction()

template<uint32_t K, size_t BucketCount, typename Layout >
double cuddl::reference_index< K, BucketCount, Layout >::pair_fraction ( ) const
inlinenoexcept

Fraction of all (query, reference, bucket) cells an index lookup visits for queries resembling the references; searches fall back to comparing bit-planes when the index would visit too many.

Definition at line 82 of file reference_index.cuh.

82 {
83 return pair_fraction_;
84 }

◆ persistent_index_bytes()

template<uint32_t K, size_t BucketCount, typename Layout >
size_t cuddl::reference_index< K, BucketCount, Layout >::persistent_index_bytes ( ) const
inlinenoexcept

Bytes the saved index file needs for offsets, postings, and keys.

Definition at line 87 of file reference_index.cuh.

87 {
88 return index_offsets_.size() * sizeof(uint32_t) +
89 index_postings_.size() * sizeof(uint32_t) + index_keys_.size() * sizeof(uint16_t);
90 }

◆ storage()

template<uint32_t K, size_t BucketCount, typename Layout >
index_storage cuddl::reference_index< K, BucketCount, Layout >::storage ( ) const
inlinenoexcept

Dense index when offsets cover every cell, sparse when only keys are stored.

Definition at line 59 of file reference_index.cuh.

59 {
60 return index_offsets_.empty() ? index_storage::sparse : index_storage::dense;
61 }
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ reference_database< K, BucketCount, Layout >

template<uint32_t K, size_t BucketCount, typename Layout >
friend class reference_database< K, BucketCount, Layout >
friend

Definition at line 13 of file reference_index.cuh.

◆ reference_index_file

template<uint32_t K, size_t BucketCount, typename Layout >
friend class reference_index_file
friend

Definition at line 13 of file reference_index.cuh.


The documentation for this class was generated from the following files: