-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Speed up tests by shaving off subprocess when not needed #3042
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I'm a bit confused by the command launchers. It feels that there are multiple ways to achieve the same, or very similar things, and can't wrap my heard around what the difference is.
E.g. let's take the TPU tests. Previously, they were calling run_command
, which in turn calls subprocess.check_output
. Now they call tpu_command_launcher
which calls subprocess.run
. So how come the latter is faster? Is it really related to spawning subprocesses, as it appears that both ways do that.
Maybe you plan on harmonizing this further later on (say, removing run_command
completely) and then this will become more obvious to me, but as is I'm confused.
That said, don't let my confusion block you from proceeding if this is a clear gain in test speed.
@BenjaminBossan yep exactly as it sounds, doing 2x subprocess is slower than 1x by a decent margin apparently. (Yes, I more or less intend to remove |
Hmm, you mean that |
Only when the underlying command calls subprocess (like the tpu ones) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not 100% sure why we see the speedup, but it's fine to merge from my point of view.
What does this PR do?
As title states, subprocess is slow. Each time we call it adds a whole second or so to the testing suite. This PR removes that (when save/applicable) from our testing suite, and instead does a 1:1 replacement by capturing the
stdout
instead of a func (said func being the equivalentaccelerate.commands.X
.Total CPU CI time:
For specific areas:
TpuConfigTester
: (10x reduction)AccelerateLauncherTester
(50% reduction)Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@BenjaminBossan @SunMarc