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

Switch pytest-xdist algo to worksteal #15207

Merged
merged 3 commits into from
Mar 4, 2024

Conversation

galipremsagar
Copy link
Contributor

Description

This PR switches pytest-xdist distribution algorithm to a much more efficient algorithm worksteal, that will assign any idle pytest worker to pickup remaining pytests.

I see a 25% time savings when this switch is made locally:

`loadscope`:
== 101421 passed, 2115 skipped, 867 xfailed in 1179.48s (0:19:39) ==
`worksteal`:
== 101423 passed, 2115 skipped, 867 xfailed in 891.79s (0:14:51) ==

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@galipremsagar galipremsagar added 3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Mar 1, 2024
@galipremsagar galipremsagar self-assigned this Mar 1, 2024
@galipremsagar galipremsagar requested a review from a team as a code owner March 1, 2024 20:16
@github-actions github-actions bot added the ci label Mar 1, 2024
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Nice! This is a new feature in pytest-xdist 3.2.0, from about a year ago (after I had last investigated the options for --dist). https://pytest-xdist.readthedocs.io/en/latest/changelog.html#pytest-xdist-3-2-0-2023-02-07

I vaguely recall there might have been some issues caused by other --dist options in the past. 🤔 I tried to see if I could find a past issue/PR about this but didn't see one.

@galipremsagar
Copy link
Contributor Author

galipremsagar commented Mar 1, 2024

Nice! This is a new feature in pytest-xdist 3.2.0, from about a year ago (after I had last investigated the options for --dist). https://pytest-xdist.readthedocs.io/en/latest/changelog.html#pytest-xdist-3-2-0-2023-02-07

I vaguely recall there might have been some issues caused by other --dist options in the past. 🤔 I tried to see if I could find a past issue/PR about this but didn't see one.

Yes, loadscope was the only best distribution I found more than a year ago. While going through pytest-xdist docs today, I found this algorithm which was perfect for our setup.

@bdice
Copy link
Contributor

bdice commented Mar 4, 2024

@galipremsagar For awareness, I have prepared a series of PRs (locally) that will apply the worksteal strategy across RAPIDS repos that support pytest-xdist. I will open those PRs after this one is merged.

@galipremsagar
Copy link
Contributor Author

@galipremsagar For awareness, I have prepared a series of PRs (locally) that will apply the worksteal strategy across RAPIDS repos that support pytest-xdist. I will open those PRs after this one is merged.

Thanks @bdice ! For reference here are the time savings:
branch-24.04:

======== 101174 passed, 2091 skipped, 1136 xfailed in 853.34s (0:14:13) ========

This PR:

======== 101424 passed, 2115 skipped, 869 xfailed in 689.92s (0:11:29) =========

An entire job that took 27 mins now takes just 17 mins! - 10mins time reduction.

@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Mar 4, 2024
@galipremsagar
Copy link
Contributor Author

/merge

@vyasr
Copy link
Contributor

vyasr commented Mar 4, 2024

That's an amazing speedup @galipremsagar!

@bdice when you make your PRs, can you also double-check and align the parallelism across wheel/conda builds? For example, cuml wheel tests are currently using -n 4 while conda tests use -n 8. Adjusting those can also save us time.

There are larger improvements we could make to unify the testing logic more generally, but for now I'm just focusing on the quick wins!

rapids-bot bot pushed a commit to rapidsai/cuxfilter that referenced this pull request Mar 6, 2024
This PR uses the `worksteal` algorithm to accelerate parallel pytests. See rapidsai/cudf#15207.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Jake Awe (https://github.com/AyodeAwe)

URL: #576
rapids-bot bot pushed a commit to rapidsai/cuspatial that referenced this pull request Mar 6, 2024
This PR uses the `worksteal` algorithm to accelerate parallel pytests. See rapidsai/cudf#15207.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - GALI PREM SAGAR (https://github.com/galipremsagar)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #1355
rapids-bot bot pushed a commit to rapidsai/cucim that referenced this pull request Mar 6, 2024
This PR uses the `worksteal` algorithm to accelerate parallel pytests. See rapidsai/cudf#15207.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - GALI PREM SAGAR (https://github.com/galipremsagar)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #708
rapids-bot bot pushed a commit to rapidsai/cuml that referenced this pull request Mar 6, 2024
This PR uses the `worksteal` algorithm to accelerate parallel pytests. See rapidsai/cudf#15207.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Jake Awe (https://github.com/AyodeAwe)

URL: #5792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants