Public Member Functions | List of all members
cudf::roaring_bitmap Class Reference

A type-erased wrapper around cuco's roaring bitmap supporting both 32-bit and 64-bit keys. More...

#include <roaring_bitmap.hpp>

Public Member Functions

 roaring_bitmap (roaring_bitmap_type type, cudf::host_span< cuda::std::byte const > serialized_bitmap_data)
 Constructs a roaring_bitmap from serialized bitmap data (payload) More...
 
 ~roaring_bitmap ()
 Destructor for the roaring bitmap class.
 
 roaring_bitmap (roaring_bitmap &&other) noexcept
 Move constructor for the roaring bitmap class. More...
 
roaring_bitmapoperator= (roaring_bitmap &&other) noexcept
 Move assignment operator for the roaring bitmap class. More...
 
 roaring_bitmap (roaring_bitmap const &)=delete
 
roaring_bitmapoperator= (roaring_bitmap const &)=delete
 
void materialize (rmm::cuda_stream_view stream=cudf::get_default_stream()) const
 Materialize the underlying cuco roaring bitmap. More...
 
roaring_bitmap_type type () const
 Returns the roaring bitmap type. More...
 
bool empty () const
 Checks whether the bitmap contains no keys. More...
 
cuda::std::size_t size () const
 Returns the number of keys stored in the bitmap. More...
 
cuda::std::size_t size_bytes () const
 Returns the size of the serialized bitmap storage in bytes. More...
 
std::unique_ptr< cudf::columncontains_async (cudf::column_view const &keys, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
 Asynchronously queries the bitmap for membership of each key in the input column. More...
 
void contains_async (cudf::column_view const &keys, cudf::mutable_column_view const &output, rmm::cuda_stream_view stream) const
 Asynchronously queries the bitmap for membership of each key in a column and stores the result in the output column. More...
 

Detailed Description

A type-erased wrapper around cuco's roaring bitmap supporting both 32-bit and 64-bit keys.

This class holds a span of serialized roaring bitmap data (specified 32-bit or 64-bit) on the host and lazily materializes the corresponding underlying cuco roaring bitmap when materialize() is called or implicitly when contains_async() is first called.

Example usage (64-bit version):

auto bitmap = cudf::roaring_bitmap(cudf::roaring_bitmap_type::BITS_64, serialized_bitmap_data);
bitmap.materialize(stream);
auto result = bitmap.contains_async(keys_column, stream, mr);
A type-erased wrapper around cuco's roaring bitmap supporting both 32-bit and 64-bit keys.
@ BITS_64
64-bit roaring bitmap (keys are uint64)

Definition at line 53 of file roaring_bitmap.hpp.

Constructor & Destructor Documentation

◆ roaring_bitmap() [1/2]

cudf::roaring_bitmap::roaring_bitmap ( roaring_bitmap_type  type,
cudf::host_span< cuda::std::byte const >  serialized_bitmap_data 
)
explicit

Constructs a roaring_bitmap from serialized bitmap data (payload)

The serialized bitmap data must remain valid until the underlying cuco roaring bitmap is materialized via materialize().

Parameters
typeThe bitmap key type (BITS_32 or BITS_64)
serialized_bitmap_dataHost span of bytes containing a roaring bitmap serialized in portable format
Exceptions
std::invalid_argumentif the serialized bitmap data is empty

◆ roaring_bitmap() [2/2]

cudf::roaring_bitmap::roaring_bitmap ( roaring_bitmap &&  other)
noexcept

Move constructor for the roaring bitmap class.

Parameters
otherRoaring bitmap to move from

Member Function Documentation

◆ contains_async() [1/2]

void cudf::roaring_bitmap::contains_async ( cudf::column_view const &  keys,
cudf::mutable_column_view const &  output,
rmm::cuda_stream_view  stream 
) const

Asynchronously queries the bitmap for membership of each key in a column and stores the result in the output column.

The input column must have dtype UINT32 (for BITS_32) or UINT64 (for BITS_64). The output column must have BOOL8 dtype.

Parameters
keysKey column to query
outputOutput column to store the result
streamCUDA stream used for device memory operations and kernel launches
Exceptions
std::invalid_argumentif the key or output column dtypes are invalid

◆ contains_async() [2/2]

std::unique_ptr<cudf::column> cudf::roaring_bitmap::contains_async ( cudf::column_view const &  keys,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
) const

Asynchronously queries the bitmap for membership of each key in the input column.

The input column must have dtype UINT32 (for BITS_32) or UINT64 (for BITS_64).

Parameters
keysKey column to query
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource for the output column allocation
Returns
A BOOL8 column indicating positions of the present keys
Exceptions
std::invalid_argumentif the key column dtype is invalid

◆ empty()

bool cudf::roaring_bitmap::empty ( ) const

Checks whether the bitmap contains no keys.

Returns
Whether the roaring bitmap contains no keys

◆ materialize()

void cudf::roaring_bitmap::materialize ( rmm::cuda_stream_view  stream = cudf::get_default_stream()) const

Materialize the underlying cuco roaring bitmap.

The serialized bitmap data span is cleared after this call.

Parameters
streamCUDA stream used for device memory operations and kernel launches

◆ operator=()

roaring_bitmap& cudf::roaring_bitmap::operator= ( roaring_bitmap &&  other)
noexcept

Move assignment operator for the roaring bitmap class.

Parameters
otherRoaring bitmap to move from
Returns
Reference to the moved-from roaring bitmap

◆ size()

cuda::std::size_t cudf::roaring_bitmap::size ( ) const

Returns the number of keys stored in the bitmap.

Returns
Number of keys stored in the bitmap

◆ size_bytes()

cuda::std::size_t cudf::roaring_bitmap::size_bytes ( ) const

Returns the size of the serialized bitmap storage in bytes.

Returns
Size of the serialized bitmap storage in bytes

◆ type()

roaring_bitmap_type cudf::roaring_bitmap::type ( ) const

Returns the roaring bitmap type.

Returns
Roaring bitmap type

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