Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Conversation

@RAMitchell
Copy link
Contributor

@RAMitchell RAMitchell commented Mar 31, 2020

Implementation of thrust::shuffle following std::shuffle API.

Todo:

  • Code style consistency
  • Documentation
  • Document/justify selection of round function (currently uses linear feedback shift but with somewhat arbitrary parameters)
  • Define thrust::shuffle_copy

I'm wondering if I should add another version of this function specifying an output iterator to avoid the copy?

Benchmark results for shuffle (on DGX1 V100):

Algorithm Element Type Elements per Trial STL Average Walltime STL Walltime Uncertainty STL Average Throughput Thrust Average Walltime Thrust Walltime Uncertainty Thrust Average Throughput
shuffle char 67108864 1.86 0.04 3.60E+07 0.02 0.03 4.00E+09
shuffle char 134217728 5.33 0.03 2.52E+07 0.04 0.04 4.00E+09
shuffle double 8388608 0.2402 0.0003 3.49E+07 0.0041 0.0003 2.10E+09
shuffle double 16777216 0.66 0.01 2.52E+07 0.0063 0.001 2.70E+09
shuffle float 16777216 0.49 0.01 3.40E+07 0.01 0.03 2.00E+09
shuffle float 33554432 1.36 0.02 2.47E+07 0.01 0.03 3.00E+09
shuffle int 16777216 0.475 0.007 3.53E+07 0.01 0.03 1.00E+09
shuffle int 33554432 1.3 0.01 2.58E+07 0.01 0.03 2.00E+09
shuffle int16_t 33554432 0.95 0.01 3.53E+07 0.01 0.04 3.00E+09
shuffle int16_t 67108864 2.61 0.02 2.57E+07 0.02 0.04 3.00E+09
shuffle int32_t 16777216 0.477 0.007 3.52E+07 0.01 0.04 1.00E+09
shuffle int32_t 33554432 1.3 0.02 2.58E+07 0.01 0.03 3.00E+09
shuffle int64_t 8388608 0.2414 0.0007 3.48E+07 0.01 0.04 8.00E+08
shuffle int64_t 16777216 0.6686 0.0006 2.51E+07 0.01 0.03 1.00E+09
shuffle int8_t 67108864 1.89 0.01 3.55E+07 0.02 0.03 4.00E+09
shuffle int8_t 134217728 5.23 0.05 2.57E+07 0.04 0.04 4.00E+09

@jaredhoberock
Copy link
Contributor

I'm wondering if I should add another version of this function specifying an output iterator to avoid the copy?

Yes, I'd suggest shuffle and shuffle_copy.

@RAMitchell RAMitchell force-pushed the shuffle branch 2 times, most recently from 8ed52fa to a63078b Compare April 2, 2020 01:17
Copy link
Collaborator

@griwes griwes left a comment

Choose a reason for hiding this comment

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

This looks pretty good, I only have a few comments. I've noticed some typos in the doxygen, I'll try to do another pass through that soon.

Looking at the individual commits, I think we should squash this down to a single one before we merge.

Copy link
Collaborator

@alliepiper alliepiper left a comment

Choose a reason for hiding this comment

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

This will cause issues with C++11 compilers, but once that's cleared up this patch LGTM.

@alliepiper
Copy link
Collaborator

Thank for the quick updates! I'll take it from here and starting validating this against our internal CI.

Just a heads up, I'll need to squash this into a single commit before merging. I'll push an update that does that soon.

@alliepiper
Copy link
Collaborator

Local build is clean, tests pass. CI started under shelve 28225884.

@alliepiper alliepiper force-pushed the shuffle branch 3 times, most recently from 08d40f3 to fea984d Compare April 9, 2020 18:55
Resolve linux compilation, add benchmark

Add shuffle_copy, tidy up and comment

doxygen

Address review comments

Silence warnings

Guard c++11
@griwes griwes self-requested a review April 10, 2020 23:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants