Skip to content

Commit

Permalink
Merge pull request rapidsai#3303 from rgsl888prabhu/2948_adding_copy_if
Browse files Browse the repository at this point in the history
[REVIEW] Define and implement new stream compaction APIs `copy_if`, `drop_nulls`, `apply_boolean_mask`, `drop_duplicate` and `unique_count`.
  • Loading branch information
harrism authored Nov 21, 2019
2 parents 2b4e73f + 5e64ad3 commit bcb7bf1
Show file tree
Hide file tree
Showing 24 changed files with 2,113 additions and 65 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
- PR #3380 Concatenate columns of strings
- PR #3382 Add fill function for strings column
- PR #3391 Move device_atomics_tests.cu files to legacy
- PR #3303 Define and implement new stream compaction APIs `copy_if`, `drop_nulls`,
`apply_boolean_mask`, `drop_duplicate` and `unique_count`.
- PR #3387 Strings column gather function
- PR #3389 Move quantiles.hpp + group_quantiles.hpp files to legacy
- PR #3398 Move reshape.hpp files to legacy
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/libcudf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ test:
- test -f $PREFIX/include/cudf/legacy/replace.hpp
- test -f $PREFIX/include/cudf/legacy/rolling.hpp
- test -f $PREFIX/include/cudf/legacy/search.hpp
- test -f $PREFIX/include/cudf/stream_compaction.hpp
- test -f $PREFIX/include/cudf/legacy/stream_compaction.hpp
- test -f $PREFIX/include/cudf/transpose.hpp
- test -f $PREFIX/include/cudf/legacy/transform.hpp
Expand Down
3 changes: 3 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ add_library(cudf
src/transform/legacy/nans_to_nulls.cu
src/transform/transform.cpp
src/bitmask/legacy/bitmask_ops.cu
src/stream_compaction/apply_boolean_mask.cu
src/stream_compaction/drop_nulls.cu
src/stream_compaction/drop_duplicates.cu
src/stream_compaction/legacy/apply_boolean_mask.cu
src/stream_compaction/legacy/drop_nulls.cu
src/stream_compaction/legacy/drop_duplicates.cu
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/cudf/copying.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum class mask_allocation_policy {
* @param[in] input Immutable view of input column to emulate
* @return std::unique_ptr<column> An empty column of same type as `input`
*/
std::unique_ptr<column> empty_like(column_view input);
std::unique_ptr<column> empty_like(column_view const& input);

/**
* @brief Creates an uninitialized new column of the same size and type as the `input`.
Expand All @@ -83,7 +83,7 @@ std::unique_ptr<column> empty_like(column_view input);
* @param[in] mr Optional, The resource to use for all allocations
* @return std::unique_ptr<column> A column with sufficient uninitialized capacity to hold the same number of elements as `input` of the same type as `input.type()`
*/
std::unique_ptr<column> allocate_like(column_view input,
std::unique_ptr<column> allocate_like(column_view const& input,
mask_allocation_policy mask_alloc = mask_allocation_policy::RETAIN,
rmm::mr::device_memory_resource *mr =
rmm::mr::get_default_resource());
Expand All @@ -98,7 +98,7 @@ std::unique_ptr<column> allocate_like(column_view input,
* @param[in] mr Optional, The resource to use for all allocations
* @return std::unique_ptr<column> A column with sufficient uninitialized capacity to hold the specified number of elements as `input` of the same type as `input.type()`
*/
std::unique_ptr<column> allocate_like(column_view input, size_type size,
std::unique_ptr<column> allocate_like(column_view const& input, size_type size,
mask_allocation_policy mask_alloc = mask_allocation_policy::RETAIN,
rmm::mr::device_memory_resource *mr =
rmm::mr::get_default_resource());
Expand All @@ -112,7 +112,7 @@ std::unique_ptr<column> allocate_like(column_view input, size_type size,
* @param[in] input_table Immutable view of input table to emulate
* @return std::unique_ptr<table> A table of empty columns with the same types as the columns in `input_table`
*/
std::unique_ptr<table> empty_like(table_view input_table);
std::unique_ptr<table> empty_like(table_view const& input_table);

/**
* @brief Slices a `column_view` into a set of `column_view`s according to a set of indices.
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/cudf/detail/copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ColumnView slice(ColumnView const& input,
* @param[in] stream Optional CUDA stream on which to execute kernels
* @return std::unique_ptr<column> An empty column of same type as `input`
*/
std::unique_ptr<column> empty_like(column_view input, cudaStream_t stream = 0);
std::unique_ptr<column> empty_like(column_view const& input, cudaStream_t stream = 0);

/**
* @brief Creates an uninitialized new column of the specified size and same type as the `input`.
Expand All @@ -83,7 +83,7 @@ std::unique_ptr<column> empty_like(column_view input, cudaStream_t stream = 0);
* @param[in] stream Optional CUDA stream on which to execute kernels
* @return std::unique_ptr<column> A column with sufficient uninitialized capacity to hold the specified number of elements as `input` of the same type as `input.type()`
*/
std::unique_ptr<column> allocate_like(column_view input, size_type size,
std::unique_ptr<column> allocate_like(column_view const& input, size_type size,
mask_allocation_policy mask_alloc =
mask_allocation_policy::RETAIN,
rmm::mr::device_memory_resource *mr =
Expand All @@ -100,7 +100,7 @@ std::unique_ptr<column> allocate_like(column_view input, size_type size,
* @param[in] stream Optional CUDA stream on which to execute kernels
* @return std::unique_ptr<table> A table of empty columns with the same types as the columns in `input_table`
*/
std::unique_ptr<table> empty_like(table_view input_table, cudaStream_t stream = 0);
std::unique_ptr<table> empty_like(table_view const& input_table, cudaStream_t stream = 0);

/**
* @brief Returns a new column, where each element is selected from either @p lhs or
Expand Down
Loading

0 comments on commit bcb7bf1

Please sign in to comment.