Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose streams in public strings case APIs #14056

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions cpp/include/cudf/strings/capitalize.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,16 +50,18 @@ namespace strings {
*
* Any null string entries return corresponding null output column entries.
*
* @throw cudf::logic_error if `delimiter.is_valid()` is `false`.
* @throw cudf::logic_error if `delimiter.is_valid()` is `false`.
*
* @param input String column.
* @param delimiters Characters for identifying words to capitalize.
* @param input String column
* @param delimiters Characters for identifying words to capitalize
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory
* @return Column of strings capitalized from the input column.
* @return Column of strings capitalized from the input column
*/
std::unique_ptr<column> capitalize(
strings_column_view const& input,
string_scalar const& delimiters = string_scalar(""),
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -83,14 +85,16 @@ std::unique_ptr<column> capitalize(
*
* Any null string entries return corresponding null output column entries.
*
* @param input String column.
* @param sequence_type The character type that is used when identifying words.
* @param input String column
* @param sequence_type The character type that is used when identifying words
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory
* @return Column of titled strings.
* @return Column of titled strings
*/
std::unique_ptr<column> title(
strings_column_view const& input,
string_character_types sequence_type = string_character_types::ALPHA,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -112,12 +116,14 @@ std::unique_ptr<column> title(
*
* Any null string entries result in corresponding null output column entries.
*
* @param input String column.
* @param input String column
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory
* @return Column of type BOOL8.
* @return Column of type BOOL8
*/
std::unique_ptr<column> is_title(
strings_column_view const& input,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/** @} */ // end of doxygen group
Expand Down
8 changes: 7 additions & 1 deletion cpp/include/cudf/strings/case.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,11 +38,13 @@ namespace strings {
* Any null entries create null entries in the output column.
*
* @param strings Strings instance for this operation.
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New column of strings with characters converted.
*/
std::unique_ptr<column> to_lower(
strings_column_view const& strings,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -55,11 +57,13 @@ std::unique_ptr<column> to_lower(
* Any null entries create null entries in the output column.
*
* @param strings Strings instance for this operation.
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New column of strings with characters converted.
*/
std::unique_ptr<column> to_upper(
strings_column_view const& strings,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -73,11 +77,13 @@ std::unique_ptr<column> to_upper(
* Any null entries create null entries in the output column.
*
* @param strings Strings instance for this operation.
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New column of strings with characters converted.
*/
std::unique_ptr<column> swapcase(
strings_column_view const& strings,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/** @} */ // end of doxygen group
Expand Down
9 changes: 6 additions & 3 deletions cpp/src/strings/capitalize.cu
Original file line number Diff line number Diff line change
Expand Up @@ -287,25 +287,28 @@ std::unique_ptr<column> is_title(strings_column_view const& input,

std::unique_ptr<column> capitalize(strings_column_view const& input,
string_scalar const& delimiter,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
return detail::capitalize(input, delimiter, cudf::get_default_stream(), mr);
return detail::capitalize(input, delimiter, stream, mr);
}

std::unique_ptr<column> title(strings_column_view const& input,
string_character_types sequence_type,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
return detail::title(input, sequence_type, cudf::get_default_stream(), mr);
return detail::title(input, sequence_type, stream, mr);
}

std::unique_ptr<column> is_title(strings_column_view const& input,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
return detail::is_title(input, cudf::get_default_stream(), mr);
return detail::is_title(input, stream, mr);
}

} // namespace strings
Expand Down
9 changes: 6 additions & 3 deletions cpp/src/strings/case.cu
Original file line number Diff line number Diff line change
Expand Up @@ -310,24 +310,27 @@ std::unique_ptr<column> swapcase(strings_column_view const& strings,
// APIs

std::unique_ptr<column> to_lower(strings_column_view const& strings,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
return detail::to_lower(strings, cudf::get_default_stream(), mr);
return detail::to_lower(strings, stream, mr);
}

std::unique_ptr<column> to_upper(strings_column_view const& strings,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
return detail::to_upper(strings, cudf::get_default_stream(), mr);
return detail::to_upper(strings, stream, mr);
}

std::unique_ptr<column> swapcase(strings_column_view const& strings,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
return detail::swapcase(strings, cudf::get_default_stream(), mr);
return detail::swapcase(strings, stream, mr);
}

} // namespace strings
Expand Down