Skip to content

Commit 4fe81a1

Browse files
davidwendtclaude
andcommitted
Migrate nvtext minhash, jaccard, and deduplicate APIs to cudf::memory_resources
Migrates minhash, minhash64, minhash_ngrams, minhash64_ngrams, jaccard_index, build_suffix_array, resolve_duplicates, and resolve_duplicates_pair to cudf::memory_resources and routes their temporary allocations through the temporary resource. Contributes to NVIDIA#24268 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5fe3dba commit 4fe81a1

6 files changed

Lines changed: 210 additions & 214 deletions

File tree

‎cpp/include/nvtext/deduplicate.hpp‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ namespace CUDF_EXPORT nvtext {
3535
* @param input Strings column to build suffix array for
3636
* @param min_width Minimum number of bytes that must match to identify a duplicate
3737
* @param stream CUDA stream used for device memory operations and kernel launches
38-
* @param mr Device memory resource used to allocate the returned column's device memory
38+
* @param mr Memory resources used for temporary allocations and the returned column
3939
* @return Sorted suffix array and corresponding sizes
4040
*/
4141
std::unique_ptr<rmm::device_uvector<cudf::size_type>> build_suffix_array(
4242
cudf::strings_column_view const& input,
4343
cudf::size_type min_width,
44-
cuda::stream_ref stream = cudf::get_default_stream(),
45-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
44+
cuda::stream_ref stream = cudf::get_default_stream(),
45+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
4646

4747
/**
4848
* @brief Returns duplicate strings found in the given input
@@ -61,15 +61,15 @@ std::unique_ptr<rmm::device_uvector<cudf::size_type>> build_suffix_array(
6161
* @param indices Suffix array from nvtext::build_suffix_array
6262
* @param min_width Minimum number of bytes that must match to identify a duplicate
6363
* @param stream CUDA stream used for device memory operations and kernel launches
64-
* @param mr Device memory resource used to allocate the returned column's device memory
64+
* @param mr Memory resources used for temporary allocations and the returned column
6565
* @return New strings column with updated strings
6666
*/
6767
std::unique_ptr<cudf::column> resolve_duplicates(
6868
cudf::strings_column_view const& input,
6969
cudf::device_span<cudf::size_type const> indices,
7070
cudf::size_type min_width,
71-
cuda::stream_ref stream = cudf::get_default_stream(),
72-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
71+
cuda::stream_ref stream = cudf::get_default_stream(),
72+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
7373

7474
/**
7575
* @brief Returns duplicate strings found from input1 found in the given input2
@@ -90,7 +90,7 @@ std::unique_ptr<cudf::column> resolve_duplicates(
9090
* @param indices2 Suffix array from nvtext::build_suffix_array for input2
9191
* @param min_width Minimum number of bytes that must match to identify a duplicate
9292
* @param stream CUDA stream used for device memory operations and kernel launches
93-
* @param mr Device memory resource used to allocate the returned column's device memory
93+
* @param mr Memory resources used for temporary allocations and the returned column
9494
* @return New strings column with updated strings
9595
*/
9696
std::unique_ptr<cudf::column> resolve_duplicates_pair(
@@ -99,8 +99,8 @@ std::unique_ptr<cudf::column> resolve_duplicates_pair(
9999
cudf::strings_column_view const& input2,
100100
cudf::device_span<cudf::size_type const> indices2,
101101
cudf::size_type min_width,
102-
cuda::stream_ref stream = cudf::get_default_stream(),
103-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
102+
cuda::stream_ref stream = cudf::get_default_stream(),
103+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
104104

105105
/** @} */ // end of group
106106
} // namespace CUDF_EXPORT nvtext

‎cpp/include/nvtext/jaccard.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ namespace CUDF_EXPORT nvtext {
5757
* @param input2 Strings column to compare with `input1`
5858
* @param width The character width used for apply substrings
5959
* @param stream CUDA stream used for device memory operations and kernel launches
60-
* @param mr Device memory resource used to allocate the returned column's device memory
60+
* @param mr Memory resources used for temporary allocations and the returned column
6161
* @return Index calculation values
6262
*/
6363
std::unique_ptr<cudf::column> jaccard_index(
6464
cudf::strings_column_view const& input1,
6565
cudf::strings_column_view const& input2,
6666
cudf::size_type width,
67-
cuda::stream_ref stream = cudf::get_default_stream(),
68-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
67+
cuda::stream_ref stream = cudf::get_default_stream(),
68+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
6969

7070
/** @} */ // end of group
7171
} // namespace CUDF_EXPORT nvtext

‎cpp/include/nvtext/minhash.hpp‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace CUDF_EXPORT nvtext {
5656
* @param parameter_b Values used for the permuted calculation
5757
* @param width The character width of substrings to hash for each row
5858
* @param stream CUDA stream used for device memory operations and kernel launches
59-
* @param mr Device memory resource used to allocate the returned column's device memory
59+
* @param mr Memory resources used for temporary allocations and the returned column
6060
* @return List column of minhash values for each string per seed
6161
*/
6262
std::unique_ptr<cudf::column> minhash(
@@ -65,8 +65,8 @@ std::unique_ptr<cudf::column> minhash(
6565
cudf::device_span<uint32_t const> parameter_a,
6666
cudf::device_span<uint32_t const> parameter_b,
6767
cudf::size_type width,
68-
cuda::stream_ref stream = cudf::get_default_stream(),
69-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
68+
cuda::stream_ref stream = cudf::get_default_stream(),
69+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
7070

7171
/**
7272
* @brief Returns the minhash values for each string
@@ -103,7 +103,7 @@ std::unique_ptr<cudf::column> minhash(
103103
* @param parameter_b Values used for the permuted calculation
104104
* @param width The character width of substrings to hash for each row
105105
* @param stream CUDA stream used for device memory operations and kernel launches
106-
* @param mr Device memory resource used to allocate the returned column's device memory
106+
* @param mr Memory resources used for temporary allocations and the returned column
107107
* @return List column of minhash values for each string per seed
108108
*/
109109
std::unique_ptr<cudf::column> minhash64(
@@ -112,8 +112,8 @@ std::unique_ptr<cudf::column> minhash64(
112112
cudf::device_span<uint64_t const> parameter_a,
113113
cudf::device_span<uint64_t const> parameter_b,
114114
cudf::size_type width,
115-
cuda::stream_ref stream = cudf::get_default_stream(),
116-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
115+
cuda::stream_ref stream = cudf::get_default_stream(),
116+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
117117

118118
/**
119119
* @brief Returns the minhash values for each input row
@@ -150,7 +150,7 @@ std::unique_ptr<cudf::column> minhash64(
150150
* @param parameter_a Values used for the permuted calculation
151151
* @param parameter_b Values used for the permuted calculation
152152
* @param stream CUDA stream used for device memory operations and kernel launches
153-
* @param mr Device memory resource used to allocate the returned column's device memory
153+
* @param mr Memory resources used for temporary allocations and the returned column
154154
* @return List column of minhash values for each string per seed
155155
*/
156156
std::unique_ptr<cudf::column> minhash_ngrams(
@@ -159,8 +159,8 @@ std::unique_ptr<cudf::column> minhash_ngrams(
159159
uint32_t seed,
160160
cudf::device_span<uint32_t const> parameter_a,
161161
cudf::device_span<uint32_t const> parameter_b,
162-
cuda::stream_ref stream = cudf::get_default_stream(),
163-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
162+
cuda::stream_ref stream = cudf::get_default_stream(),
163+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
164164

165165
/**
166166
* @brief Returns the minhash values for each input row
@@ -197,7 +197,7 @@ std::unique_ptr<cudf::column> minhash_ngrams(
197197
* @param parameter_a Values used for the permuted calculation
198198
* @param parameter_b Values used for the permuted calculation
199199
* @param stream CUDA stream used for device memory operations and kernel launches
200-
* @param mr Device memory resource used to allocate the returned column's device memory
200+
* @param mr Memory resources used for temporary allocations and the returned column
201201
* @return List column of minhash values for each string per seed
202202
*/
203203
std::unique_ptr<cudf::column> minhash64_ngrams(
@@ -206,8 +206,8 @@ std::unique_ptr<cudf::column> minhash64_ngrams(
206206
uint64_t seed,
207207
cudf::device_span<uint64_t const> parameter_a,
208208
cudf::device_span<uint64_t const> parameter_b,
209-
cuda::stream_ref stream = cudf::get_default_stream(),
210-
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
209+
cuda::stream_ref stream = cudf::get_default_stream(),
210+
cudf::memory_resources mr = cudf::get_current_device_resource_ref());
211211

212212
/** @} */ // end of group
213213
} // namespace CUDF_EXPORT nvtext

0 commit comments

Comments
 (0)