Skip to content

Add tests for cupy.cuda.cub#2598

Merged
kmaehashi merged 15 commits intocupy:masterfrom
leofang:cub_tests
Jun 11, 2020
Merged

Add tests for cupy.cuda.cub#2598
kmaehashi merged 15 commits intocupy:masterfrom
leofang:cub_tests

Conversation

@leofang
Copy link
Copy Markdown
Member

@leofang leofang commented Nov 3, 2019

I think it's better to have a separate PR for CUB tests.

This PR will hopefully help #2579 once the CI is set up to test CUB. Preferably this PR should get reviewed after #2584 and #2596 are merged, but it is not blocked by those two PRs for two reasons:

  1. the tests simply won't be run if cupy.cuda.cub is not built
  2. the original cupy.argmin() and cupy.argmax() would be tested instead, if the CUB support from Add CUB support for argmax() and argmin() #2596 is not ready.

Note: using the TestCUBperformance class here I found that CUB may be slower for a few cases (such as small workloads), so I think the performance warning/documentation discussed with @emcastillo in #2562 may still be needed.

@y1r y1r mentioned this pull request Nov 4, 2019
return a.argmax()


# This class compares CUB results against CuPy's original implementation
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Currently we don't have a performance benchmark in our test code base.
How about adding it in examples/ directory like as done in cuTENSOR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, I noticed that too. This part was meant to detect performance regression. CUB is generally faster, but there could be exceptions. Do you think we don’t need to worry about it for now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me clarify, what do you mean by "performance regression"? Do you want to find which parameter combinations are slower when CUB is enabled (ie, find "exceptions") ? or you want to detect regression between versions/commits?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This class has the former (finding exceptions) in mind. It compares with the old reduction kernels.

I don’t think the latter is possible without having some persistent database recording the performance data. It’s not easy to set this up...

Copy link
Copy Markdown
Member Author

@leofang leofang Nov 8, 2019

Choose a reason for hiding this comment

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

I removed the performance tests when refactoring the tests. Let me know if you want me to bring them back in an alternative form. Presumably it could also be another PR.

@leofang

This comment has been minimized.

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Nov 21, 2019

@grlee77 I wonder if you are able to reproduce this error?

@leofang

This comment has been minimized.

@grlee77
Copy link
Copy Markdown
Member

grlee77 commented Nov 21, 2019

I am currently on a branch where I had merged your bug fixes and am not seeing the error. I can try on current master, though and see if it occurs there.

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Nov 21, 2019

Let me also try a fresh build. Perhaps I didn't do it right...

@leofang

This comment has been minimized.

@grlee77
Copy link
Copy Markdown
Member

grlee77 commented Nov 21, 2019

I was unable to reproduce it

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Nov 22, 2019

Thanks @grlee77. I am 99% sure this is a false alert. Sorry for the noise. Had a bad day here...

@leofang

This comment has been minimized.

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Dec 16, 2019

@kmaehashi PTAL when you start reviewing #2584. Thanks.

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Mar 18, 2020

@kmaehashi To pass the CI for this you need to have CUB installed (#2584). I can confirm locally this PR passes with the master branch.

@kmaehashi
Copy link
Copy Markdown
Member

Sorry for the review delay in this PR 🙇
In addition to the comments above, I see many test failures when I locally run the test code with CUB enabled. Could you check?

@kmaehashi
Copy link
Copy Markdown
Member

I think it's better to merge this PR first, then merge #2584 after verifying CUDA 11.0 support.

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Jun 8, 2020

Thanks for revisiting this, @kmaehashi!

I think it's better to merge this PR first, then merge #2584 after verifying CUDA 11.0 support.

Agreed. It makes sense (not sure what you meant on CUDA 11).

In addition to the comments above, I see many test failures when I locally run the test code with CUB enabled. Could you check?

I have been testing CUB module extensively recently and didn't see any error. I just rebuilt locally (against the master) and applied this patch, and the three touched tests still passed. Could you post a snippet of error logs so that I can look into which test fails (and how it fails), please?

@leofang
Copy link
Copy Markdown
Member Author

leofang commented Jun 10, 2020

Could you post a snippet of error logs so that I can look into which test fails (and how it fails), please?

Ping @kmaehashi

@kmaehashi
Copy link
Copy Markdown
Member

Sorry, I retested and confirmed all tests pass. It seems my build was broken.
pfnCI, test this please.

@pfn-ci-bot
Copy link
Copy Markdown
Collaborator

Successfully created a job for commit 85900bc:

@chainer-ci
Copy link
Copy Markdown
Member

Jenkins CI test (for commit 85900bc, target branch master) succeeded!

leofang added a commit to leofang/cupy that referenced this pull request Jun 11, 2020
style in line with the existing tests and cupy#2598
@kmaehashi kmaehashi merged commit 019efc9 into cupy:master Jun 11, 2020
@kmaehashi
Copy link
Copy Markdown
Member

LGTM! Thank you for your great work!

@kmaehashi kmaehashi added the cat:test Test code / CI label Jun 11, 2020
@leofang leofang mentioned this pull request Jun 11, 2020
@leofang
Copy link
Copy Markdown
Member Author

leofang commented Jun 11, 2020

Thanks, @kmaehashi! By the way, I just added CUB spmv tests in #3428.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:test Test code / CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants