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

[REVIEW] Define and implement new search APIs #3229

Merged
merged 23 commits into from
Nov 19, 2019

Conversation

ChuckHastings
Copy link
Contributor

@ChuckHastings ChuckHastings commented Oct 28, 2019

Port search logic to new cudf::column.

Closes #2946

@ChuckHastings ChuckHastings requested review from a team as code owners October 28, 2019 15:27
@ChuckHastings
Copy link
Contributor Author

Current status: Works for lower_bound and upper_bound. All unit tests validated.

Contains requires cudf::scalar. Will start experimenting with the new PR for that.

Copy link
Contributor

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewed the header for now.

cpp/include/cudf/search.hpp Outdated Show resolved Hide resolved
cpp/include/cudf/search.hpp Outdated Show resolved Hide resolved
cpp/include/cudf/search.hpp Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 28, 2019

Codecov Report

Merging #3229 into branch-0.11 will increase coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff               @@
##           branch-0.11   #3229      +/-   ##
==============================================
+ Coverage        87.18%   87.3%   +0.12%     
==============================================
  Files               49      49              
  Lines             9220    9214       -6     
==============================================
+ Hits              8038    8044       +6     
+ Misses            1182    1170      -12
Impacted Files Coverage Δ
python/cudf/cudf/core/groupby/groupby.py 96.08% <0%> (-0.21%) ⬇️
python/cudf/cudf/utils/utils.py 78.51% <0%> (+7.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 043d894...d06b092. Read the comment docs.

@harrism harrism added 2 - In Progress Currently a work in progress libcudf++ labels Oct 29, 2019
@ChuckHastings ChuckHastings changed the title [WIP] Port search to libcudf++ [WIP] Define and implement new search APIs Oct 30, 2019
@ChuckHastings
Copy link
Contributor Author

Status - everything implemented. All unit tests pass.

There is a hack in place waiting for PR 3172. Specifically, this code uses cudf::experimental::fill out of 3172, and in place of that there's some ugly code that allows the unit tests to pass. Can't be merged this way.

@ChuckHastings
Copy link
Contributor Author

Added string support. Had to refactor some things so this PR is now no longer dependent on PR 3172. The fill call is no longer required.

@ChuckHastings
Copy link
Contributor Author

rerun tests

@ChuckHastings
Copy link
Contributor Author

Eliminate dependency on 3255. Should be ready to review independently.

@ChuckHastings ChuckHastings changed the title [WIP] Define and implement new search APIs [REVIEW] Define and implement new search APIs Nov 14, 2019
@harrism harrism added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Nov 18, 2019
Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good. Just change order of the stream parameter.

cpp/tests/utilities/column_wrapper.hpp Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
cpp/src/search/search.cu Outdated Show resolved Hide resolved
@harrism harrism dismissed jrhemstad’s stale review November 19, 2019 02:22

All suggestions addressed.

@harrism harrism merged commit d640dd8 into rapidsai:branch-0.11 Nov 19, 2019
Copy link
Contributor

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was merged before a final review. While it is functionally correct, there are still lingering issues.

if (col.has_nulls()) {
auto eq_op = compare_with_value<Element, true>(*d_col, element, element_is_valid, true);

return thrust::any_of(rmm::exec_policy(stream)->on(stream),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thrust::any_of is slow, don't use it: https://github.com/thrust/thrust/issues/1016

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will address this in a new PR.


__device__ bool operator()(size_type i) noexcept {
if (nullable) {
bool const col_is_null{col.nullable() and col.is_null(i)};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nullable check is redundant. It's already a non-type parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, the is_null can be is_null_nocheck.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look at this as I rework this to use scalar_device_view. I copied this from row_equality_comparator... but row_equality_comparator had two tables, with only one column here some of the checks are redundant.

bool element_is_valid{value.is_valid()};
Element element;

populate_element(value, element);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just use a scalar_device_view.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started that way and it became complicated, although I now know more about how strings and scalars work. Will revisit in a new PR.

populate_element(value, element);

if (col.has_nulls()) {
auto eq_op = compare_with_value<Element, true>(*d_col, element, element_is_valid, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing a value in a column against a scalar will be a common operation. This should be updated to use a scalar_device_view and made into a generic comparator and put here: https://github.com/rapidsai/cudf/blob/branch-0.11/cpp/include/cudf/table/row_operators.cuh#L147

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it has nothing to do with tables. Should it still go in table/row_operators.cuh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Port search.hpp to cudf::column types
3 participants