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] Cartesian Product Iterator #250

Merged
merged 12 commits into from
Jul 20, 2020

Conversation

cwharris
Copy link
Contributor

@cwharris cwharris commented Jul 1, 2020

Factored out the Cartesian product iterator used by the Hausdorff distance implementation so that it can be used in st distance, and other n^2 distance metrics. Also added the ability to iterate the Cartesian product of two inputs, rather than a single input against itself. One of the goals was to avoid impacting Hausdorff performance. Instead of reaching that goal, Hausdorff performance was increased by 40%. 🎉

---------------------------------------------------------------------------------------------------------------
Benchmark                                                     Time             CPU   Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------
HausdorffBenchmark/hausdorff/1024/1024/manual_time        0.681 ms        0.698 ms         1022 items_per_second=1.53716G/s
HausdorffBenchmark/hausdorff/4096/1024/manual_time        0.679 ms        0.696 ms         1024 items_per_second=1.54078G/s
HausdorffBenchmark/hausdorff/16384/1024/manual_time       0.681 ms        0.698 ms         1015 items_per_second=1.53786G/s
HausdorffBenchmark/hausdorff/1024/4096/manual_time         7.33 ms         7.34 ms           95 items_per_second=2.28901G/s
HausdorffBenchmark/hausdorff/4096/4096/manual_time         9.98 ms         10.0 ms           67 items_per_second=1.67971G/s
HausdorffBenchmark/hausdorff/16384/4096/manual_time        9.97 ms         9.99 ms           68 items_per_second=1.68188G/s
HausdorffBenchmark/hausdorff/1024/32768/manual_time         531 ms          531 ms            1 items_per_second=2.02367G/s
HausdorffBenchmark/hausdorff/4096/32768/manual_time         524 ms          524 ms            1 items_per_second=2.04759G/s
HausdorffBenchmark/hausdorff/16384/32768/manual_time        538 ms          539 ms            1 items_per_second=1.99397G/s

@cwharris cwharris requested review from a team as code owners July 1, 2020 20:39
@GPUtester
Copy link
Contributor

Please update the changelog in order to start CI tests.

View the gpuCI docs here.

@cwharris
Copy link
Contributor Author

cwharris commented Jul 1, 2020

rerun tests

@harrism
Copy link
Member

harrism commented Jul 2, 2020

@cwharris please set labels and put either [WIP] or [REVIEW] in the title so we know the status.

@cwharris cwharris changed the title Cartesian Product Iterator [REVIEW] Cartesian Product Iterator Jul 2, 2020
@trxcllnt
Copy link
Contributor

trxcllnt commented Jul 2, 2020

rerun tests

@cwharris
Copy link
Contributor Author

cwharris commented Jul 6, 2020

This PR is needed to support development for #231.

@cwharris
Copy link
Contributor Author

cwharris commented Jul 7, 2020

rerun tests

Copy link
Contributor

@trxcllnt trxcllnt left a comment

Choose a reason for hiding this comment

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

Made that one suggestion to use thrust::distance, but other than that looks good to me.

@trxcllnt
Copy link
Contributor

trxcllnt commented Jul 7, 2020

Note, style checks will be fixed once #252 is merged.

@cwharris
Copy link
Contributor Author

cwharris commented Jul 9, 2020

rerun tests

@harrism
Copy link
Member

harrism commented Jul 9, 2020

One of the goals was to avoid impacting Hausdorff performance. Instead of reaching that goal, Hausdorff performance was increased by 40%.

@cwharris the benchmark you included doesn't compare two things against each other, so how am I to see a 40% increase from it? Also, why do they all say "manual_time"? (Aare you using manual timing, and if so, why?)

@cwharris
Copy link
Contributor Author

cwharris commented Jul 9, 2020

@harrism Previous benchmarks are from #246 (comment)

I have not yet investigated why/when to use manual time, or what it means 😞. I was following the lead from other benchmarks, such as gather. Benchmark is declared here: https://github.com/rapidsai/cuspatial/blob/branch-0.15/cpp/benchmarks/hausdorff_benchmark.cpp#L56

Previous benchmarks

---------------------------------------------------------------------------------------------------------------
Benchmark                                                     Time             CPU   Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------
HausdorffBenchmark/hausdorff/1024/1024/manual_time        0.801 ms        0.818 ms          869 items_per_second=1.30675G/s
HausdorffBenchmark/hausdorff/4096/1024/manual_time        0.803 ms        0.820 ms          862 items_per_second=1.30263G/s
HausdorffBenchmark/hausdorff/16384/1024/manual_time       0.804 ms        0.821 ms          854 items_per_second=1.30151G/s
HausdorffBenchmark/hausdorff/1024/4096/manual_time         10.8 ms         10.8 ms           63 items_per_second=1.54981G/s
HausdorffBenchmark/hausdorff/4096/4096/manual_time         12.3 ms         12.3 ms           56 items_per_second=1.36443G/s
HausdorffBenchmark/hausdorff/16384/4096/manual_time        12.3 ms         12.3 ms           56 items_per_second=1.36471G/s
HausdorffBenchmark/hausdorff/1024/32768/manual_time         728 ms          728 ms            1 items_per_second=1.475G/s
HausdorffBenchmark/hausdorff/4096/32768/manual_time         790 ms          790 ms            1 items_per_second=1.35852G/s
HausdorffBenchmark/hausdorff/16384/32768/manual_time        770 ms          770 ms            1 items_per_second=1.39406G/s

@jrhemstad
Copy link
Contributor

The manual_time comes from using the cuda_event_timer.

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 like a good way to factor out N^2 distance metrics. Most of my comments are about documentation, just a couple on code.

cpp/src/spatial/hausdorff.cu Outdated Show resolved Hide resolved
cpp/src/spatial/hausdorff.cu Show resolved Hide resolved
Copy link
Contributor

@thomcom thomcom left a comment

Choose a reason for hiding this comment

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

Really great refactor, love the cartesian product iterator. I had a few questions and minor reformatting concerns but I approve, not worth holding it up over it.

@cwharris
Copy link
Contributor Author

cwharris commented Jul 9, 2020

@thomcom did you make comments? I don't see them. 🤷‍♂️

@cwharris cwharris requested a review from harrism July 12, 2020 01:19
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.

Seems like there's a new undocumented and untested API added in (minimum_euclidean_distance)? If so, I think you should move it to a new PR so we can get this one merged.

cpp/src/spatial/polygon_separation.cu Outdated Show resolved Hide resolved
cpp/src/spatial/polygon_separation.cu Outdated Show resolved Hide resolved
@cwharris cwharris merged commit 688a604 into rapidsai:branch-0.15 Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants