diff --git a/include/cuco/detail/static_multimap/static_multimap.inl b/include/cuco/detail/static_multimap/static_multimap.inl index 965e14f3d..2df33b50b 100644 --- a/include/cuco/detail/static_multimap/static_multimap.inl +++ b/include/cuco/detail/static_multimap/static_multimap.inl @@ -398,6 +398,64 @@ static_multimapcount(first, last, ref(op::count), stream); } +template +void static_multimap::rehash( + cuda::stream_ref stream) +{ + this->impl_->rehash(*this, stream); +} + +template +void static_multimap::rehash( + size_type capacity, cuda::stream_ref stream) +{ + auto const extent = make_bucket_extent(capacity); + this->impl_->rehash(extent, *this, stream); +} + +template +void static_multimap:: + rehash_async(cuda::stream_ref stream) +{ + this->impl_->rehash_async(*this, stream); +} + +template +void static_multimap:: + rehash_async(size_type capacity, cuda::stream_ref stream) +{ + auto const extent = make_bucket_extent(capacity); + this->impl_->rehash_async(extent, *this, stream); +} + template return impl_->retrieve_outer(first, last, output_probe, output_match, probe_ref, stream); } +template +void static_multiset::rehash( + cuda::stream_ref stream) +{ + this->impl_->rehash(*this, stream); +} + +template +void static_multiset::rehash( + size_type capacity, cuda::stream_ref stream) +{ + auto const extent = make_bucket_extent(capacity); + this->impl_->rehash(extent, *this, stream); +} + +template +void static_multiset::rehash_async( + cuda::stream_ref stream) +{ + this->impl_->rehash_async(*this, stream); +} + +template +void static_multiset::rehash_async( + size_type capacity, cuda::stream_ref stream) +{ + auto const extent = make_bucket_extent(capacity); + this->impl_->rehash_async(extent, *this, stream); +} + template size_type count(InputIt first, InputIt last, cuda::stream_ref stream = {}) const; + /** + * @brief Regenerates the container. + * + * @note This function synchronizes the given stream. For asynchronous execution use + * `rehash_async`. + * + * @param stream CUDA stream used for this operation + */ + void rehash(cuda::stream_ref stream = {}); + + /** + * @brief Reserves at least the specified number of slots and regenerates the container + * + * @note Changes the number of slots to a value that is not less than `capacity`, then + * rehashes the container, i.e. puts the elements into appropriate slots considering + * that the total number of slots has changed. + * + * @note This function synchronizes the given stream. For asynchronous execution use + * `rehash_async`. + * + * @note Behavior is undefined if the desired `capacity` is insufficient to store all of the + * contained elements. + * + * @note This function is not available if the conatiner's `extent_type` is static. + * + * @param capacity New capacity of the container + * @param stream CUDA stream used for this operation + */ + void rehash(size_type capacity, cuda::stream_ref stream = {}); + + /** + * @brief Asynchronously regenerates the container. + * + * @param stream CUDA stream used for this operation + */ + void rehash_async(cuda::stream_ref stream = {}); + + /** + * @brief Asynchronously reserves at least the specified number of slots and regenerates the + * container + * + * @note Changes the number of slots to a value that is not less than `capacity`, then + * rehashes the container, i.e. puts the elements into appropriate slots considering + * that the total number of slots has changed. + * + * @note Behavior is undefined if the desired `capacity` is insufficient to store all of the + * contained elements. + * + * @note This function is not available if the conatiner's `extent_type` is static. + * + * @param capacity New capacity of the container + * @param stream CUDA stream used for this operation + */ + void rehash_async(size_type capacity, cuda::stream_ref stream = {}); + /** * @brief Gets the maximum number of elements the hash map can hold. * diff --git a/include/cuco/static_multiset.cuh b/include/cuco/static_multiset.cuh index 6a3843329..9ecbde9b7 100644 --- a/include/cuco/static_multiset.cuh +++ b/include/cuco/static_multiset.cuh @@ -738,6 +738,61 @@ class static_multiset { OutputMatchIt output_match, cuda::stream_ref stream = {}) const; + /** + * @brief Regenerates the container. + * + * @note This function synchronizes the given stream. For asynchronous execution use + * `rehash_async`. + * + * @param stream CUDA stream used for this operation + */ + void rehash(cuda::stream_ref stream = {}); + + /** + * @brief Reserves at least the specified number of slots and regenerates the container + * + * @note Changes the number of slots to a value that is not less than `capacity`, then + * rehashes the container, i.e. puts the elements into appropriate slots considering + * that the total number of slots has changed. + * + * @note This function synchronizes the given stream. For asynchronous execution use + * `rehash_async`. + * + * @note Behavior is undefined if the desired `capacity` is insufficient to store all of the + * contained elements. + * + * @note This function is not available if the conatiner's `extent_type` is static. + * + * @param capacity New capacity of the container + * @param stream CUDA stream used for this operation + */ + void rehash(size_type capacity, cuda::stream_ref stream = {}); + + /** + * @brief Asynchronously regenerates the container. + * + * @param stream CUDA stream used for this operation + */ + void rehash_async(cuda::stream_ref stream = {}); + + /** + * @brief Asynchronously reserves at least the specified number of slots and regenerates the + * container + * + * @note Changes the number of slots to a value that is not less than `capacity`, then + * rehashes the container, i.e. puts the elements into appropriate slots considering + * that the total number of slots has changed. + * + * @note Behavior is undefined if the desired `capacity` is insufficient to store all of the + * contained elements. + * + * @note This function is not available if the conatiner's `extent_type` is static. + * + * @param capacity New capacity of the container + * @param stream CUDA stream used for this operation + */ + void rehash_async(size_type capacity, cuda::stream_ref stream = {}); + /** * @brief Gets the number of elements in the container. *