Skip to content

test in parallel at file granularity - #84961

Closed
clee2000 wants to merge 7 commits into
masterfrom
csl/para
Closed

clee2000 wants to merge 7 commits into
masterfrom
csl/para

Conversation

@clee2000

@clee2000 clee2000 commented Sep 13, 2022 •

Copy link
Copy Markdown
Contributor

run tests in parallel at the test file granularity

runs 3 files in parallel using multiprocessing pool, output goes to a file, which is then printed when the test finishes. Some tests cannot be run in parallel (usually due to lacking memory), so we run those after. Sharding is changed to attempt to mask large files with other large files/run them on the same shard.

test_ops* gets a custom handler to run it because it is simply too big (2hrs on windows) and linalg_cholesky fails (I would really like a solution to this if possible, but until then we use the custom handler).

reduces cuda tests by a lot, reduces total windows test time by ~1hr

Ref. #82894

@pytorch-bot

pytorch-bot Bot commented Sep 13, 2022 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/84961

Note: Links to docs will display an error until the docs builds have been completed.

❌ 6 Failures

As of commit f0d5a30:

The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@clee2000 clee2000 added ciflow/trunk Trigger trunk jobs on your pull request ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR and removed cla signed labels Sep 13, 2022
@clee2000
clee2000 marked this pull request as ready for review September 13, 2022 22:23
@lezcano
lezcano removed their request for review September 14, 2022 08:33
@IvanYashchuk
IvanYashchuk removed their request for review September 14, 2022 12:22
auto pivots_ = pivots.to(kLong);
auto pivots_data = pivots_.data_ptr<int64_t>();

c10::cuda::device_synchronize();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This change requires a comment.


// Constructor
explicit MAGMAQueue(int64_t device_id) {
c10::cuda::device_synchronize();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If the goal is to affect LU tests then this synchronize shall be localized to LU function only, here's the place where MAGMAQueue is created:

MAGMAQueue magma_queue(input.get_device());

@IvanYashchuk
IvanYashchuk requested a review from ngimel September 14, 2022 12:41
Comment thread torch/testing/_internal/common_utils.py Resolved

@janeyx99 janeyx99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a document/description somewhere of the devx side effects of this change?

Comment thread test/run_test.py Resolved
@clee2000
clee2000 requested a review from jeffdaily as a code owner September 15, 2022 17:59
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Resolved
Comment thread test/run_test.py Outdated
os.environ["PARALLEL_TESTING"] = "1"
pool = mp.Pool(num_procs)
for i in range(num_procs):
log_fd, file_path = tempfile.mkstemp(dir=REPO_ROOT / "test" / "test-reports",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think creating the temp file here looks hard to maintain. Do you think it's better to do this internally and transparently inside run_test? After the test, you can just glob all files under REPO_ROOT/test/test-reports as they are already named correctly with the test module prefix. So there is no need to pass the temp filename and file descriptor around. You can also just remove the whole test-reports directory after

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved file creation + printing to inside of run_test

Comment thread test/run_test.py
for return_code in return_codes:
if return_code.get() != 0:
return return_code.get()
return_code = run_test(test_module, test_directory, copy.deepcopy(options),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Umm, what does the second run_test do here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it runs linalg_cholesky

@huydhn huydhn Sep 16, 2022 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ohhh, I see. It all makes sense now. May be a comment on the code will help the next people looking at it

Comment thread test/run_test.py Resolved
@clee2000

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered with the land checks (-l) flag. If you did not specify this flag yourself, you are likely enrolled in the land checks rollout. This means that your change will be merged once all checks on your PR have passed since you have added the ciflow/trunk label to your PR (ETA 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

@github-actions

Copy link
Copy Markdown
Contributor

Hey @clee2000.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

@clee2000

Copy link
Copy Markdown
Contributor Author

@pytorchbot revert -m "makes test_forward_ad_nn_functional_max_unpool2d_cuda_float32 flakily unexpectedly pass" -c weird

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Please reach out to the PyTorch DevX Team with feedback or questions!

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@clee2000 your PR has been successfully reverted.

pytorchmergebot added a commit that referenced this pull request Sep 21, 2022
This reverts commit 8107666.

Reverted #84961 on behalf of https://github.com/clee2000 due to makes test_forward_ad_nn_functional_max_unpool2d_cuda_float32 flakily unexpectedly pass
@clee2000 clee2000 reopened this Sep 21, 2022
@clee2000 clee2000 closed this Sep 23, 2022
pytorchmergebot pushed a commit that referenced this pull request Sep 23, 2022
part one of splitting up #84961 into (probably 2) parts

contains
* logging to file
* testing test_ops in parallel
Pull Request resolved: #85528
Approved by: https://github.com/huydhn
@clee2000
clee2000 deleted the csl/para branch September 28, 2022 17:22
pytorchmergebot pushed a commit that referenced this pull request Oct 3, 2022
part two of #84961

tests files in parallel at the test file granularity

* 2 procs at a time
* number of tests ran changed by <200, possibly due to adding more tests on master between the base commit and head commit of the PR
* may cause flakiness, but I haven't seen it in my small sample size of this PR
Pull Request resolved: #85770
Approved by: https://github.com/huydhn
mehtanirav pushed a commit that referenced this pull request Oct 4, 2022
run tests in parallel at the test file granularity

runs 3 files in parallel using multiprocessing pool, output goes to a file, which is then printed when the test finishes.  Some tests cannot be run in parallel (usually due to lacking memory), so we run those after.  Sharding is changed to attempt to mask large files with other large files/run them on the same shard.

test_ops* gets a custom handler to run it because it is simply too big (2hrs on windows) and linalg_cholesky fails (I would really like a solution to this if possible, but until then we use the custom handler).

reduces cuda tests by a lot, reduces total windows test time by ~1hr

Ref. #82894
Pull Request resolved: #84961
Approved by: https://github.com/huydhn
mehtanirav pushed a commit that referenced this pull request Oct 4, 2022
This reverts commit 8107666.

Reverted #84961 on behalf of https://github.com/clee2000 due to makes test_forward_ad_nn_functional_max_unpool2d_cuda_float32 flakily unexpectedly pass
mehtanirav pushed a commit that referenced this pull request Oct 4, 2022
part one of splitting up #84961 into (probably 2) parts

contains
* logging to file
* testing test_ops in parallel
Pull Request resolved: #85528
Approved by: https://github.com/huydhn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/trunk Trigger trunk jobs on your pull request cla signed Merged Reverted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants