-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move true_if device function from detail/.hpp to src/.cuh header #21717
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
65d01c9
Move true_if device function from detail/.hpp to src/.cuh header
davidwendt be80398
Merge branch 'main' into true-if-move
davidwendt e66dd2c
Merge branch 'main' into true-if-move
davidwendt 4dece4e
remove unneeded include
davidwendt d21327b
remove another unneeded include
davidwendt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <cudf/column/column_factories.hpp> | ||
| #include <cudf/utilities/memory_resource.hpp> | ||
|
|
||
| #include <rmm/cuda_stream_view.hpp> | ||
| #include <rmm/exec_policy.hpp> | ||
|
|
||
| #include <thrust/transform.h> | ||
|
|
||
| namespace cudf { | ||
| namespace detail { | ||
| /** | ||
| * @brief Creates a column of `type_id::BOOL8` elements by applying a predicate to every element | ||
| * between | ||
| * [`begin, `end`) `true` indicates the value is satisfies the predicate and `false` indicates it | ||
| * doesn't. | ||
| * | ||
| * @tparam InputIterator Iterator type for `begin` and `end` | ||
| * @tparam Predicate A predicator type which will be evaluated | ||
| * @param begin Beginning of the sequence of elements | ||
| * @param end End of the sequence of elements | ||
| * @param size Size of the output column | ||
| * @param p Predicate to be applied to each element in `[begin,end)` | ||
| * @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 | ||
| * | ||
| * @returns A column of type `type_id::BOOL8,` with `true` representing predicate is satisfied. | ||
| */ | ||
|
|
||
| template <typename InputIterator, typename Predicate> | ||
| std::unique_ptr<column> true_if(InputIterator begin, | ||
| InputIterator end, | ||
| size_type size, | ||
| Predicate p, | ||
| rmm::cuda_stream_view stream, | ||
| rmm::device_async_resource_ref mr) | ||
| { | ||
| auto output = | ||
| make_numeric_column(data_type(type_id::BOOL8), size, mask_state::UNALLOCATED, stream, mr); | ||
| auto output_mutable_view = output->mutable_view(); | ||
| auto output_data = output_mutable_view.data<bool>(); | ||
|
|
||
| thrust::transform(rmm::exec_policy_nosync(stream), begin, end, output_data, p); | ||
|
|
||
| return output; | ||
| } | ||
|
|
||
| } // namespace detail | ||
| } // namespace cudf | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.