Skip to content

Conversation

@clee2000
Copy link
Contributor

@clee2000 clee2000 commented Jul 21, 2022

After #81116, we started pulling test times straight from the source instead of first downloading them in the build job and then having the test job take the build jobs version. This can cause an issues where different shards pull different versions of the file, leading to incorrect sharding (ex two shards running the same tests file on accident). This generally happens if the test jobs happen while the test times file is being updated (unlikely, but not impossible) or if someone reruns a test job the next day.

In this PR, I return to the old method of downloading the test times file during the build job and having the test jobs pull from the build jobs uploaded artifacts. If there is no test times file in the build job's artifacts, we fall back to the default sharding plan.

Notes:

  • script moved to a new file to avoid needing to import torch, which would require torch to be built, which can cause issues with asan
  • I got errors with asan (ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.), so I put the script at the beginning of the build

Test Plan

Verified that the number of tests ran in the pull and trunk workflows are similar to workflows run on master. Checked logs to see if artifacts were being used for sharding. Spot checked a few test configs to check that their lists of selected tests didn't overlap.

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jul 21, 2022

🔗 Helpful links

✅ No Failures (0 Pending)

As of commit 78482f9 (more details on the Dr. CI page):

Expand to see more

💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@clee2000 clee2000 added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 21, 2022
@clee2000 clee2000 force-pushed the csl/artifacts branch 2 times, most recently from 86f4728 to e911e43 Compare July 26, 2022 22:29
@clee2000 clee2000 marked this pull request as ready for review July 27, 2022 19:13
@clee2000 clee2000 requested a review from a team as a code owner July 27, 2022 19:13
Copy link
Contributor

@janeyx99 janeyx99 left a comment

Choose a reason for hiding this comment

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

Test plan? Have you verified that sharding works for all configs?

looks good though! and your asan solution is...genius....can't believe we didn't think of that for all these months and years.

@janeyx99
Copy link
Contributor

This PR would also fix #74620

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 27, 2022

🔗 Helpful Links

🧪 See artifacts and rendered test results here

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

✅ No Failures

As of commit 78482f9:
💚 Looks good so far! There are no failures yet. 💚

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

@clee2000
Copy link
Contributor Author

Test plan? Have you verified that sharding works for all configs?

updated the pr body

@clee2000 clee2000 requested a review from janeyx99 July 27, 2022 21:34
with open(path, "r") as f:
test_file_times = cast(Dict[str, Any], json.load(f))
else:
test_file_times = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

If the path doesn't exist, would it make sense to fall back to the previous behavior test_file_times = get_test_times(str(REPO_ROOT), filename=TEST_TIMES_FILE) here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we do that, we run into the issue of race conditions + reruns being different

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, what I'm curious about is that may be the possibility of race conditions + reruns being different is still better than the default sharding plan. Thus, we still use the old code knowingly before your fix. If I get your answer correctly, I guess it's not worth the trouble to keep the old logic here as a fallback.

@clee2000
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge and created land time checks. See merge status here and land check progress here

pytorchmergebot pushed a commit that referenced this pull request Jul 28, 2022
After #81116, we started pulling test times straight from the source instead of first downloading them in the build job and then having the test job take the build jobs version.  This can cause an issues where different shards pull different versions of the file, leading to incorrect sharding (ex two shards running the same tests file on accident).  This generally happens if the test jobs happen while the test times file is being updated (unlikely, but not impossible) or if someone reruns a test job the next day.

In this PR, I return to the old method of downloading the test times file during the build job and having the test jobs pull from the build jobs uploaded artifacts.  If there is no test times file in the build job's artifacts, we fall back to the default sharding plan.

Notes:
* script moved to a new file to avoid needing to import torch, which would require torch to be built, which can cause issues with asan
* I got errors with asan (`ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.`), so I put the script at the beginning of the build

### Test Plan
Verified that the number of tests ran in the pull and trunk workflows are similar to workflows run on master.  Checked logs to see if artifacts were being used for sharding.  Spot checked a few test configs to check that their lists of selected tests didn't overlap.
Pull Request resolved: #81915
Approved by: https://github.com/huydhn
@pytorchmergebot
Copy link
Collaborator

@clee2000
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here

@github-actions
Copy link
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.

facebook-github-bot pushed a commit that referenced this pull request Jul 29, 2022
…81915)

Summary:
After #81116, we started pulling test times straight from the source instead of first downloading them in the build job and then having the test job take the build jobs version.  This can cause an issues where different shards pull different versions of the file, leading to incorrect sharding (ex two shards running the same tests file on accident).  This generally happens if the test jobs happen while the test times file is being updated (unlikely, but not impossible) or if someone reruns a test job the next day.

In this PR, I return to the old method of downloading the test times file during the build job and having the test jobs pull from the build jobs uploaded artifacts.  If there is no test times file in the build job's artifacts, we fall back to the default sharding plan.

Notes:
* script moved to a new file to avoid needing to import torch, which would require torch to be built, which can cause issues with asan
* I got errors with asan (`ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.`), so I put the script at the beginning of the build

### Test Plan
Verified that the number of tests ran in the pull and trunk workflows are similar to workflows run on master.  Checked logs to see if artifacts were being used for sharding.  Spot checked a few test configs to check that their lists of selected tests didn't overlap.

Pull Request resolved: #81915
Approved by: https://github.com/huydhn

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/86f038dd56dab9ecec5893b60efc74e46ca19e36

Reviewed By: osalpekar

Differential Revision: D38252585

Pulled By: clee2000

fbshipit-source-id: 912b5fa0977647a79785e24613355ff0879bcacf
@clee2000 clee2000 deleted the csl/artifacts branch September 28, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request cla signed Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants