Skip to content

Support collect_set on rolling window - #7881

Merged
rapids-bot[bot] merged 14 commits into
NVIDIA:branch-21.06from
sperlingxx:collect_set_rolling
May 26, 2021
Merged

Support collect_set on rolling window#7881
rapids-bot[bot] merged 14 commits into
NVIDIA:branch-21.06from
sperlingxx:collect_set_rolling

Conversation

@sperlingxx

Copy link
Copy Markdown
Contributor

This pull request is to support collect_set on rolling window, which is required in #7809.

@sperlingxx
sperlingxx requested review from mythrocks and ttnghia April 7, 2021 10:13
@sperlingxx
sperlingxx requested a review from a team as a code owner April 7, 2021 10:13
@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Apr 7, 2021
@sperlingxx sperlingxx added 3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function non-breaking Non-breaking change and removed libcudf Affects libcudf (C++/CUDA) code. labels Apr 7, 2021
@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Apr 7, 2021
Comment thread cpp/src/rolling/rolling_detail.cuh Outdated
@mythrocks

mythrocks commented Apr 7, 2021

Copy link
Copy Markdown
Contributor

Hey, there, @sperlingxx. This PR should be against branch-0.20, not branch-0.19. You have the option of picking these commits into a branch-0.20 checkout, and overwriting this branch.

Also, pardon me for pointing this out: The reason we postponed making this change was that we are piling on if-else checks in the SFINAE code. @nvdbaranec is in the middle of sorting out that refactor.

Comment thread cpp/tests/rolling/collect_ops_test.cpp
@sperlingxx
sperlingxx requested a review from a team as a code owner April 19, 2021 10:07
@github-actions github-actions Bot added the CMake CMake build issue label Apr 19, 2021
@sperlingxx
sperlingxx changed the base branch from branch-0.19 to branch-0.20 April 19, 2021 10:08
@codecov

codecov Bot commented Apr 19, 2021

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (branch-21.06@dd5eecd). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head e146913 differs from pull request most recent head dca2bb6. Consider uploading reports for the commit dca2bb6 to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##             branch-21.06    #7881   +/-   ##
===============================================
  Coverage                ?   82.89%           
===============================================
  Files                   ?      105           
  Lines                   ?    17875           
  Branches                ?        0           
===============================================
  Hits                    ?    14817           
  Misses                  ?     3058           
  Partials                ?        0           

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 dd5eecd...dca2bb6. Read the comment docs.

@sperlingxx
sperlingxx requested review from mythrocks and ttnghia May 10, 2021 04:22
@sperlingxx

sperlingxx commented May 10, 2021

Copy link
Copy Markdown
Contributor Author

Hi @ttnghia @mythrocks, I apologize for triggering re-requesting review by mistake. I didn't realize the refactor involving multiple PRs until I found #8158.

@mythrocks

Copy link
Copy Markdown
Contributor

No worries, sir. We will prioritize this as soon as #8158 is in.

Signed-off-by: sperlingxx <lovedreamf@gmail.com>
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
@ttnghia

ttnghia commented May 25, 2021

Copy link
Copy Markdown
Contributor

Rerun tests.

Comment thread cpp/src/rolling/rolling_detail.cuh Outdated
min_periods,
agg._null_handling,
stream,
mr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

collect_list will not be returned, thus we will not use mr. Instead, please use rmm::mr::get_current_device_resource().

@sperlingxx sperlingxx May 26, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, my bad! I always forget that. Shall we keep the stream, or replacing it with rmm::cuda_stream_default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I made this change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All func calls should use the same stream so we will not change that.

* @brief Derived aggregation class for specifying COLLECT_SET aggregation
*/
class collect_set_aggregation final : public aggregation {
class collect_set_aggregation final : public rolling_aggregation {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we inherit collect set from rolling_aggregation instead of aggregation? We need it for both rolling window and groupby, don't we?

@sperlingxx sperlingxx May 26, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because rolling_aggregation is virtually inherited from aggregation. I just followed corresponding codes for collect_list.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe both are wrong, as collect_set_aggregation and collect_set_aggregation are used not only in rolling window but in groupby. Can you change to:

class collect_list_aggregation final : public aggregation 
...
class collect_set_aggregation final : public aggregation 

and test if they can compile and unit tests all pass please?

@sperlingxx sperlingxx May 26, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @ttnghia, I tried on replacing rolling_aggregation with aggregation. And I got compiling error on src/aggregation/aggregation.cpp:454:

/home/alfredxu/workspace/codes/cudf/cpp/src/aggregation/aggregation.cpp:454:74: error: could not convert ‘std::make_unique(_Args&& ...) [with _Tp = cudf::detail::collect_list_aggregation; _Args = {cudf::null_policy&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<cudf::detail::collect_list_aggregation, std::default_delete<cudf::detail::collect_list_aggregation> >]()’ from ‘unique_ptr<cudf::detail::collect_list_aggregation,default_delete<cudf::detail::collect_list_aggregation>>’ to ‘unique_ptr<cudf::rolling_aggregation,default_delete<cudf::rolling_aggregation>>’

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

/// Factory to create a COLLECT_LIST aggregation
template <typename Base = aggregation>
std::unique_ptr<Base> make_collect_list_aggregation(null_policy null_handling)
{
  return std::make_unique<detail::collect_list_aggregation>(null_handling);
}
template std::unique_ptr<aggregation> make_collect_list_aggregation<aggregation>(
  null_policy null_handling);
template std::unique_ptr<rolling_aggregation> make_collect_list_aggregation<rolling_aggregation>(
  null_policy null_handling);

I think it is because we can not return std::unique_ptr<rolling_aggregation> after we made the replacement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. Thanks 😄

Signed-off-by: sperlingxx <lovedreamf@gmail.com>

@ttnghia ttnghia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Now we have other blocker PRs (#8342 and rapidsai/dask-cuda#623). Wait for them merged first before we can rerun tests.

@sperlingxx

Copy link
Copy Markdown
Contributor Author

rerun tests

@ttnghia

ttnghia commented May 26, 2021

Copy link
Copy Markdown
Contributor

Rerun tests.

@ttnghia

ttnghia commented May 26, 2021

Copy link
Copy Markdown
Contributor

@gpucibot merge

@rapids-bot
rapids-bot Bot merged commit be05a00 into NVIDIA:branch-21.06 May 26, 2021
@sperlingxx
sperlingxx deleted the collect_set_rolling branch May 26, 2021 22:18
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 CMake CMake build issue improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants