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

Tests: Increase robustness of context creation testing #1096

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

ptheywood
Copy link
Member

@ptheywood ptheywood commented Jul 27, 2023

To ensure that no cuda calls occur prior to device selection, an always run method in the test suite previously used timing and a cutoff threshold to make sure a new context was being established. This was quite flakey, as new driver updates could improve context creation times, requiring a lower threshold.

Instead, getting the current context via the driver api is used, and it should return null (or a cuda error) if no context yet exists. This should be a much more robust testing mechanism.

This is still created per run of the test suite, regardless of if the specific test is requested or not, which is wasted time if running with a filter (one more context creation than needed, so extra time).

We may wish to move this test to a separate ctest orcestrated test binary, to ensure it is the first to run (Google test has no way to enforce test order as a feature)


Tested on linux with CUDA 11.0 and 12.2 (12.2/driver 535 broke the old test on my 3060ti as context creation was too fast), and manually added a context creating call prior to applyConfig to ensure it will identify any errors that it is checking for.

Also removed a superfluos include.

To ensure that no cuda calls occur prior to device selection, an always run method in the test suite previously used timing and a cutoff threshold to make sure a new context was being established.
This was quite flakey, as new driver updates could improve context creation times, requiring a lower threshold.

Instead, getting the current context via the driver api is used, and it should return null (or a cuda error) if no context yet exists.
This should be a much more robust testing mechanism.

This is still created per run of the test suite, regardless of if the specific test is requested or not, which is wasted time if running with a filter (one more context creation than needed, so extra time).

We may wish to move this test to a separate ctest orcestrated test binary, to ensure it is the first to run (Google test has no way to enforce test order as a feature)
@mondus mondus merged commit 797e71e into master Jul 28, 2023
18 checks passed
@mondus mondus deleted the better-context-test branch July 28, 2023 10:24
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.

2 participants