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 filling APIs for label_bins #14401

Merged
merged 19 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
4 changes: 3 additions & 1 deletion cpp/include/cudf/labeling/label_bins.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-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 @@ -64,6 +64,7 @@ enum class inclusive { YES, NO };
* @param left_inclusive Whether or not the left edge is inclusive.
* @param right_edges Value of the right edge of each bin.
* @param right_inclusive Whether or not the right edge is inclusive.
* @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.
* @return The integer labels of the elements in `input` according to the specified bins.
*/
Expand All @@ -73,6 +74,7 @@ std::unique_ptr<column> label_bins(
inclusive left_inclusive,
column_view const& right_edges,
inclusive right_inclusive,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
ZelboK marked this conversation as resolved.
Show resolved Hide resolved
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/** @} */ // end of group
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/labeling/label_bins.cu
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ std::unique_ptr<column> label_bins(column_view const& input,
inclusive left_inclusive,
column_view const& right_edges,
inclusive right_inclusive,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_FUNC_RANGE();
Expand All @@ -244,7 +245,7 @@ std::unique_ptr<column> label_bins(column_view const& input,
left_inclusive,
right_edges,
right_inclusive,
cudf::get_default_stream(),
stream,
mr);
}
} // namespace cudf
1 change: 1 addition & 0 deletions cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ ConfigureTest(STREAM_GROUPBY_TEST streams/groupby_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_HASHING_TEST streams/hash_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_INTEROP_TEST streams/interop_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_JSONIO_TEST streams/io/json_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_LABELING_BINS_TEST streams/labeling_bins_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_LISTS_TEST streams/lists_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_NULL_MASK_TEST streams/null_mask_test.cpp STREAM_MODE testing)
ConfigureTest(STREAM_REPLACE_TEST streams/replace_test.cpp STREAM_MODE testing)
Expand Down
32 changes: 32 additions & 0 deletions cpp/tests/streams/labeling_bins_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <cudf/labeling/label_bins.hpp>

#include <cudf_test/base_fixture.hpp>
#include <cudf_test/column_wrapper.hpp>
#include <cudf_test/default_stream.hpp>

class LabelingBinsStreamTest : public cudf::test::BaseFixture {};

TEST_F(LabelingBinsStreamTest, SimpleStringsTest)
{
cudf::test::strings_column_wrapper left_edges{"a", "b", "c", "d", "e"};
cudf::test::strings_column_wrapper right_edges{"b", "c", "d", "e", "f"};
cudf::test::strings_column_wrapper input{"abc", "bcd", "cde", "def", "efg"};

cudf::label_bins(input, left_edges, cudf::inclusive::YES, right_edges, cudf::inclusive::NO, cudf::test::get_default_stream());
}
Loading